From eb28c9e784e793b6a43fb234f90878d774f6ecfe Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 18 Dec 2020 19:15:01 +0000 Subject: [PATCH] CodeGen from PR 12172 in Azure/azure-rest-api-specs Merge f2644c9edc0d9924e0f66916b4c6b52cb207fafb into 5a6276c5d71420c445bd0951d2d5f3008a274821 --- .../src/Generated/AccountsOperations.cs | 630 ++++----- .../Generated/AccountsOperationsExtensions.cs | 93 +- .../src/Generated/CreatorsOperations.cs | 1222 +++++++++++++++++ .../Generated/CreatorsOperationsExtensions.cs | 266 ++++ .../src/Generated/IAccountsOperations.cs | 72 +- .../src/Generated/ICreatorsOperations.cs | 170 +++ .../src/Generated/IMapsManagementClient.cs | 21 +- .../Generated/IMapsOperationsOperations.cs | 46 + .../Generated/IPrivateAtlasesOperations.cs | 172 +++ .../src/Generated/MapsManagementClient.cs | 26 +- .../src/Generated/MapsOperationsOperations.cs | 229 +++ .../MapsOperationsOperationsExtensions.cs | 55 + .../Generated/Models/AzureEntityResource.cs | 62 + .../src/Generated/Models/CreatedByType.cs | 24 + .../src/Generated/Models/Creator.cs | 74 + .../Models/CreatorCreateParameters.cs | 84 ++ .../src/Generated/Models/CreatorProperties.cs | 53 + .../Models/CreatorUpdateParameters.cs | 62 + .../Generated/Models/ErrorAdditionalInfo.cs | 59 + .../Models/{Error.cs => ErrorDetail.cs} | 41 +- .../src/Generated/Models/ErrorDetailsItem.cs | 66 - .../src/Generated/Models/ErrorResponse.cs | 56 + ...Exception.cs => ErrorResponseException.cs} | 19 +- .../src/Generated/Models/MapsAccount.cs | 56 +- .../Models/MapsAccountCreateParameters.cs | 10 +- .../Models/MapsAccountsMoveRequest.cs | 82 -- .../src/Generated/Models/PrivateAtlas.cs | 75 + .../Models/PrivateAtlasCreateParameters.cs | 86 ++ .../Models/PrivateAtlasProperties.cs | 53 + .../Models/PrivateAtlasUpdateParameters.cs | 64 + .../src/Generated/Models/ProxyResource.cs | 53 + .../src/Generated/Models/Resource.cs | 27 +- .../src/Generated/Models/SystemData.cs | 103 ++ .../src/Generated/Models/TrackedResource.cs | 87 ++ .../src/Generated/PrivateAtlasesOperations.cs | 1222 +++++++++++++++++ .../PrivateAtlasesOperationsExtensions.cs | 266 ++++ .../SdkInfo_AzureMapsResourceProvider.cs | 17 +- 37 files changed, 5041 insertions(+), 762 deletions(-) create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/CreatorsOperations.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/CreatorsOperationsExtensions.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/ICreatorsOperations.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IMapsOperationsOperations.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IPrivateAtlasesOperations.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/MapsOperationsOperations.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/MapsOperationsOperationsExtensions.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/AzureEntityResource.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatedByType.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Creator.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatorCreateParameters.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatorProperties.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatorUpdateParameters.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorAdditionalInfo.cs rename sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/{Error.cs => ErrorDetail.cs} (55%) delete mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorDetailsItem.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorResponse.cs rename sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/{ErrorException.cs => ErrorResponseException.cs} (69%) delete mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountsMoveRequest.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/PrivateAtlas.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/PrivateAtlasCreateParameters.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/PrivateAtlasProperties.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/PrivateAtlasUpdateParameters.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ProxyResource.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/SystemData.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/TrackedResource.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/PrivateAtlasesOperations.cs create mode 100644 sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/PrivateAtlasesOperationsExtensions.cs diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/AccountsOperations.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/AccountsOperations.cs index 9cb26b96997f..f040df035c43 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/AccountsOperations.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/AccountsOperations.cs @@ -55,7 +55,7 @@ internal AccountsOperations(MapsManagementClient client) /// access to the Maps REST APIs. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -69,7 +69,7 @@ internal AccountsOperations(MapsManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -90,14 +90,43 @@ internal AccountsOperations(MapsManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (accountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); @@ -200,11 +229,11 @@ internal AccountsOperations(MapsManagementClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 201) { - var ex = new ErrorException(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); - Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -283,7 +312,7 @@ internal AccountsOperations(MapsManagementClient client) /// after creation, such as Sku and Tags. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -297,7 +326,7 @@ internal AccountsOperations(MapsManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -318,14 +347,43 @@ internal AccountsOperations(MapsManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (accountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); @@ -422,13 +480,13 @@ internal AccountsOperations(MapsManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 404) + if ((int)_statusCode != 200) { - var ex = new ErrorException(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); - Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -488,7 +546,7 @@ internal AccountsOperations(MapsManagementClient client) /// Delete a Maps Account. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -499,7 +557,7 @@ internal AccountsOperations(MapsManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -517,14 +575,43 @@ internal AccountsOperations(MapsManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (accountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); @@ -612,11 +699,11 @@ internal AccountsOperations(MapsManagementClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 204) { - var ex = new ErrorException(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); - Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -658,7 +745,7 @@ internal AccountsOperations(MapsManagementClient client) /// Get a Maps Account. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -669,7 +756,7 @@ internal AccountsOperations(MapsManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -690,14 +777,43 @@ internal AccountsOperations(MapsManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (accountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); @@ -783,13 +899,13 @@ internal AccountsOperations(MapsManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 404) + if ((int)_statusCode != 200) { - var ex = new ErrorException(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); - Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -849,7 +965,7 @@ internal AccountsOperations(MapsManagementClient client) /// Get all Maps Accounts in a Resource Group /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// Headers that will be added to request. @@ -857,7 +973,7 @@ internal AccountsOperations(MapsManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -878,14 +994,43 @@ internal AccountsOperations(MapsManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -967,11 +1112,11 @@ internal AccountsOperations(MapsManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorException(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); - Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -1036,7 +1181,7 @@ internal AccountsOperations(MapsManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1057,10 +1202,24 @@ internal AccountsOperations(MapsManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1140,11 +1299,11 @@ internal AccountsOperations(MapsManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorException(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); - Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -1201,13 +1360,15 @@ internal AccountsOperations(MapsManagementClient client) } /// - /// Moves Maps Accounts from one ResourceGroup (or Subscription) to another + /// Get the keys to use with the Maps APIs. A key is used to authenticate and + /// authorize access to the Maps REST APIs. Only one key is needed at a time; + /// two are given to provide seamless key regeneration. /// /// - /// The name of the resource group that contains Maps Account to move. + /// The name of the resource group. The name is case insensitive. /// - /// - /// The details of the Maps Account move. + /// + /// The name of the Maps Account. /// /// /// Headers that will be added to request. @@ -1215,9 +1376,12 @@ internal AccountsOperations(MapsManagementClient 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 /// @@ -1227,203 +1391,48 @@ internal AccountsOperations(MapsManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task MoveWithHttpMessagesAsync(string resourceGroupName, MapsAccountsMoveRequest moveRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListKeysWithHttpMessagesAsync(string resourceGroupName, string accountName, 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"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (moveRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "moveRequest"); - } - if (moveRequest != null) - { - moveRequest.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("moveRequest", moveRequest); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Move", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("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 (Client.ApiVersion.Length < 1) { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } - - // Serialize Request - string _requestContent = null; - if(moveRequest != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(moveRequest, 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) + if (Client.SubscriptionId == null) { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - // Send Request - if (_shouldTrace) + if (Client.SubscriptionId != null) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) + if (resourceGroupName == null) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) + if (resourceGroupName != null) { - var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) + if (resourceGroupName.Length > 90) { - // Ignore the exception + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) + if (resourceGroupName.Length < 1) { - ServiceClientTracing.Error(_invocationId, ex); + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } - _httpRequest.Dispose(); - if (_httpResponse != null) + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) { - _httpResponse.Dispose(); + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); } - 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; - } - - /// - /// Get the keys to use with the Maps APIs. A key is used to authenticate and - /// authorize access to the Maps REST APIs. Only one key is needed at a time; - /// two are given to provide seamless key regeneration. - /// - /// - /// The name of the Azure Resource Group. - /// - /// - /// The name of the Maps Account. - /// - /// - /// 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> ListKeysWithHttpMessagesAsync(string resourceGroupName, string accountName, 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"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (accountName == null) { @@ -1510,13 +1519,13 @@ internal AccountsOperations(MapsManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 404) + if ((int)_statusCode != 200) { - var ex = new ErrorException(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); - Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -1577,7 +1586,7 @@ internal AccountsOperations(MapsManagementClient client) /// The old key will stop working immediately. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -1591,7 +1600,7 @@ internal AccountsOperations(MapsManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1612,14 +1621,43 @@ internal AccountsOperations(MapsManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (accountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); @@ -1720,13 +1758,13 @@ internal AccountsOperations(MapsManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 404) + if ((int)_statusCode != 200) { - var ex = new ErrorException(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); - Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -1782,173 +1820,5 @@ internal AccountsOperations(MapsManagementClient client) return _result; } - /// - /// List operations available for the Maps Resource Provider - /// - /// - /// 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>> ListOperationsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // 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, "ListOperations", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Maps/operations").ToString(); - 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 ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - Error _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/maps/Microsoft.Azure.Management.Maps/src/Generated/AccountsOperationsExtensions.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/AccountsOperationsExtensions.cs index 4751a4332ac3..04ccbc2b8e11 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/AccountsOperationsExtensions.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/AccountsOperationsExtensions.cs @@ -31,7 +31,7 @@ public static partial class AccountsOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -52,7 +52,7 @@ public static MapsAccount CreateOrUpdate(this IAccountsOperations operations, st /// The operations group for this extension method. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -79,7 +79,7 @@ public static MapsAccount CreateOrUpdate(this IAccountsOperations operations, st /// The operations group for this extension method. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -100,7 +100,7 @@ public static MapsAccount Update(this IAccountsOperations operations, string res /// The operations group for this extension method. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -126,7 +126,7 @@ public static MapsAccount Update(this IAccountsOperations operations, string res /// The operations group for this extension method. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -143,7 +143,7 @@ public static void Delete(this IAccountsOperations operations, string resourceGr /// The operations group for this extension method. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -163,7 +163,7 @@ public static void Delete(this IAccountsOperations operations, string resourceGr /// The operations group for this extension method. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -180,7 +180,7 @@ public static MapsAccount Get(this IAccountsOperations operations, string resour /// The operations group for this extension method. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -203,7 +203,7 @@ public static MapsAccount Get(this IAccountsOperations operations, string resour /// The operations group for this extension method. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// public static IEnumerable ListByResourceGroup(this IAccountsOperations operations, string resourceGroupName) { @@ -217,7 +217,7 @@ public static IEnumerable ListByResourceGroup(this IAccountsOperati /// The operations group for this extension method. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The cancellation token. @@ -258,43 +258,6 @@ public static IEnumerable ListBySubscription(this IAccountsOperatio } } - /// - /// Moves Maps Accounts from one ResourceGroup (or Subscription) to another - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains Maps Account to move. - /// - /// - /// The details of the Maps Account move. - /// - public static void Move(this IAccountsOperations operations, string resourceGroupName, MapsAccountsMoveRequest moveRequest) - { - operations.MoveAsync(resourceGroupName, moveRequest).GetAwaiter().GetResult(); - } - - /// - /// Moves Maps Accounts from one ResourceGroup (or Subscription) to another - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains Maps Account to move. - /// - /// - /// The details of the Maps Account move. - /// - /// - /// The cancellation token. - /// - public static async Task MoveAsync(this IAccountsOperations operations, string resourceGroupName, MapsAccountsMoveRequest moveRequest, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.MoveWithHttpMessagesAsync(resourceGroupName, moveRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - /// /// Get the keys to use with the Maps APIs. A key is used to authenticate and /// authorize access to the Maps REST APIs. Only one key is needed at a time; @@ -304,7 +267,7 @@ public static void Move(this IAccountsOperations operations, string resourceGrou /// The operations group for this extension method. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -323,7 +286,7 @@ public static MapsAccountKeys ListKeys(this IAccountsOperations operations, stri /// The operations group for this extension method. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -347,7 +310,7 @@ public static MapsAccountKeys ListKeys(this IAccountsOperations operations, stri /// The operations group for this extension method. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -368,7 +331,7 @@ public static MapsAccountKeys RegenerateKeys(this IAccountsOperations operations /// The operations group for this extension method. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -387,33 +350,5 @@ public static MapsAccountKeys RegenerateKeys(this IAccountsOperations operations } } - /// - /// List operations available for the Maps Resource Provider - /// - /// - /// The operations group for this extension method. - /// - public static IEnumerable ListOperations(this IAccountsOperations operations) - { - return operations.ListOperationsAsync().GetAwaiter().GetResult(); - } - - /// - /// List operations available for the Maps Resource Provider - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListOperationsAsync(this IAccountsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListOperationsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - } } diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/CreatorsOperations.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/CreatorsOperations.cs new file mode 100644 index 000000000000..a4d50472b1a4 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/CreatorsOperations.cs @@ -0,0 +1,1222 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps +{ + 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; + + /// + /// CreatorsOperations operations. + /// + internal partial class CreatorsOperations : IServiceOperations, ICreatorsOperations + { + /// + /// Initializes a new instance of the CreatorsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CreatorsOperations(MapsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MapsManagementClient + /// + public MapsManagementClient Client { get; private set; } + + /// + /// Get all Creator instances for an Azure Maps Account + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// 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>> ListByAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByAccount", 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.Maps/accounts/{accountName}/creators").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + 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; + } + + /// + /// Create or update a Maps Creator resource. Creator resource will manage + /// Azure resources required to populate a custom set of mapping data. It + /// requires an account to exist before it can be created. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Maps Creator instance. + /// + /// + /// The new or updated parameters for the Creator resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string creatorName, CreatorCreateParameters creatorCreateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (creatorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "creatorName"); + } + if (creatorCreateParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "creatorCreateParameters"); + } + if (creatorCreateParameters != null) + { + creatorCreateParameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("creatorName", creatorName); + tracingParameters.Add("creatorCreateParameters", creatorCreateParameters); + 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.Maps/accounts/{accountName}/creators/{creatorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{creatorName}", System.Uri.EscapeDataString(creatorName)); + 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(creatorCreateParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(creatorCreateParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates the Maps Creator resource. Only a subset of the parameters may be + /// updated after creation, such as Tags. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Maps Creator instance. + /// + /// + /// The update parameters for Maps Creator. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string creatorName, CreatorUpdateParameters creatorUpdateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (creatorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "creatorName"); + } + if (creatorUpdateParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "creatorUpdateParameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("creatorName", creatorName); + tracingParameters.Add("creatorUpdateParameters", creatorUpdateParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}/creators/{creatorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{creatorName}", System.Uri.EscapeDataString(creatorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(creatorUpdateParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(creatorUpdateParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a Maps Creator resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Maps Creator 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 DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string creatorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (creatorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "creatorName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("creatorName", creatorName); + 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.Maps/accounts/{accountName}/creators/{creatorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{creatorName}", System.Uri.EscapeDataString(creatorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new 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; + } + + /// + /// Get a Maps Creator resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Maps Creator 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 accountName, string creatorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (creatorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "creatorName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("creatorName", creatorName); + 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.Maps/accounts/{accountName}/creators/{creatorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{creatorName}", System.Uri.EscapeDataString(creatorName)); + 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/maps/Microsoft.Azure.Management.Maps/src/Generated/CreatorsOperationsExtensions.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/CreatorsOperationsExtensions.cs new file mode 100644 index 000000000000..df25012755e0 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/CreatorsOperationsExtensions.cs @@ -0,0 +1,266 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CreatorsOperations. + /// + public static partial class CreatorsOperationsExtensions + { + /// + /// Get all Creator instances for an Azure Maps Account + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + public static IEnumerable ListByAccount(this ICreatorsOperations operations, string resourceGroupName, string accountName) + { + return operations.ListByAccountAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); + } + + /// + /// Get all Creator instances for an Azure Maps Account + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByAccountAsync(this ICreatorsOperations operations, string resourceGroupName, string accountName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByAccountWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a Maps Creator resource. Creator resource will manage + /// Azure resources required to populate a custom set of mapping data. It + /// requires an account to exist before it can be created. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Maps Creator instance. + /// + /// + /// The new or updated parameters for the Creator resource. + /// + public static Creator CreateOrUpdate(this ICreatorsOperations operations, string resourceGroupName, string accountName, string creatorName, CreatorCreateParameters creatorCreateParameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, accountName, creatorName, creatorCreateParameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a Maps Creator resource. Creator resource will manage + /// Azure resources required to populate a custom set of mapping data. It + /// requires an account to exist before it can be created. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Maps Creator instance. + /// + /// + /// The new or updated parameters for the Creator resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ICreatorsOperations operations, string resourceGroupName, string accountName, string creatorName, CreatorCreateParameters creatorCreateParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, accountName, creatorName, creatorCreateParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the Maps Creator resource. Only a subset of the parameters may be + /// updated after creation, such as Tags. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Maps Creator instance. + /// + /// + /// The update parameters for Maps Creator. + /// + public static Creator Update(this ICreatorsOperations operations, string resourceGroupName, string accountName, string creatorName, CreatorUpdateParameters creatorUpdateParameters) + { + return operations.UpdateAsync(resourceGroupName, accountName, creatorName, creatorUpdateParameters).GetAwaiter().GetResult(); + } + + /// + /// Updates the Maps Creator resource. Only a subset of the parameters may be + /// updated after creation, such as Tags. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Maps Creator instance. + /// + /// + /// The update parameters for Maps Creator. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ICreatorsOperations operations, string resourceGroupName, string accountName, string creatorName, CreatorUpdateParameters creatorUpdateParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, accountName, creatorName, creatorUpdateParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a Maps Creator resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Maps Creator instance. + /// + public static void Delete(this ICreatorsOperations operations, string resourceGroupName, string accountName, string creatorName) + { + operations.DeleteAsync(resourceGroupName, accountName, creatorName).GetAwaiter().GetResult(); + } + + /// + /// Delete a Maps Creator resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Maps Creator instance. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ICreatorsOperations operations, string resourceGroupName, string accountName, string creatorName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, accountName, creatorName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get a Maps Creator resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Maps Creator instance. + /// + public static Creator Get(this ICreatorsOperations operations, string resourceGroupName, string accountName, string creatorName) + { + return operations.GetAsync(resourceGroupName, accountName, creatorName).GetAwaiter().GetResult(); + } + + /// + /// Get a Maps Creator resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Maps Creator instance. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICreatorsOperations operations, string resourceGroupName, string accountName, string creatorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, accountName, creatorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IAccountsOperations.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IAccountsOperations.cs index 6f2f3990efd9..b580401941c4 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IAccountsOperations.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IAccountsOperations.cs @@ -28,7 +28,7 @@ public partial interface IAccountsOperations /// which allow access to the Maps REST APIs. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -42,7 +42,7 @@ public partial interface IAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -57,7 +57,7 @@ public partial interface IAccountsOperations /// updated after creation, such as Sku and Tags. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -71,7 +71,7 @@ public partial interface IAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -85,7 +85,7 @@ public partial interface IAccountsOperations /// Delete a Maps Account. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -96,7 +96,7 @@ public partial interface IAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -107,7 +107,7 @@ public partial interface IAccountsOperations /// Get a Maps Account. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -118,7 +118,7 @@ public partial interface IAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -132,7 +132,7 @@ public partial interface IAccountsOperations /// Get all Maps Accounts in a Resource Group /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The headers that will be added to request. @@ -140,7 +140,7 @@ public partial interface IAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -159,7 +159,7 @@ public partial interface IAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -170,36 +170,13 @@ public partial interface IAccountsOperations /// Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Moves Maps Accounts from one ResourceGroup (or Subscription) to - /// another - /// - /// - /// The name of the resource group that contains Maps Account to move. - /// - /// - /// The details of the Maps Account move. - /// - /// - /// 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 MoveWithHttpMessagesAsync(string resourceGroupName, MapsAccountsMoveRequest moveRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// /// Get the keys to use with the Maps APIs. A key is used to /// authenticate and authorize access to the Maps REST APIs. Only one /// key is needed at a time; two are given to provide seamless key /// regeneration. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -210,7 +187,7 @@ public partial interface IAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -225,7 +202,7 @@ public partial interface IAccountsOperations /// Maps APIs. The old key will stop working immediately. /// /// - /// The name of the Azure Resource Group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the Maps Account. @@ -239,7 +216,7 @@ public partial interface IAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -249,24 +226,5 @@ public partial interface IAccountsOperations /// Thrown when a required parameter is null /// Task> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string accountName, MapsKeySpecification keySpecification, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List operations available for the Maps Resource Provider - /// - /// - /// 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>> ListOperationsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/ICreatorsOperations.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/ICreatorsOperations.cs new file mode 100644 index 000000000000..74d72bf8985c --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/ICreatorsOperations.cs @@ -0,0 +1,170 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CreatorsOperations operations. + /// + public partial interface ICreatorsOperations + { + /// + /// Get all Creator instances for an Azure Maps Account + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// 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>> ListByAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a Maps Creator resource. Creator resource will + /// manage Azure resources required to populate a custom set of mapping + /// data. It requires an account to exist before it can be created. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Maps Creator instance. + /// + /// + /// The new or updated parameters for the Creator resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string creatorName, CreatorCreateParameters creatorCreateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the Maps Creator resource. Only a subset of the parameters + /// may be updated after creation, such as Tags. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Maps Creator instance. + /// + /// + /// The update parameters for Maps Creator. + /// + /// + /// 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 accountName, string creatorName, CreatorUpdateParameters creatorUpdateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a Maps Creator resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Maps Creator 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 DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string creatorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a Maps Creator resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Maps Creator 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 accountName, string creatorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IMapsManagementClient.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IMapsManagementClient.cs index 2db6b8ce445d..777fc1b699df 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IMapsManagementClient.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IMapsManagementClient.cs @@ -41,14 +41,12 @@ public partial interface IMapsManagementClient : System.IDisposable ServiceClientCredentials Credentials { get; } /// - /// Subscription credentials which uniquely identify Microsoft Azure - /// subscription. The subscription ID forms part of the URI for every - /// service call. + /// The ID of the target subscription. /// string SubscriptionId { get; set; } /// - /// Client Api Version. + /// The API version to use for this operation. /// string ApiVersion { get; } @@ -76,5 +74,20 @@ public partial interface IMapsManagementClient : System.IDisposable /// IAccountsOperations Accounts { get; } + /// + /// Gets the IMapsOperationsOperations. + /// + IMapsOperationsOperations Maps { get; } + + /// + /// Gets the IPrivateAtlasesOperations. + /// + IPrivateAtlasesOperations PrivateAtlases { get; } + + /// + /// Gets the ICreatorsOperations. + /// + ICreatorsOperations Creators { get; } + } } diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IMapsOperationsOperations.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IMapsOperationsOperations.cs new file mode 100644 index 000000000000..1bd84d028d2b --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IMapsOperationsOperations.cs @@ -0,0 +1,46 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// MapsOperationsOperations operations. + /// + public partial interface IMapsOperationsOperations + { + /// + /// List operations available for the Maps Resource Provider + /// + /// + /// 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>> ListOperationsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IPrivateAtlasesOperations.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IPrivateAtlasesOperations.cs new file mode 100644 index 000000000000..6957702c26ef --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IPrivateAtlasesOperations.cs @@ -0,0 +1,172 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateAtlasesOperations operations. + /// + public partial interface IPrivateAtlasesOperations + { + /// + /// [Deprecated] Create or update a Private Atlas resource. Private + /// Atlas resource will enable the usage of Azure resources to build a + /// custom set of mapping data. It requires an account to exist before + /// it can be created. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Private Atlas instance. + /// + /// + /// The new or updated parameters for the Private Atlas resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateAtlasName, PrivateAtlasCreateParameters privateAtlasCreateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// [Deprecated] Updates the Private Atlas resource. Only a subset of + /// the parameters may be updated after creation, such as Tags. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Private Atlas instance. + /// + /// + /// The updated parameters for the Private Atlas. + /// + /// + /// 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 accountName, string privateAtlasName, PrivateAtlasUpdateParameters privateAtlasUpdateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// [Deprecated] Delete a Private Atlas resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Private Atlas 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 DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateAtlasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// [Deprecated] Get a Private Atlas resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Private Atlas 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 accountName, string privateAtlasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// [Deprecated] Get all Private Atlas instances for an Azure Map + /// Account + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// 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>> ListByAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/MapsManagementClient.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/MapsManagementClient.cs index 543db09da1a3..459ba2e63b30 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/MapsManagementClient.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/MapsManagementClient.cs @@ -47,14 +47,12 @@ public partial class MapsManagementClient : ServiceClient, public ServiceClientCredentials Credentials { get; private set; } /// - /// Subscription credentials which uniquely identify Microsoft Azure - /// subscription. The subscription ID forms part of the URI for every service - /// call. + /// The ID of the target subscription. /// public string SubscriptionId { get; set; } /// - /// Client Api Version. + /// The API version to use for this operation. /// public string ApiVersion { get; private set; } @@ -81,6 +79,21 @@ public partial class MapsManagementClient : ServiceClient, /// public virtual IAccountsOperations Accounts { get; private set; } + /// + /// Gets the IMapsOperationsOperations. + /// + public virtual IMapsOperationsOperations Maps { get; private set; } + + /// + /// Gets the IPrivateAtlasesOperations. + /// + public virtual IPrivateAtlasesOperations PrivateAtlases { get; private set; } + + /// + /// Gets the ICreatorsOperations. + /// + public virtual ICreatorsOperations Creators { get; private set; } + /// /// Initializes a new instance of the MapsManagementClient class. /// @@ -323,8 +336,11 @@ public MapsManagementClient(System.Uri baseUri, ServiceClientCredentials credent private void Initialize() { Accounts = new AccountsOperations(this); + Maps = new MapsOperationsOperations(this); + PrivateAtlases = new PrivateAtlasesOperations(this); + Creators = new CreatorsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2018-05-01"; + ApiVersion = "2020-02-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/MapsOperationsOperations.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/MapsOperationsOperations.cs new file mode 100644 index 000000000000..22e84d1b12be --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/MapsOperationsOperations.cs @@ -0,0 +1,229 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps +{ + 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; + + /// + /// MapsOperationsOperations operations. + /// + internal partial class MapsOperationsOperations : IServiceOperations, IMapsOperationsOperations + { + /// + /// Initializes a new instance of the MapsOperationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal MapsOperationsOperations(MapsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MapsManagementClient + /// + public MapsManagementClient Client { get; private set; } + + /// + /// List operations available for the Maps Resource Provider + /// + /// + /// 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>> ListOperationsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // 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, "ListOperations", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Maps/operations").ToString(); + 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/maps/Microsoft.Azure.Management.Maps/src/Generated/MapsOperationsOperationsExtensions.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/MapsOperationsOperationsExtensions.cs new file mode 100644 index 000000000000..98483d996dca --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/MapsOperationsOperationsExtensions.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.Maps +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for MapsOperationsOperations. + /// + public static partial class MapsOperationsOperationsExtensions + { + /// + /// List operations available for the Maps Resource Provider + /// + /// + /// The operations group for this extension method. + /// + public static IEnumerable ListOperations(this IMapsOperationsOperations operations) + { + return operations.ListOperationsAsync().GetAwaiter().GetResult(); + } + + /// + /// List operations available for the Maps Resource Provider + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOperationsAsync(this IMapsOperationsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOperationsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/AzureEntityResource.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/AzureEntityResource.cs new file mode 100644 index 000000000000..a89894e384c5 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/AzureEntityResource.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.Maps.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Entity Resource + /// + /// + /// The resource model definition for an Azure Resource Manager resource + /// with an etag. + /// + public partial class AzureEntityResource : Resource + { + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + public AzureEntityResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Resource Etag. + public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + : base(id, name, type) + { + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Etag. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatedByType.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatedByType.cs new file mode 100644 index 000000000000..8ee7eb729d9c --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatedByType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + + /// + /// Defines values for CreatedByType. + /// + public static class CreatedByType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Creator.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Creator.cs new file mode 100644 index 000000000000..e1eaf3d5722c --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Creator.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Azure resource which represents Maps Creator product and provides + /// ability to manage private location data. + /// + public partial class Creator : TrackedResource + { + /// + /// Initializes a new instance of the Creator class. + /// + public Creator() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Creator class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Resource tags. + /// The Creator resource properties. + public Creator(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), CreatorProperties properties = default(CreatorProperties)) + : base(location, id, name, type, tags) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Creator resource properties. + /// + [JsonProperty(PropertyName = "properties")] + public CreatorProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatorCreateParameters.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatorCreateParameters.cs new file mode 100644 index 000000000000..8b260ed0cbe6 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatorCreateParameters.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Parameters used to create a new Maps Creator resource. + /// + public partial class CreatorCreateParameters + { + /// + /// Initializes a new instance of the CreatorCreateParameters class. + /// + public CreatorCreateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CreatorCreateParameters class. + /// + /// The location of the resource. + /// Gets or sets a list of key value pairs that + /// describe the resource. These tags can be used in viewing and + /// grouping this resource (across resource groups). A maximum of 15 + /// tags can be provided for a resource. Each tag must have a key no + /// greater than 128 characters and value no greater than 256 + /// characters. + public CreatorCreateParameters(string location, IDictionary tags = default(IDictionary)) + { + Location = location; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the location of the resource. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets a list of key value pairs that describe the resource. + /// These tags can be used in viewing and grouping this resource + /// (across resource groups). A maximum of 15 tags can be provided for + /// a resource. Each tag must have a key no greater than 128 characters + /// and value no greater than 256 characters. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatorProperties.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatorProperties.cs new file mode 100644 index 000000000000..259c4900ad35 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatorProperties.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.Maps.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Creator resource properties + /// + public partial class CreatorProperties + { + /// + /// Initializes a new instance of the CreatorProperties class. + /// + public CreatorProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CreatorProperties class. + /// + /// The state of the resource + /// provisioning, terminal states: Succeeded, Failed, Canceled + public CreatorProperties(string provisioningState = default(string)) + { + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the state of the resource provisioning, terminal + /// states: Succeeded, Failed, Canceled + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; set; } + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatorUpdateParameters.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatorUpdateParameters.cs new file mode 100644 index 000000000000..e18604014d13 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatorUpdateParameters.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.Maps.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Parameters used to update an existing Creator resource. + /// + public partial class CreatorUpdateParameters + { + /// + /// Initializes a new instance of the CreatorUpdateParameters class. + /// + public CreatorUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CreatorUpdateParameters class. + /// + /// Gets or sets a list of key value pairs that + /// describe the resource. These tags can be used in viewing and + /// grouping this resource (across resource groups). A maximum of 15 + /// tags can be provided for a resource. Each tag must have a key no + /// greater than 128 characters and value no greater than 256 + /// characters. + public CreatorUpdateParameters(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a list of key value pairs that describe the resource. + /// These tags can be used in viewing and grouping this resource + /// (across resource groups). A maximum of 15 tags can be provided for + /// a resource. Each tag must have a key no greater than 128 characters + /// and value no greater than 256 characters. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..9cb2c459a98c --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorAdditionalInfo.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource management error additional info. + /// + public partial class ErrorAdditionalInfo + { + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + public ErrorAdditionalInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + /// The additional info type. + /// The additional info. + public ErrorAdditionalInfo(string type = default(string), object info = default(object)) + { + Type = type; + Info = info; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the additional info type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the additional info. + /// + [JsonProperty(PropertyName = "info")] + public object Info { get; private set; } + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Error.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorDetail.cs similarity index 55% rename from sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Error.cs rename to sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorDetail.cs index 00d203f8c547..f5442b623084 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Error.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorDetail.cs @@ -16,34 +16,33 @@ namespace Microsoft.Azure.Management.Maps.Models using System.Linq; /// - /// This object is returned when an error occurs in the Maps API + /// The error detail. /// - public partial class Error + public partial class ErrorDetail { /// - /// Initializes a new instance of the Error class. + /// Initializes a new instance of the ErrorDetail class. /// - public Error() + public ErrorDetail() { CustomInit(); } /// - /// Initializes a new instance of the Error class. + /// Initializes a new instance of the ErrorDetail class. /// - /// Error code. - /// If available, a human readable description of - /// the error. - /// If available, the component generating the - /// error. - /// If available, a list of additional details - /// about the error. - public Error(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList)) + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + public ErrorDetail(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) { Code = code; Message = message; Target = target; Details = details; + AdditionalInfo = additionalInfo; CustomInit(); } @@ -53,28 +52,34 @@ public Error() partial void CustomInit(); /// - /// Gets error code. + /// Gets the error code. /// [JsonProperty(PropertyName = "code")] public string Code { get; private set; } /// - /// Gets if available, a human readable description of the error. + /// Gets the error message. /// [JsonProperty(PropertyName = "message")] public string Message { get; private set; } /// - /// Gets if available, the component generating the error. + /// Gets the error target. /// [JsonProperty(PropertyName = "target")] public string Target { get; private set; } /// - /// Gets if available, a list of additional details about the error. + /// Gets the error details. /// [JsonProperty(PropertyName = "details")] - public IList Details { get; private set; } + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } } } diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorDetailsItem.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorDetailsItem.cs deleted file mode 100644 index 97ca780865b9..000000000000 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorDetailsItem.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Maps.Models -{ - using Newtonsoft.Json; - using System.Linq; - - public partial class ErrorDetailsItem - { - /// - /// Initializes a new instance of the ErrorDetailsItem class. - /// - public ErrorDetailsItem() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ErrorDetailsItem class. - /// - /// Error code. - /// If available, a human readable description of - /// the error. - /// If available, the component generating the - /// error. - public ErrorDetailsItem(string code = default(string), string message = default(string), string target = default(string)) - { - Code = code; - Message = message; - Target = target; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets error code. - /// - [JsonProperty(PropertyName = "code")] - public string Code { get; private set; } - - /// - /// Gets if available, a human readable description of the error. - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; private set; } - - /// - /// Gets if available, the component generating the error. - /// - [JsonProperty(PropertyName = "target")] - public string Target { get; private set; } - - } -} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorResponse.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..ea02ca2e2802 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error response + /// + /// + /// Common error response for all Azure Resource Manager APIs to return + /// error details for failed operations. (This also follows the OData error + /// response format.). + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The error object. + public ErrorResponse(ErrorDetail error = default(ErrorDetail)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the error object. + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetail Error { get; set; } + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorException.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorResponseException.cs similarity index 69% rename from sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorException.cs rename to sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorResponseException.cs index 59d2ae2010ab..2d388d0ffad1 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorException.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ErrorResponseException.cs @@ -13,9 +13,10 @@ namespace Microsoft.Azure.Management.Maps.Models using Microsoft.Rest; /// - /// Exception thrown for an invalid response with Error information. + /// Exception thrown for an invalid response with ErrorResponse + /// information. /// - public partial class ErrorException : RestException + public partial class ErrorResponseException : RestException { /// /// Gets information about the associated HTTP request. @@ -30,30 +31,30 @@ public partial class ErrorException : RestException /// /// Gets or sets the body object. /// - public Error Body { get; set; } + public ErrorResponse Body { get; set; } /// - /// Initializes a new instance of the ErrorException class. + /// Initializes a new instance of the ErrorResponseException class. /// - public ErrorException() + public ErrorResponseException() { } /// - /// Initializes a new instance of the ErrorException class. + /// Initializes a new instance of the ErrorResponseException class. /// /// The exception message. - public ErrorException(string message) + public ErrorResponseException(string message) : this(message, null) { } /// - /// Initializes a new instance of the ErrorException class. + /// Initializes a new instance of the ErrorResponseException class. /// /// The exception message. /// Inner exception. - public ErrorException(string message, System.Exception innerException) + public ErrorResponseException(string message, System.Exception innerException) : base(message, innerException) { } diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccount.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccount.cs index 952d00631485..db69750c8a2b 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccount.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccount.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.Management.Maps.Models /// /// An Azure resource which represents access to a suite of Maps REST APIs. /// - public partial class MapsAccount : Resource + public partial class MapsAccount : TrackedResource { /// /// Initializes a new instance of the MapsAccount class. @@ -31,25 +31,24 @@ public MapsAccount() /// /// Initializes a new instance of the MapsAccount class. /// - /// The fully qualified Maps Account resource - /// identifier. - /// The name of the Maps Account, which is unique - /// within a Resource Group. - /// Azure resource type. - /// The location of the resource. - /// Gets a list of key value pairs that describe the - /// resource. These tags can be used in viewing and grouping this - /// resource (across resource groups). A maximum of 15 tags can be - /// provided for a resource. Each tag must have a key no greater than - /// 128 characters and value no greater than 256 characters. + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Resource tags. /// The SKU of this account. + /// The system meta data relating to this + /// resource. /// The map account properties. - public MapsAccount(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), MapsAccountProperties properties = default(MapsAccountProperties)) - : base(id, name, type) + public MapsAccount(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), SystemData systemData = default(SystemData), MapsAccountProperties properties = default(MapsAccountProperties)) + : base(location, id, name, type, tags) { - Location = location; - Tags = tags; Sku = sku; + SystemData = systemData; Properties = properties; CustomInit(); } @@ -59,28 +58,18 @@ public MapsAccount() /// partial void CustomInit(); - /// - /// Gets the location of the resource. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Gets a list of key value pairs that describe the resource. These - /// tags can be used in viewing and grouping this resource (across - /// resource groups). A maximum of 15 tags can be provided for a - /// resource. Each tag must have a key no greater than 128 characters - /// and value no greater than 256 characters. - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; private set; } - /// /// Gets the SKU of this account. /// [JsonProperty(PropertyName = "sku")] public Sku Sku { get; private set; } + /// + /// Gets the system meta data relating to this resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + /// /// Gets the map account properties. /// @@ -93,8 +82,9 @@ public MapsAccount() /// /// Thrown if validation fails /// - public virtual void Validate() + public override void Validate() { + base.Validate(); if (Sku != null) { Sku.Validate(); diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountCreateParameters.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountCreateParameters.cs index cbc61f973976..9a8a54d8f915 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountCreateParameters.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountCreateParameters.cs @@ -38,9 +38,8 @@ public MapsAccountCreateParameters() /// The SKU of this account. /// Gets or sets a list of key value pairs that /// describe the resource. These tags can be used in viewing and - /// grouping this resource (across resource groups). A maximum of 15 - /// tags can be provided for a resource. Each tag must have a key no - /// greater than 128 characters and value no greater than 256 + /// grouping this resource (across resource groups). Each tag must have + /// a key no greater than 128 characters and value no greater than 256 /// characters. public MapsAccountCreateParameters(string location, Sku sku, IDictionary tags = default(IDictionary)) { @@ -64,9 +63,8 @@ public MapsAccountCreateParameters() /// /// Gets or sets a list of key value pairs that describe the resource. /// These tags can be used in viewing and grouping this resource - /// (across resource groups). A maximum of 15 tags can be provided for - /// a resource. Each tag must have a key no greater than 128 characters - /// and value no greater than 256 characters. + /// (across resource groups). Each tag must have a key no greater than + /// 128 characters and value no greater than 256 characters. /// [JsonProperty(PropertyName = "tags")] public IDictionary Tags { get; set; } diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountsMoveRequest.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountsMoveRequest.cs deleted file mode 100644 index 188976cf5bbf..000000000000 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountsMoveRequest.cs +++ /dev/null @@ -1,82 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Maps.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The description of what resources to move between resource groups. - /// - public partial class MapsAccountsMoveRequest - { - /// - /// Initializes a new instance of the MapsAccountsMoveRequest class. - /// - public MapsAccountsMoveRequest() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MapsAccountsMoveRequest class. - /// - /// The name of the destination - /// resource group. - /// A list of resource names to move from the - /// source resource group. - public MapsAccountsMoveRequest(string targetResourceGroup, IList resourceIds) - { - TargetResourceGroup = targetResourceGroup; - ResourceIds = resourceIds; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the destination resource group. - /// - [JsonProperty(PropertyName = "targetResourceGroup")] - public string TargetResourceGroup { get; set; } - - /// - /// Gets or sets a list of resource names to move from the source - /// resource group. - /// - [JsonProperty(PropertyName = "resourceIds")] - public IList ResourceIds { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (TargetResourceGroup == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "TargetResourceGroup"); - } - if (ResourceIds == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ResourceIds"); - } - } - } -} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/PrivateAtlas.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/PrivateAtlas.cs new file mode 100644 index 000000000000..450cf001c5b1 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/PrivateAtlas.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Azure resource which represents which will provision the ability to + /// create private location data. + /// + public partial class PrivateAtlas : TrackedResource + { + /// + /// Initializes a new instance of the PrivateAtlas class. + /// + public PrivateAtlas() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateAtlas class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Resource tags. + /// The Private Atlas resource + /// properties. + public PrivateAtlas(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), PrivateAtlasProperties properties = default(PrivateAtlasProperties)) + : base(location, id, name, type, tags) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Private Atlas resource properties. + /// + [JsonProperty(PropertyName = "properties")] + public PrivateAtlasProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/PrivateAtlasCreateParameters.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/PrivateAtlasCreateParameters.cs new file mode 100644 index 000000000000..643feed57a65 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/PrivateAtlasCreateParameters.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Parameters used to create a new Private Atlas resource. + /// + public partial class PrivateAtlasCreateParameters + { + /// + /// Initializes a new instance of the PrivateAtlasCreateParameters + /// class. + /// + public PrivateAtlasCreateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateAtlasCreateParameters + /// class. + /// + /// The location of the resource. + /// Gets or sets a list of key value pairs that + /// describe the resource. These tags can be used in viewing and + /// grouping this resource (across resource groups). A maximum of 15 + /// tags can be provided for a resource. Each tag must have a key no + /// greater than 128 characters and value no greater than 256 + /// characters. + public PrivateAtlasCreateParameters(string location, IDictionary tags = default(IDictionary)) + { + Location = location; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the location of the resource. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets a list of key value pairs that describe the resource. + /// These tags can be used in viewing and grouping this resource + /// (across resource groups). A maximum of 15 tags can be provided for + /// a resource. Each tag must have a key no greater than 128 characters + /// and value no greater than 256 characters. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/PrivateAtlasProperties.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/PrivateAtlasProperties.cs new file mode 100644 index 000000000000..26a50b558ffb --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/PrivateAtlasProperties.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.Maps.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Private Atlas resource properties + /// + public partial class PrivateAtlasProperties + { + /// + /// Initializes a new instance of the PrivateAtlasProperties class. + /// + public PrivateAtlasProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateAtlasProperties class. + /// + /// The state of the resource + /// provisioning, terminal states: Succeeded, Failed, Canceled + public PrivateAtlasProperties(string provisioningState = default(string)) + { + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the state of the resource provisioning, terminal + /// states: Succeeded, Failed, Canceled + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; set; } + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/PrivateAtlasUpdateParameters.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/PrivateAtlasUpdateParameters.cs new file mode 100644 index 000000000000..e6157972156b --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/PrivateAtlasUpdateParameters.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Parameters used to update an existing Private Atlas resource. + /// + public partial class PrivateAtlasUpdateParameters + { + /// + /// Initializes a new instance of the PrivateAtlasUpdateParameters + /// class. + /// + public PrivateAtlasUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateAtlasUpdateParameters + /// class. + /// + /// Gets or sets a list of key value pairs that + /// describe the resource. These tags can be used in viewing and + /// grouping this resource (across resource groups). A maximum of 15 + /// tags can be provided for a resource. Each tag must have a key no + /// greater than 128 characters and value no greater than 256 + /// characters. + public PrivateAtlasUpdateParameters(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a list of key value pairs that describe the resource. + /// These tags can be used in viewing and grouping this resource + /// (across resource groups). A maximum of 15 tags can be provided for + /// a resource. Each tag must have a key no greater than 128 characters + /// and value no greater than 256 characters. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ProxyResource.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ProxyResource.cs new file mode 100644 index 000000000000..33983e86da09 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ProxyResource.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.Maps.Models +{ + using System.Linq; + + /// + /// Proxy Resource + /// + /// + /// The resource model definition for a Azure Resource Manager proxy + /// resource. It will not have tags and a location + /// + public partial class ProxyResource : Resource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Resource.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Resource.cs index bc4679efd50e..944a9e5ed562 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Resource.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Resource.cs @@ -16,8 +16,12 @@ namespace Microsoft.Azure.Management.Maps.Models using System.Linq; /// - /// An Azure resource + /// Resource /// + /// + /// Common fields that are returned in the response for all Azure Resource + /// Manager resources + /// public partial class Resource : IResource { /// @@ -31,11 +35,12 @@ public Resource() /// /// Initializes a new instance of the Resource class. /// - /// The fully qualified Maps Account resource - /// identifier. - /// The name of the Maps Account, which is unique - /// within a Resource Group. - /// Azure resource type. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" public Resource(string id = default(string), string name = default(string), string type = default(string)) { Id = id; @@ -50,20 +55,22 @@ public Resource() partial void CustomInit(); /// - /// Gets the fully qualified Maps Account resource identifier. + /// Gets fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// - /// Gets the name of the Maps Account, which is unique within a - /// Resource Group. + /// Gets the name of the resource /// [JsonProperty(PropertyName = "name")] public string Name { get; private set; } /// - /// Gets azure resource type. + /// Gets the type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// [JsonProperty(PropertyName = "type")] public string Type { get; private set; } diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/SystemData.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/SystemData.cs new file mode 100644 index 000000000000..6d5654068360 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/SystemData.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.Maps.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata pertaining to creation and last modification of the resource. + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// The identity that created the + /// resource. + /// The type of identity that created the + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// The timestamp of resource creation + /// (UTC). + /// The identity that last modified the + /// resource. + /// The type of identity that last + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The type of identity that last + /// modified the resource. + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity that created the resource. + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource creation (UTC). + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTime? CreatedAt { get; set; } + + /// + /// Gets or sets the identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTime? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/TrackedResource.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/TrackedResource.cs new file mode 100644 index 000000000000..605424b96b24 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/TrackedResource.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Tracked Resource + /// + /// + /// The resource model definition for an Azure Resource Manager tracked top + /// level resource which has 'tags' and a 'location' + /// + public partial class TrackedResource : Resource + { + /// + /// Initializes a new instance of the TrackedResource class. + /// + public TrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TrackedResource class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Resource tags. + public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + : base(id, name, type) + { + Tags = tags; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the geo-location where the resource lives + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/PrivateAtlasesOperations.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/PrivateAtlasesOperations.cs new file mode 100644 index 000000000000..e0024c30a05f --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/PrivateAtlasesOperations.cs @@ -0,0 +1,1222 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps +{ + 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; + + /// + /// PrivateAtlasesOperations operations. + /// + internal partial class PrivateAtlasesOperations : IServiceOperations, IPrivateAtlasesOperations + { + /// + /// Initializes a new instance of the PrivateAtlasesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateAtlasesOperations(MapsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MapsManagementClient + /// + public MapsManagementClient Client { get; private set; } + + /// + /// [Deprecated] Create or update a Private Atlas resource. Private Atlas + /// resource will enable the usage of Azure resources to build a custom set of + /// mapping data. It requires an account to exist before it can be created. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Private Atlas instance. + /// + /// + /// The new or updated parameters for the Private Atlas resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateAtlasName, PrivateAtlasCreateParameters privateAtlasCreateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (privateAtlasName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateAtlasName"); + } + if (privateAtlasCreateParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateAtlasCreateParameters"); + } + if (privateAtlasCreateParameters != null) + { + privateAtlasCreateParameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("privateAtlasName", privateAtlasName); + tracingParameters.Add("privateAtlasCreateParameters", privateAtlasCreateParameters); + 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.Maps/accounts/{accountName}/privateAtlases/{privateAtlasName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{privateAtlasName}", System.Uri.EscapeDataString(privateAtlasName)); + 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(privateAtlasCreateParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(privateAtlasCreateParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// [Deprecated] Updates the Private Atlas resource. Only a subset of the + /// parameters may be updated after creation, such as Tags. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Private Atlas instance. + /// + /// + /// The updated parameters for the Private Atlas. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateAtlasName, PrivateAtlasUpdateParameters privateAtlasUpdateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (privateAtlasName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateAtlasName"); + } + if (privateAtlasUpdateParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateAtlasUpdateParameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("privateAtlasName", privateAtlasName); + tracingParameters.Add("privateAtlasUpdateParameters", privateAtlasUpdateParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}/privateAtlases/{privateAtlasName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{privateAtlasName}", System.Uri.EscapeDataString(privateAtlasName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(privateAtlasUpdateParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(privateAtlasUpdateParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// [Deprecated] Delete a Private Atlas resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Private Atlas 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 DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateAtlasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (privateAtlasName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateAtlasName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("privateAtlasName", privateAtlasName); + 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.Maps/accounts/{accountName}/privateAtlases/{privateAtlasName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{privateAtlasName}", System.Uri.EscapeDataString(privateAtlasName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new 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; + } + + /// + /// [Deprecated] Get a Private Atlas resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Private Atlas 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 accountName, string privateAtlasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (privateAtlasName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateAtlasName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("privateAtlasName", privateAtlasName); + 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.Maps/accounts/{accountName}/privateAtlases/{privateAtlasName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{privateAtlasName}", System.Uri.EscapeDataString(privateAtlasName)); + 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; + } + + /// + /// [Deprecated] Get all Private Atlas instances for an Azure Map Account + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// 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>> ListByAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByAccount", 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.Maps/accounts/{accountName}/privateAtlases").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + 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/maps/Microsoft.Azure.Management.Maps/src/Generated/PrivateAtlasesOperationsExtensions.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/PrivateAtlasesOperationsExtensions.cs new file mode 100644 index 000000000000..d1bd857b4783 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/PrivateAtlasesOperationsExtensions.cs @@ -0,0 +1,266 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PrivateAtlasesOperations. + /// + public static partial class PrivateAtlasesOperationsExtensions + { + /// + /// [Deprecated] Create or update a Private Atlas resource. Private Atlas + /// resource will enable the usage of Azure resources to build a custom set of + /// mapping data. It requires an account to exist before it can be created. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Private Atlas instance. + /// + /// + /// The new or updated parameters for the Private Atlas resource. + /// + public static PrivateAtlas CreateOrUpdate(this IPrivateAtlasesOperations operations, string resourceGroupName, string accountName, string privateAtlasName, PrivateAtlasCreateParameters privateAtlasCreateParameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, accountName, privateAtlasName, privateAtlasCreateParameters).GetAwaiter().GetResult(); + } + + /// + /// [Deprecated] Create or update a Private Atlas resource. Private Atlas + /// resource will enable the usage of Azure resources to build a custom set of + /// mapping data. It requires an account to exist before it can be created. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Private Atlas instance. + /// + /// + /// The new or updated parameters for the Private Atlas resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IPrivateAtlasesOperations operations, string resourceGroupName, string accountName, string privateAtlasName, PrivateAtlasCreateParameters privateAtlasCreateParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, accountName, privateAtlasName, privateAtlasCreateParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// [Deprecated] Updates the Private Atlas resource. Only a subset of the + /// parameters may be updated after creation, such as Tags. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Private Atlas instance. + /// + /// + /// The updated parameters for the Private Atlas. + /// + public static PrivateAtlas Update(this IPrivateAtlasesOperations operations, string resourceGroupName, string accountName, string privateAtlasName, PrivateAtlasUpdateParameters privateAtlasUpdateParameters) + { + return operations.UpdateAsync(resourceGroupName, accountName, privateAtlasName, privateAtlasUpdateParameters).GetAwaiter().GetResult(); + } + + /// + /// [Deprecated] Updates the Private Atlas resource. Only a subset of the + /// parameters may be updated after creation, such as Tags. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Private Atlas instance. + /// + /// + /// The updated parameters for the Private Atlas. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IPrivateAtlasesOperations operations, string resourceGroupName, string accountName, string privateAtlasName, PrivateAtlasUpdateParameters privateAtlasUpdateParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, accountName, privateAtlasName, privateAtlasUpdateParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// [Deprecated] Delete a Private Atlas resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Private Atlas instance. + /// + public static void Delete(this IPrivateAtlasesOperations operations, string resourceGroupName, string accountName, string privateAtlasName) + { + operations.DeleteAsync(resourceGroupName, accountName, privateAtlasName).GetAwaiter().GetResult(); + } + + /// + /// [Deprecated] Delete a Private Atlas resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Private Atlas instance. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IPrivateAtlasesOperations operations, string resourceGroupName, string accountName, string privateAtlasName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, accountName, privateAtlasName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// [Deprecated] Get a Private Atlas resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Private Atlas instance. + /// + public static PrivateAtlas Get(this IPrivateAtlasesOperations operations, string resourceGroupName, string accountName, string privateAtlasName) + { + return operations.GetAsync(resourceGroupName, accountName, privateAtlasName).GetAwaiter().GetResult(); + } + + /// + /// [Deprecated] Get a Private Atlas resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The name of the Private Atlas instance. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPrivateAtlasesOperations operations, string resourceGroupName, string accountName, string privateAtlasName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, accountName, privateAtlasName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// [Deprecated] Get all Private Atlas instances for an Azure Map Account + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + public static IEnumerable ListByAccount(this IPrivateAtlasesOperations operations, string resourceGroupName, string accountName) + { + return operations.ListByAccountAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); + } + + /// + /// [Deprecated] Get all Private Atlas instances for an Azure Map Account + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Maps Account. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByAccountAsync(this IPrivateAtlasesOperations operations, string resourceGroupName, string accountName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByAccountWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/SdkInfo_AzureMapsResourceProvider.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/SdkInfo_AzureMapsResourceProvider.cs index 613f28a64dfc..186382d0833f 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/SdkInfo_AzureMapsResourceProvider.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/SdkInfo_AzureMapsResourceProvider.cs @@ -19,21 +19,12 @@ public static IEnumerable> ApiInfo_AzureMapsResour { return new Tuple[] { - new Tuple("AzureMapsResourceProvider", "Accounts", "2018-05-01"), - new Tuple("Maps", "Accounts", "2018-05-01"), + new Tuple("Maps", "Accounts", "2020-02-01-preview"), + new Tuple("Maps", "Creators", "2020-02-01-preview"), + new Tuple("Maps", "Maps", "2020-02-01-preview"), + new Tuple("Maps", "PrivateAtlases", "2020-02-01-preview"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/maps/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\\code\\github\\az-sdk-net\\src\\SDKs"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "7119de004768fea8a3a2571e3e729d6e20d7264d"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -