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..efe4c4e90299 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/AccountsOperations.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/AccountsOperations.cs @@ -25,7 +25,7 @@ namespace Microsoft.Azure.Management.Maps /// /// AccountsOperations operations. /// - internal partial class AccountsOperations : IServiceOperations, IAccountsOperations + internal partial class AccountsOperations : IServiceOperations, IAccountsOperations { /// /// Initializes a new instance of the AccountsOperations class. @@ -36,7 +36,7 @@ internal partial class AccountsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal AccountsOperations(MapsManagementClient client) + internal AccountsOperations(AzureMapsManagementClient client) { if (client == null) { @@ -46,21 +46,21 @@ internal AccountsOperations(MapsManagementClient client) } /// - /// Gets a reference to the MapsManagementClient + /// Gets a reference to the AzureMapsManagementClient /// - public MapsManagementClient Client { get; private set; } + public AzureMapsManagementClient Client { get; private set; } /// /// Create or update a Maps Account. A Maps Account holds the keys 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. /// - /// + /// /// The new or updated parameters for the Maps Account. /// /// @@ -69,7 +69,7 @@ internal AccountsOperations(MapsManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -84,31 +84,56 @@ internal AccountsOperations(MapsManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, MapsAccountCreateParameters mapsAccountCreateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, MapsAccount mapsAccount, 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 (accountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); } - if (mapsAccountCreateParameters == null) + if (mapsAccount == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "mapsAccountCreateParameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "mapsAccount"); } - if (mapsAccountCreateParameters != null) + if (mapsAccount != null) { - mapsAccountCreateParameters.Validate(); + mapsAccount.Validate(); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -119,7 +144,7 @@ internal AccountsOperations(MapsManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("accountName", accountName); - tracingParameters.Add("mapsAccountCreateParameters", mapsAccountCreateParameters); + tracingParameters.Add("mapsAccount", mapsAccount); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -172,9 +197,9 @@ internal AccountsOperations(MapsManagementClient client) // Serialize Request string _requestContent = null; - if(mapsAccountCreateParameters != null) + if(mapsAccount != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(mapsAccountCreateParameters, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(mapsAccount, 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"); } @@ -200,11 +225,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; @@ -280,10 +305,10 @@ internal AccountsOperations(MapsManagementClient client) /// /// Updates a Maps Account. Only a subset of the parameters may be updated - /// after creation, such as Sku and Tags. + /// after creation, such as Sku, Tags, Properties. /// /// - /// 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 +322,7 @@ internal AccountsOperations(MapsManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -318,14 +343,39 @@ 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 (accountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); @@ -422,13 +472,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 +538,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 +549,7 @@ internal AccountsOperations(MapsManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -517,14 +567,39 @@ 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 (accountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); @@ -612,11 +687,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 +733,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 +744,7 @@ internal AccountsOperations(MapsManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -690,14 +765,39 @@ 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 (accountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); @@ -783,13 +883,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 +949,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 +957,7 @@ internal AccountsOperations(MapsManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -872,20 +972,45 @@ internal AccountsOperations(MapsManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -967,11 +1092,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; @@ -995,7 +1120,7 @@ internal AccountsOperations(MapsManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1036,7 +1161,7 @@ internal AccountsOperations(MapsManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1051,16 +1176,30 @@ internal AccountsOperations(MapsManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.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 +1279,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; @@ -1168,7 +1307,7 @@ internal AccountsOperations(MapsManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1201,13 +1340,24 @@ internal AccountsOperations(MapsManagementClient client) } /// - /// Moves Maps Accounts from one ResourceGroup (or Subscription) to another + /// Create and list an account shared access signature token. Use this SAS + /// token for authentication to Azure Maps REST APIs through various Azure Maps + /// SDKs. As prerequisite to create a SAS Token. + /// + /// Prerequisites: + /// 1. Create or have an existing User Assigned Managed Identity in the same + /// Azure region as the account. + /// 2. Create or update an Azure Map account with the same Azure region as the + /// User Assigned Managed Identity is placed. /// /// - /// 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. + /// + /// + /// The updated parameters for the Maps Account. /// /// /// Headers that will be added to request. @@ -1215,9 +1365,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,27 +1380,56 @@ 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> ListSasWithHttpMessagesAsync(string resourceGroupName, string accountName, AccountSasParameters mapsAccountSasParameters, 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 (moveRequest == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "moveRequest"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); } - if (moveRequest != null) + if (mapsAccountSasParameters == null) { - moveRequest.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "mapsAccountSasParameters"); + } + if (mapsAccountSasParameters != null) + { + mapsAccountSasParameters.Validate(); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1257,15 +1439,17 @@ internal AccountsOperations(MapsManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("moveRequest", moveRequest); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("mapsAccountSasParameters", mapsAccountSasParameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Move", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListSas", 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(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}/listSas").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) { @@ -1309,9 +1493,9 @@ internal AccountsOperations(MapsManagementClient client) // Serialize Request string _requestContent = null; - if(moveRequest != null) + if(mapsAccountSasParameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(moveRequest, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(mapsAccountSasParameters, 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"); } @@ -1337,11 +1521,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; @@ -1365,13 +1549,31 @@ internal AccountsOperations(MapsManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1385,7 +1587,7 @@ internal AccountsOperations(MapsManagementClient client) /// 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. @@ -1396,7 +1598,7 @@ internal AccountsOperations(MapsManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1417,14 +1619,39 @@ 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 (accountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); @@ -1510,13 +1737,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 +1804,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 +1818,7 @@ internal AccountsOperations(MapsManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1612,14 +1839,39 @@ 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 (accountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); @@ -1720,13 +1972,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; @@ -1783,15 +2035,18 @@ internal AccountsOperations(MapsManagementClient client) } /// - /// List operations available for the Maps Resource Provider + /// Get all Maps Accounts in a Resource Group /// + /// + /// The NextLink from the previous successful call to List operation. + /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1806,11 +2061,11 @@ internal AccountsOperations(MapsManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListOperationsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1819,17 +2074,182 @@ internal AccountsOperations(MapsManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListOperations", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Maps/operations").ToString(); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (_queryParameters.Count > 0) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get all Maps Accounts in a Subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -1890,11 +2310,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; @@ -1918,7 +2338,7 @@ internal AccountsOperations(MapsManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1931,7 +2351,7 @@ internal AccountsOperations(MapsManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { 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..16c7dec6edcf 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/AccountsOperationsExtensions.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/AccountsOperationsExtensions.cs @@ -13,8 +13,6 @@ 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; @@ -31,17 +29,17 @@ 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. /// - /// + /// /// The new or updated parameters for the Maps Account. /// - public static MapsAccount CreateOrUpdate(this IAccountsOperations operations, string resourceGroupName, string accountName, MapsAccountCreateParameters mapsAccountCreateParameters) + public static MapsAccount CreateOrUpdate(this IAccountsOperations operations, string resourceGroupName, string accountName, MapsAccount mapsAccount) { - return operations.CreateOrUpdateAsync(resourceGroupName, accountName, mapsAccountCreateParameters).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, accountName, mapsAccount).GetAwaiter().GetResult(); } /// @@ -52,20 +50,20 @@ 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. /// - /// + /// /// The new or updated parameters for the Maps Account. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IAccountsOperations operations, string resourceGroupName, string accountName, MapsAccountCreateParameters mapsAccountCreateParameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IAccountsOperations operations, string resourceGroupName, string accountName, MapsAccount mapsAccount, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, accountName, mapsAccountCreateParameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, accountName, mapsAccount, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -73,13 +71,13 @@ public static MapsAccount CreateOrUpdate(this IAccountsOperations operations, st /// /// Updates a Maps Account. Only a subset of the parameters may be updated - /// after creation, such as Sku and Tags. + /// after creation, such as Sku, Tags, Properties. /// /// /// 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. @@ -94,13 +92,13 @@ public static MapsAccount Update(this IAccountsOperations operations, string res /// /// Updates a Maps Account. Only a subset of the parameters may be updated - /// after creation, such as Sku and Tags. + /// after creation, such as Sku, Tags, Properties. /// /// /// 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 +124,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 +141,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 +161,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 +178,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,9 +201,9 @@ 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) + public static IPage ListByResourceGroup(this IAccountsOperations operations, string resourceGroupName) { return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); } @@ -217,12 +215,12 @@ 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. /// - public static async Task> ListByResourceGroupAsync(this IAccountsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupAsync(this IAccountsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { @@ -236,7 +234,7 @@ public static IEnumerable ListByResourceGroup(this IAccountsOperati /// /// The operations group for this extension method. /// - public static IEnumerable ListBySubscription(this IAccountsOperations operations) + public static IPage ListBySubscription(this IAccountsOperations operations) { return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); } @@ -250,7 +248,7 @@ public static IEnumerable ListBySubscription(this IAccountsOperatio /// /// The cancellation token. /// - public static async Task> ListBySubscriptionAsync(this IAccountsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListBySubscriptionAsync(this IAccountsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { @@ -259,40 +257,65 @@ public static IEnumerable ListBySubscription(this IAccountsOperatio } /// - /// Moves Maps Accounts from one ResourceGroup (or Subscription) to another + /// Create and list an account shared access signature token. Use this SAS + /// token for authentication to Azure Maps REST APIs through various Azure Maps + /// SDKs. As prerequisite to create a SAS Token. + /// + /// Prerequisites: + /// 1. Create or have an existing User Assigned Managed Identity in the same + /// Azure region as the account. + /// 2. Create or update an Azure Map account with the same Azure region as the + /// User Assigned Managed Identity is placed. /// /// /// The operations group for this extension method. /// /// - /// 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. + /// + /// + /// The updated parameters for the Maps Account. /// - public static void Move(this IAccountsOperations operations, string resourceGroupName, MapsAccountsMoveRequest moveRequest) + public static MapsAccountSasToken ListSas(this IAccountsOperations operations, string resourceGroupName, string accountName, AccountSasParameters mapsAccountSasParameters) { - operations.MoveAsync(resourceGroupName, moveRequest).GetAwaiter().GetResult(); + return operations.ListSasAsync(resourceGroupName, accountName, mapsAccountSasParameters).GetAwaiter().GetResult(); } /// - /// Moves Maps Accounts from one ResourceGroup (or Subscription) to another + /// Create and list an account shared access signature token. Use this SAS + /// token for authentication to Azure Maps REST APIs through various Azure Maps + /// SDKs. As prerequisite to create a SAS Token. + /// + /// Prerequisites: + /// 1. Create or have an existing User Assigned Managed Identity in the same + /// Azure region as the account. + /// 2. Create or update an Azure Map account with the same Azure region as the + /// User Assigned Managed Identity is placed. /// /// /// The operations group for this extension method. /// /// - /// 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. + /// + /// + /// The updated parameters for the Maps Account. /// /// /// The cancellation token. /// - public static async Task MoveAsync(this IAccountsOperations operations, string resourceGroupName, MapsAccountsMoveRequest moveRequest, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListSasAsync(this IAccountsOperations operations, string resourceGroupName, string accountName, AccountSasParameters mapsAccountSasParameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.MoveWithHttpMessagesAsync(resourceGroupName, moveRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.ListSasWithHttpMessagesAsync(resourceGroupName, accountName, mapsAccountSasParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// @@ -304,7 +327,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 +346,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 +370,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 +391,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. @@ -388,28 +411,68 @@ public static MapsAccountKeys RegenerateKeys(this IAccountsOperations operations } /// - /// List operations available for the Maps Resource Provider + /// Get all Maps Accounts in a Resource Group /// /// /// The operations group for this extension method. /// - public static IEnumerable ListOperations(this IAccountsOperations operations) + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IAccountsOperations operations, string nextPageLink) { - return operations.ListOperationsAsync().GetAwaiter().GetResult(); + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// List operations available for the Maps Resource Provider + /// Get all Maps Accounts in a Resource Group /// /// /// The operations group for this extension method. /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IAccountsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all Maps Accounts in a Subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IAccountsOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all Maps Accounts in a Subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// /// /// The cancellation token. /// - public static async Task> ListOperationsAsync(this IAccountsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListBySubscriptionNextAsync(this IAccountsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListOperationsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/MapsManagementClient.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/AzureMapsManagementClient.cs similarity index 77% rename from sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/MapsManagementClient.cs rename to sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/AzureMapsManagementClient.cs index 543db09da1a3..cb8ad7cdfe61 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/MapsManagementClient.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/AzureMapsManagementClient.cs @@ -22,9 +22,9 @@ namespace Microsoft.Azure.Management.Maps using System.Net.Http; /// - /// Resource Provider + /// Azure Maps /// - public partial class MapsManagementClient : ServiceClient, IMapsManagementClient, IAzureClient + public partial class AzureMapsManagementClient : ServiceClient, IAzureMapsManagementClient, IAzureClient { /// /// The base URI of the service. @@ -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; } @@ -82,31 +80,41 @@ public partial class MapsManagementClient : ServiceClient, public virtual IAccountsOperations Accounts { get; private set; } /// - /// Initializes a new instance of the MapsManagementClient class. + /// Gets the IMapsOperationsOperations. + /// + public virtual IMapsOperationsOperations Maps { get; private set; } + + /// + /// Gets the ICreatorsOperations. + /// + public virtual ICreatorsOperations Creators { get; private set; } + + /// + /// Initializes a new instance of the AzureMapsManagementClient class. /// /// /// HttpClient to be used /// /// - /// True: will dispose the provided httpClient on calling MapsManagementClient.Dispose(). False: will not dispose provided httpClient - protected MapsManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + /// True: will dispose the provided httpClient on calling AzureMapsManagementClient.Dispose(). False: will not dispose provided httpClient + protected AzureMapsManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) { Initialize(); } /// - /// Initializes a new instance of the MapsManagementClient class. + /// Initializes a new instance of the AzureMapsManagementClient class. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected MapsManagementClient(params DelegatingHandler[] handlers) : base(handlers) + protected AzureMapsManagementClient(params DelegatingHandler[] handlers) : base(handlers) { Initialize(); } /// - /// Initializes a new instance of the MapsManagementClient class. + /// Initializes a new instance of the AzureMapsManagementClient class. /// /// /// Optional. The http client handler used to handle http transport. @@ -114,13 +122,13 @@ protected MapsManagementClient(params DelegatingHandler[] handlers) : base(handl /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected MapsManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + protected AzureMapsManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { Initialize(); } /// - /// Initializes a new instance of the MapsManagementClient class. + /// Initializes a new instance of the AzureMapsManagementClient class. /// /// /// Optional. The base URI of the service. @@ -131,7 +139,7 @@ protected MapsManagementClient(HttpClientHandler rootHandler, params DelegatingH /// /// Thrown when a required parameter is null /// - protected MapsManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + protected AzureMapsManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -141,7 +149,7 @@ protected MapsManagementClient(System.Uri baseUri, params DelegatingHandler[] ha } /// - /// Initializes a new instance of the MapsManagementClient class. + /// Initializes a new instance of the AzureMapsManagementClient class. /// /// /// Optional. The base URI of the service. @@ -155,7 +163,7 @@ protected MapsManagementClient(System.Uri baseUri, params DelegatingHandler[] ha /// /// Thrown when a required parameter is null /// - protected MapsManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + protected AzureMapsManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -165,7 +173,7 @@ protected MapsManagementClient(System.Uri baseUri, HttpClientHandler rootHandler } /// - /// Initializes a new instance of the MapsManagementClient class. + /// Initializes a new instance of the AzureMapsManagementClient class. /// /// /// Required. Credentials needed for the client to connect to Azure. @@ -176,7 +184,7 @@ protected MapsManagementClient(System.Uri baseUri, HttpClientHandler rootHandler /// /// Thrown when a required parameter is null /// - public MapsManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + public AzureMapsManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) { @@ -190,7 +198,7 @@ public MapsManagementClient(ServiceClientCredentials credentials, params Delegat } /// - /// Initializes a new instance of the MapsManagementClient class. + /// Initializes a new instance of the AzureMapsManagementClient class. /// /// /// Required. Credentials needed for the client to connect to Azure. @@ -199,11 +207,11 @@ public MapsManagementClient(ServiceClientCredentials credentials, params Delegat /// HttpClient to be used /// /// - /// True: will dispose the provided httpClient on calling MapsManagementClient.Dispose(). False: will not dispose provided httpClient + /// True: will dispose the provided httpClient on calling AzureMapsManagementClient.Dispose(). False: will not dispose provided httpClient /// /// Thrown when a required parameter is null /// - public MapsManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + public AzureMapsManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) { if (credentials == null) { @@ -217,7 +225,7 @@ public MapsManagementClient(ServiceClientCredentials credentials, HttpClient htt } /// - /// Initializes a new instance of the MapsManagementClient class. + /// Initializes a new instance of the AzureMapsManagementClient class. /// /// /// Required. Credentials needed for the client to connect to Azure. @@ -231,7 +239,7 @@ public MapsManagementClient(ServiceClientCredentials credentials, HttpClient htt /// /// Thrown when a required parameter is null /// - public MapsManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + public AzureMapsManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) { @@ -245,7 +253,7 @@ public MapsManagementClient(ServiceClientCredentials credentials, HttpClientHand } /// - /// Initializes a new instance of the MapsManagementClient class. + /// Initializes a new instance of the AzureMapsManagementClient class. /// /// /// Optional. The base URI of the service. @@ -259,7 +267,7 @@ public MapsManagementClient(ServiceClientCredentials credentials, HttpClientHand /// /// Thrown when a required parameter is null /// - public MapsManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + public AzureMapsManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -278,7 +286,7 @@ public MapsManagementClient(System.Uri baseUri, ServiceClientCredentials credent } /// - /// Initializes a new instance of the MapsManagementClient class. + /// Initializes a new instance of the AzureMapsManagementClient class. /// /// /// Optional. The base URI of the service. @@ -295,7 +303,7 @@ public MapsManagementClient(System.Uri baseUri, ServiceClientCredentials credent /// /// Thrown when a required parameter is null /// - public MapsManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + public AzureMapsManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -323,8 +331,10 @@ public MapsManagementClient(System.Uri baseUri, ServiceClientCredentials credent private void Initialize() { Accounts = new AccountsOperations(this); + Maps = new MapsOperationsOperations(this); + Creators = new CreatorsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2018-05-01"; + ApiVersion = "2021-12-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; @@ -341,6 +351,7 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, @@ -354,6 +365,7 @@ private void Initialize() } }; CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } } 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..f50903522d97 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/CreatorsOperations.cs @@ -0,0 +1,1370 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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(AzureMapsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMapsManagementClient + /// + public AzureMapsManagementClient 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 (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, Creator creatorResource, 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 (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (creatorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "creatorName"); + } + if (creatorResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "creatorResource"); + } + if (creatorResource != null) + { + creatorResource.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("creatorResource", creatorResource); + 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(creatorResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(creatorResource, 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 (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 (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 (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; + } + + /// + /// Get all Creator instances for an Azure Maps Account + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/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..d3a519989ae5 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/CreatorsOperationsExtensions.cs @@ -0,0 +1,298 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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.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 IPage 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, Creator creatorResource) + { + return operations.CreateOrUpdateAsync(resourceGroupName, accountName, creatorName, creatorResource).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, Creator creatorResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, accountName, creatorName, creatorResource, 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; + } + } + + /// + /// Get all Creator instances for an Azure Maps Account + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByAccountNext(this ICreatorsOperations operations, string nextPageLink) + { + return operations.ListByAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all Creator instances for an Azure Maps Account + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByAccountNextAsync(this ICreatorsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByAccountNextWithHttpMessagesAsync(nextPageLink, 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..8db2c4a5da6f 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IAccountsOperations.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IAccountsOperations.cs @@ -28,12 +28,12 @@ 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. /// - /// + /// /// The new or updated parameters for the Maps Account. /// /// @@ -42,7 +42,7 @@ public partial interface IAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -51,13 +51,13 @@ public partial interface IAccountsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, MapsAccountCreateParameters mapsAccountCreateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, MapsAccount mapsAccount, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Updates a Maps Account. Only a subset of the parameters may be - /// updated after creation, such as Sku and Tags. + /// updated after creation, such as Sku, Tags, Properties. /// /// - /// 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 /// /// @@ -149,7 +149,7 @@ public partial interface IAccountsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get all Maps Accounts in a Subscription /// @@ -159,7 +159,7 @@ public partial interface IAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -168,16 +168,26 @@ public partial interface IAccountsOperations /// /// Thrown when a required parameter is null /// - Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Moves Maps Accounts from one ResourceGroup (or Subscription) to - /// another + /// Create and list an account shared access signature token. Use this + /// SAS token for authentication to Azure Maps REST APIs through + /// various Azure Maps SDKs. As prerequisite to create a SAS Token. + /// + /// Prerequisites: + /// 1. Create or have an existing User Assigned Managed Identity in the + /// same Azure region as the account. + /// 2. Create or update an Azure Map account with the same Azure region + /// as the User Assigned Managed Identity is placed. /// /// - /// 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. + /// + /// + /// The updated parameters for the Maps Account. /// /// /// The headers that will be added to request. @@ -185,13 +195,16 @@ public partial interface IAccountsOperations /// /// 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 MoveWithHttpMessagesAsync(string resourceGroupName, MapsAccountsMoveRequest moveRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListSasWithHttpMessagesAsync(string resourceGroupName, string accountName, AccountSasParameters mapsAccountSasParameters, 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 @@ -199,7 +212,7 @@ public partial interface IAccountsOperations /// 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 +223,7 @@ public partial interface IAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -225,7 +238,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 +252,7 @@ public partial interface IAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -250,15 +263,40 @@ public partial interface IAccountsOperations /// Task> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string accountName, MapsKeySpecification keySpecification, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// List operations available for the Maps Resource Provider + /// Get all Maps Accounts in a Resource Group /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all Maps Accounts in a Subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -267,6 +305,6 @@ public partial interface IAccountsOperations /// /// Thrown when a required parameter is null /// - Task>> ListOperationsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, 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/IAzureMapsManagementClient.cs similarity index 81% rename from sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IMapsManagementClient.cs rename to sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IAzureMapsManagementClient.cs index 2db6b8ce445d..92356fba4a2f 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IMapsManagementClient.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IAzureMapsManagementClient.cs @@ -16,9 +16,9 @@ namespace Microsoft.Azure.Management.Maps using Newtonsoft.Json; /// - /// Resource Provider + /// Azure Maps /// - public partial interface IMapsManagementClient : System.IDisposable + public partial interface IAzureMapsManagementClient : System.IDisposable { /// /// The base URI of the service. @@ -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,15 @@ public partial interface IMapsManagementClient : System.IDisposable /// IAccountsOperations Accounts { get; } + /// + /// Gets the IMapsOperationsOperations. + /// + IMapsOperationsOperations Maps { get; } + + /// + /// Gets the ICreatorsOperations. + /// + ICreatorsOperations Creators { get; } + } } 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..0313381221c5 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/ICreatorsOperations.cs @@ -0,0 +1,192 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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, Creator creatorResource, 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)); + /// + /// Get all Creator instances for an Azure Maps Account + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} 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..465aedf5ebf0 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/IMapsOperationsOperations.cs @@ -0,0 +1,109 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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)); + /// + /// 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>> ListSubscriptionOperationsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List operations available for the Maps Resource Provider + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListOperationsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List operations available for the Maps Resource Provider + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListSubscriptionOperationsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} 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..5d0ed78817fb --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/MapsOperationsOperations.cs @@ -0,0 +1,752 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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(AzureMapsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMapsManagementClient + /// + public AzureMapsManagementClient 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; + } + + /// + /// 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>> ListSubscriptionOperationsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListSubscriptionOperations", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Maps/operations").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List operations available for the Maps Resource Provider + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListOperationsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOperationsNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List operations available for the Maps Resource Provider + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListSubscriptionOperationsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListSubscriptionOperationsNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/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..84dbd8f8bb60 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/MapsOperationsOperationsExtensions.cs @@ -0,0 +1,149 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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.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 IPage 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; + } + } + + /// + /// List operations available for the Maps Resource Provider + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListSubscriptionOperations(this IMapsOperationsOperations operations) + { + return operations.ListSubscriptionOperationsAsync().GetAwaiter().GetResult(); + } + + /// + /// List operations available for the Maps Resource Provider + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListSubscriptionOperationsAsync(this IMapsOperationsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListSubscriptionOperationsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List operations available for the Maps Resource Provider + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListOperationsNext(this IMapsOperationsOperations operations, string nextPageLink) + { + return operations.ListOperationsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List operations available for the Maps Resource Provider + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOperationsNextAsync(this IMapsOperationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOperationsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List operations available for the Maps Resource Provider + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListSubscriptionOperationsNext(this IMapsOperationsOperations operations, string nextPageLink) + { + return operations.ListSubscriptionOperationsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List operations available for the Maps Resource Provider + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListSubscriptionOperationsNextAsync(this IMapsOperationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListSubscriptionOperationsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/AccountSasParameters.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/AccountSasParameters.cs new file mode 100644 index 000000000000..b4c446415d13 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/AccountSasParameters.cs @@ -0,0 +1,156 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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 an account Shared Access Signature (SAS) + /// token. The REST API access control is provided by Azure Maps Role Based + /// Access (RBAC) identity and access. + /// + public partial class AccountSasParameters + { + /// + /// Initializes a new instance of the AccountSasParameters class. + /// + public AccountSasParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccountSasParameters class. + /// + /// The Map account key to use for signing. + /// Possible values include: 'primaryKey', 'secondaryKey' + /// The principal Id also known as the object + /// Id of a User Assigned Managed Identity currently assigned to the + /// Map Account. To assign a Managed Identity of the account, use + /// operation Create or Update an assign a User Assigned Identity + /// resource Id. + /// Required parameter which represents + /// the desired maximum request per second to allowed for the given SAS + /// token. This does not guarantee perfect accuracy in measurements but + /// provides application safe guards of abuse with eventual + /// enforcement. + /// The date time offset of when the token validity + /// begins. For example "2017-05-24T10:42:03.1567373Z". + /// The date time offset of when the token + /// validity expires. For example + /// "2017-05-24T10:42:03.1567373Z" + /// Optional, allows control of which region + /// locations are permitted access to Azure Maps REST APIs with the SAS + /// token. Example: "eastus", "westus2". Omitting this parameter will + /// allow all region locations to be accessible. + public AccountSasParameters(string signingKey, string principalId, int maxRatePerSecond, string start, string expiry, IList regions = default(IList)) + { + SigningKey = signingKey; + PrincipalId = principalId; + Regions = regions; + MaxRatePerSecond = maxRatePerSecond; + Start = start; + Expiry = expiry; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Map account key to use for signing. Possible + /// values include: 'primaryKey', 'secondaryKey' + /// + [JsonProperty(PropertyName = "signingKey")] + public string SigningKey { get; set; } + + /// + /// Gets or sets the principal Id also known as the object Id of a User + /// Assigned Managed Identity currently assigned to the Map Account. To + /// assign a Managed Identity of the account, use operation Create or + /// Update an assign a User Assigned Identity resource Id. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets or sets optional, allows control of which region locations are + /// permitted access to Azure Maps REST APIs with the SAS token. + /// Example: "eastus", "westus2". Omitting this parameter will allow + /// all region locations to be accessible. + /// + [JsonProperty(PropertyName = "regions")] + public IList Regions { get; set; } + + /// + /// Gets or sets required parameter which represents the desired + /// maximum request per second to allowed for the given SAS token. This + /// does not guarantee perfect accuracy in measurements but provides + /// application safe guards of abuse with eventual enforcement. + /// + [JsonProperty(PropertyName = "maxRatePerSecond")] + public int MaxRatePerSecond { get; set; } + + /// + /// Gets or sets the date time offset of when the token validity + /// begins. For example "2017-05-24T10:42:03.1567373Z". + /// + [JsonProperty(PropertyName = "start")] + public string Start { get; set; } + + /// + /// Gets or sets the date time offset of when the token validity + /// expires. For example "2017-05-24T10:42:03.1567373Z" + /// + [JsonProperty(PropertyName = "expiry")] + public string Expiry { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SigningKey == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SigningKey"); + } + if (PrincipalId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrincipalId"); + } + if (Start == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Start"); + } + if (Expiry == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Expiry"); + } + if (MaxRatePerSecond > 500) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxRatePerSecond", 500); + } + if (MaxRatePerSecond <= 0) + { + throw new ValidationException(ValidationRules.ExclusiveMinimum, "MaxRatePerSecond", 0); + } + } + } +} 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/CorsRule.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CorsRule.cs new file mode 100644 index 000000000000..56b984d1f7fd --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CorsRule.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies a CORS rule for the Map Account. + /// + public partial class CorsRule + { + /// + /// Initializes a new instance of the CorsRule class. + /// + public CorsRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CorsRule class. + /// + /// Required if CorsRule element is + /// present. A list of origin domains that will be allowed via CORS, or + /// "*" to allow all domains + public CorsRule(IList allowedOrigins) + { + AllowedOrigins = allowedOrigins; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets required if CorsRule element is present. A list of + /// origin domains that will be allowed via CORS, or "*" to allow all + /// domains + /// + [JsonProperty(PropertyName = "allowedOrigins")] + public IList AllowedOrigins { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AllowedOrigins == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AllowedOrigins"); + } + } + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CorsRules.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CorsRules.cs new file mode 100644 index 000000000000..341d308eb5fe --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CorsRules.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Sets the CORS rules. You can include up to five CorsRule elements in + /// the request. + /// + public partial class CorsRules + { + /// + /// Initializes a new instance of the CorsRules class. + /// + public CorsRules() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CorsRules class. + /// + /// The list of CORS rules. You can + /// include up to five CorsRule elements in the request. + public CorsRules(IList corsRulesProperty = default(IList)) + { + CorsRulesProperty = corsRulesProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of CORS rules. You can include up to five + /// CorsRule elements in the request. + /// + [JsonProperty(PropertyName = "corsRules")] + public IList CorsRulesProperty { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CorsRulesProperty != null) + { + if (CorsRulesProperty.Count > 5) + { + throw new ValidationException(ValidationRules.MaxItems, "CorsRulesProperty", 5); + } + foreach (var element in CorsRulesProperty) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} 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..e1c49f2bfab5 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Creator.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An Azure resource which represents Maps Creator product and provides + /// ability to manage private location data. + /// + public partial class Creator : IResource + { + /// + /// Initializes a new instance of the Creator class. + /// + public Creator() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Creator class. + /// + /// The Creator resource properties. + /// The system meta data relating to this + /// resource. + public Creator(CreatorProperties properties, SystemData systemData = default(SystemData)) + { + Properties = properties; + SystemData = systemData; + 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; } + + /// + /// Gets the system meta data relating to this resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + if (Properties != null) + { + Properties.Validate(); + } + } + } +} 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..cdd85b0f788a --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatorProperties.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Microsoft.Rest; + 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 storage units to be allocated. + /// Integer values from 1 to 100, inclusive. + /// The state of the resource + /// provisioning, terminal states: Succeeded, Failed, Canceled + public CreatorProperties(int storageUnits, string provisioningState = default(string)) + { + ProvisioningState = provisioningState; + StorageUnits = storageUnits; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the state of the resource provisioning, terminal states: + /// Succeeded, Failed, Canceled + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the storage units to be allocated. Integer values from + /// 1 to 100, inclusive. + /// + [JsonProperty(PropertyName = "storageUnits")] + public int StorageUnits { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StorageUnits > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "StorageUnits", 100); + } + if (StorageUnits < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "StorageUnits", 1); + } + } + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountCreateParameters.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatorUpdateParameters.cs similarity index 57% rename from sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountCreateParameters.cs rename to sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatorUpdateParameters.cs index cbc61f973976..d27c4acb2cf9 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountCreateParameters.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/CreatorUpdateParameters.cs @@ -11,42 +11,44 @@ namespace Microsoft.Azure.Management.Maps.Models { using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; /// - /// Parameters used to create a new Maps Account. + /// Parameters used to update an existing Creator resource. /// - public partial class MapsAccountCreateParameters + [Rest.Serialization.JsonTransformation] + public partial class CreatorUpdateParameters { /// - /// Initializes a new instance of the MapsAccountCreateParameters - /// class. + /// Initializes a new instance of the CreatorUpdateParameters class. /// - public MapsAccountCreateParameters() + public CreatorUpdateParameters() { CustomInit(); } /// - /// Initializes a new instance of the MapsAccountCreateParameters - /// class. + /// Initializes a new instance of the CreatorUpdateParameters class. /// - /// The location of the resource. - /// The SKU of this account. + /// The storage units to be allocated. + /// Integer values from 1 to 100, inclusive. /// 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 MapsAccountCreateParameters(string location, Sku sku, IDictionary tags = default(IDictionary)) + /// The state of the resource + /// provisioning, terminal states: Succeeded, Failed, Canceled + public CreatorUpdateParameters(int storageUnits, IDictionary tags = default(IDictionary), string provisioningState = default(string)) { - Location = location; Tags = tags; - Sku = sku; + ProvisioningState = provisioningState; + StorageUnits = storageUnits; CustomInit(); } @@ -55,12 +57,6 @@ public MapsAccountCreateParameters() /// 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 @@ -72,10 +68,18 @@ public MapsAccountCreateParameters() public IDictionary Tags { get; set; } /// - /// Gets or sets the SKU of this account. + /// Gets the state of the resource provisioning, terminal states: + /// Succeeded, Failed, Canceled + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the storage units to be allocated. Integer values from + /// 1 to 100, inclusive. /// - [JsonProperty(PropertyName = "sku")] - public Sku Sku { get; set; } + [JsonProperty(PropertyName = "properties.storageUnits")] + public int StorageUnits { get; set; } /// /// Validate the object. @@ -85,17 +89,13 @@ public MapsAccountCreateParameters() /// public virtual void Validate() { - if (Location == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Location"); - } - if (Sku == null) + if (StorageUnits > 100) { - throw new ValidationException(ValidationRules.CannotBeNull, "Sku"); + throw new ValidationException(ValidationRules.InclusiveMaximum, "StorageUnits", 100); } - if (Sku != null) + if (StorageUnits < 1) { - Sku.Validate(); + throw new ValidationException(ValidationRules.InclusiveMinimum, "StorageUnits", 1); } } } diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Dimension.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Dimension.cs new file mode 100644 index 000000000000..7cb76197eda6 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Dimension.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Dimension of map account, for example API Category, Api Name, Result + /// Type, and Response Code. + /// + public partial class Dimension + { + /// + /// Initializes a new instance of the Dimension class. + /// + public Dimension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Dimension class. + /// + /// Display name of dimension. + /// Display name of dimension. + /// Internal name of the dimension. + /// Internal metric name of the + /// dimension. + /// Source Mdm Namespace of the + /// dimension. + /// Flag to indicate exporting to + /// Azure Monitor. + public Dimension(string name = default(string), string displayName = default(string), string internalName = default(string), string internalMetricName = default(string), string sourceMdmNamespace = default(string), bool? toBeExportedToShoebox = default(bool?)) + { + Name = name; + DisplayName = displayName; + InternalName = internalName; + InternalMetricName = internalMetricName; + SourceMdmNamespace = sourceMdmNamespace; + ToBeExportedToShoebox = toBeExportedToShoebox; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets display name of dimension. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets display name of dimension. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets internal name of the dimension. + /// + [JsonProperty(PropertyName = "internalName")] + public string InternalName { get; set; } + + /// + /// Gets or sets internal metric name of the dimension. + /// + [JsonProperty(PropertyName = "internalMetricName")] + public string InternalMetricName { get; set; } + + /// + /// Gets or sets source Mdm Namespace of the dimension. + /// + [JsonProperty(PropertyName = "sourceMdmNamespace")] + public string SourceMdmNamespace { get; set; } + + /// + /// Gets or sets flag to indicate exporting to Azure Monitor. + /// + [JsonProperty(PropertyName = "toBeExportedToShoebox")] + public bool? ToBeExportedToShoebox { 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/Kind.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Kind.cs new file mode 100644 index 000000000000..26c8d51f85ea --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Kind.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + + /// + /// Defines values for Kind. + /// + public static class Kind + { + public const string Gen1 = "Gen1"; + public const string Gen2 = "Gen2"; + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/LinkedResource.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/LinkedResource.cs new file mode 100644 index 000000000000..5d44171387c6 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/LinkedResource.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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.Linq; + + /// + /// Linked resource is reference to a resource deployed in an Azure + /// subscription, add the linked resource `uniqueName` value as an optional + /// parameter for operations on Azure Maps Geospatial REST APIs. + /// + public partial class LinkedResource + { + /// + /// Initializes a new instance of the LinkedResource class. + /// + public LinkedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LinkedResource class. + /// + /// A provided name which uniquely identifies + /// the linked resource. + /// ARM resource id in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/accounts/{storageName}'. + public LinkedResource(string uniqueName, string id) + { + UniqueName = uniqueName; + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a provided name which uniquely identifies the linked + /// resource. + /// + [JsonProperty(PropertyName = "uniqueName")] + public string UniqueName { get; set; } + + /// + /// Gets or sets ARM resource id in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/accounts/{storageName}'. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (UniqueName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "UniqueName"); + } + if (Id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + } + } + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ManagedServiceIdentity.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ManagedServiceIdentity.cs new file mode 100644 index 000000000000..358411c7a579 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ManagedServiceIdentity.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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; + + /// + /// Identity for the resource. + /// + public partial class ManagedServiceIdentity + { + /// + /// Initializes a new instance of the ManagedServiceIdentity class. + /// + public ManagedServiceIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedServiceIdentity class. + /// + /// The principal ID of resource + /// identity. + /// The tenant ID of resource. + /// The identity type. Possible values include: + /// 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', + /// 'None' + /// The list of user identities + /// associated with the resource. The user identity dictionary key + /// references will be ARM resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + public ManagedServiceIdentity(string principalId = default(string), string tenantId = default(string), ResourceIdentityType? type = default(ResourceIdentityType?), IDictionary userAssignedIdentities = default(IDictionary)) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + UserAssignedIdentities = userAssignedIdentities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal ID of resource identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the tenant ID of resource. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets the identity type. Possible values include: + /// 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', + /// 'None' + /// + [JsonProperty(PropertyName = "type")] + public ResourceIdentityType? Type { get; set; } + + /// + /// Gets or sets the list of user identities associated with the + /// resource. The user identity dictionary key references will be ARM + /// resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ManagedServiceIdentityUserAssignedIdentitiesValue.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ManagedServiceIdentityUserAssignedIdentitiesValue.cs new file mode 100644 index 000000000000..088bc938008a --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ManagedServiceIdentityUserAssignedIdentitiesValue.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class ManagedServiceIdentityUserAssignedIdentitiesValue + { + /// + /// Initializes a new instance of the + /// ManagedServiceIdentityUserAssignedIdentitiesValue class. + /// + public ManagedServiceIdentityUserAssignedIdentitiesValue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedServiceIdentityUserAssignedIdentitiesValue class. + /// + /// The principal id of user assigned + /// identity. + /// The client id of user assigned + /// identity. + public ManagedServiceIdentityUserAssignedIdentitiesValue(string principalId = default(string), string clientId = default(string)) + { + PrincipalId = principalId; + ClientId = clientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal id of user assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the client id of user assigned identity. + /// + [JsonProperty(PropertyName = "clientId")] + public string ClientId { get; private set; } + + } +} 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..570040719e7b 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 @@ -10,15 +10,15 @@ namespace Microsoft.Azure.Management.Maps.Models { + using Microsoft.Rest; + using Microsoft.Rest.Azure; using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// An Azure resource which represents access to a suite of Maps REST APIs. /// - public partial class MapsAccount : Resource + public partial class MapsAccount : IResource { /// /// Initializes a new instance of the MapsAccount class. @@ -31,25 +31,20 @@ 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 SKU of this account. + /// Get or Set Kind property. Possible values + /// include: 'Gen1', 'Gen2' + /// The system meta data relating to this + /// resource. + /// Sets the identity property for maps + /// account. /// 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(Sku sku, string kind = default(string), SystemData systemData = default(SystemData), ManagedServiceIdentity identity = default(ManagedServiceIdentity), MapsAccountProperties properties = default(MapsAccountProperties)) { - Location = location; - Tags = tags; Sku = sku; + Kind = kind; + SystemData = systemData; + Identity = identity; Properties = properties; CustomInit(); } @@ -60,45 +55,56 @@ public MapsAccount() partial void CustomInit(); /// - /// Gets the location of the resource. + /// Gets or sets the SKU of this account. /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; 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. + /// Gets or sets get or Set Kind property. Possible values include: + /// 'Gen1', 'Gen2' /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; private set; } + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } /// - /// Gets the SKU of this account. + /// Gets the system meta data relating to this resource. /// - [JsonProperty(PropertyName = "sku")] - public Sku Sku { get; private set; } + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Gets or sets sets the identity property for maps account. + /// + [JsonProperty(PropertyName = "identity")] + public ManagedServiceIdentity Identity { get; set; } /// - /// Gets the map account properties. + /// Gets or sets the map account properties. /// [JsonProperty(PropertyName = "properties")] - public MapsAccountProperties Properties { get; private set; } + public MapsAccountProperties Properties { get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { + if (Sku == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Sku"); + } if (Sku != null) { Sku.Validate(); } + if (Properties != null) + { + Properties.Validate(); + } } } } diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountKeys.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountKeys.cs index 98bfb86f2a0e..77ab2b370925 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountKeys.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountKeys.cs @@ -30,17 +30,20 @@ public MapsAccountKeys() /// /// Initializes a new instance of the MapsAccountKeys class. /// - /// The full Azure resource identifier of the Maps - /// Account. + /// The last updated date and time + /// of the primary key. /// The primary key for accessing the Maps /// REST APIs. /// The secondary key for accessing the Maps /// REST APIs. - public MapsAccountKeys(string id = default(string), string primaryKey = default(string), string secondaryKey = default(string)) + /// The last updated date and + /// time of the secondary key. + public MapsAccountKeys(string primaryKeyLastUpdated = default(string), string primaryKey = default(string), string secondaryKey = default(string), string secondaryKeyLastUpdated = default(string)) { - Id = id; + PrimaryKeyLastUpdated = primaryKeyLastUpdated; PrimaryKey = primaryKey; SecondaryKey = secondaryKey; + SecondaryKeyLastUpdated = secondaryKeyLastUpdated; CustomInit(); } @@ -50,10 +53,10 @@ public MapsAccountKeys() partial void CustomInit(); /// - /// Gets the full Azure resource identifier of the Maps Account. + /// Gets the last updated date and time of the primary key. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } + [JsonProperty(PropertyName = "primaryKeyLastUpdated")] + public string PrimaryKeyLastUpdated { get; private set; } /// /// Gets the primary key for accessing the Maps REST APIs. @@ -67,5 +70,11 @@ public MapsAccountKeys() [JsonProperty(PropertyName = "secondaryKey")] public string SecondaryKey { get; private set; } + /// + /// Gets the last updated date and time of the secondary key. + /// + [JsonProperty(PropertyName = "secondaryKeyLastUpdated")] + public string SecondaryKeyLastUpdated { get; private set; } + } } diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountProperties.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountProperties.cs index 22105aa865ad..98492d5b7858 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountProperties.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountProperties.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.Management.Maps.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -29,11 +31,28 @@ public MapsAccountProperties() /// /// Initializes a new instance of the MapsAccountProperties class. /// - /// A unique identifier for the maps + /// A unique identifier for the maps /// account - public MapsAccountProperties(string xMsClientId = default(string)) + /// Allows toggle functionality on Azure + /// Policy to disable Azure Maps local authentication support. This + /// will disable Shared Keys authentication from any usage. + /// The provisioning state of the Map + /// account resource. + /// Sets the resources to be used for + /// Managed Identities based operations for the Map account + /// resource. + /// Specifies CORS rules for the Blob service. You + /// can include up to five CorsRule elements in the request. If no + /// CorsRule elements are included in the request body, all CORS rules + /// will be deleted, and CORS will be disabled for the Blob + /// service. + public MapsAccountProperties(string uniqueId = default(string), bool? disableLocalAuth = default(bool?), string provisioningState = default(string), IList linkedResources = default(IList), CorsRules cors = default(CorsRules)) { - XMsClientId = xMsClientId; + UniqueId = uniqueId; + DisableLocalAuth = disableLocalAuth; + ProvisioningState = provisioningState; + LinkedResources = linkedResources; + Cors = cors; CustomInit(); } @@ -43,10 +62,63 @@ public MapsAccountProperties() partial void CustomInit(); /// - /// Gets or sets a unique identifier for the maps account + /// Gets a unique identifier for the maps account /// - [JsonProperty(PropertyName = "x-ms-client-id")] - public string XMsClientId { get; set; } + [JsonProperty(PropertyName = "uniqueId")] + public string UniqueId { get; private set; } + /// + /// Gets or sets allows toggle functionality on Azure Policy to disable + /// Azure Maps local authentication support. This will disable Shared + /// Keys authentication from any usage. + /// + [JsonProperty(PropertyName = "disableLocalAuth")] + public bool? DisableLocalAuth { get; set; } + + /// + /// Gets the provisioning state of the Map account resource. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets sets the resources to be used for Managed Identities + /// based operations for the Map account resource. + /// + [JsonProperty(PropertyName = "linkedResources")] + public IList LinkedResources { get; set; } + + /// + /// Gets or sets specifies CORS rules for the Blob service. You can + /// include up to five CorsRule elements in the request. If no CorsRule + /// elements are included in the request body, all CORS rules will be + /// deleted, and CORS will be disabled for the Blob service. + /// + [JsonProperty(PropertyName = "cors")] + public CorsRules Cors { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (LinkedResources != null) + { + foreach (var element in LinkedResources) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Cors != null) + { + Cors.Validate(); + } + } } } diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountSasToken.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountSasToken.cs new file mode 100644 index 000000000000..5e46d109c987 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountSasToken.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A new Sas token which can be used to access the Maps REST APIs and is + /// controlled by the specified Managed identity permissions on Azure (IAM) + /// Role Based Access Control. + /// + public partial class MapsAccountSasToken + { + /// + /// Initializes a new instance of the MapsAccountSasToken class. + /// + public MapsAccountSasToken() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MapsAccountSasToken class. + /// + /// The shared access signature access + /// token. + public MapsAccountSasToken(string accountSasToken = default(string)) + { + AccountSasToken = accountSasToken; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the shared access signature access token. + /// + [JsonProperty(PropertyName = "accountSasToken")] + public string AccountSasToken { get; private set; } + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountUpdateParameters.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountUpdateParameters.cs index ad0f8ea87528..390d129d4b3b 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountUpdateParameters.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsAccountUpdateParameters.cs @@ -10,6 +10,8 @@ namespace Microsoft.Azure.Management.Maps.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -18,6 +20,7 @@ namespace Microsoft.Azure.Management.Maps.Models /// /// Parameters used to update an existing Maps Account. /// + [Rest.Serialization.JsonTransformation] public partial class MapsAccountUpdateParameters { /// @@ -39,11 +42,37 @@ public MapsAccountUpdateParameters() /// 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. + /// Get or Set Kind property. Possible values + /// include: 'Gen1', 'Gen2' /// The SKU of this account. - public MapsAccountUpdateParameters(IDictionary tags = default(IDictionary), Sku sku = default(Sku)) + /// Sets the identity property for maps + /// account. + /// A unique identifier for the maps + /// account + /// Allows toggle functionality on Azure + /// Policy to disable Azure Maps local authentication support. This + /// will disable Shared Keys authentication from any usage. + /// The provisioning state of the Map + /// account resource. + /// Sets the resources to be used for + /// Managed Identities based operations for the Map account + /// resource. + /// Specifies CORS rules for the Blob service. You + /// can include up to five CorsRule elements in the request. If no + /// CorsRule elements are included in the request body, all CORS rules + /// will be deleted, and CORS will be disabled for the Blob + /// service. + public MapsAccountUpdateParameters(IDictionary tags = default(IDictionary), string kind = default(string), Sku sku = default(Sku), ManagedServiceIdentity identity = default(ManagedServiceIdentity), string uniqueId = default(string), bool? disableLocalAuth = default(bool?), string provisioningState = default(string), IList linkedResources = default(IList), CorsRules cors = default(CorsRules)) { Tags = tags; + Kind = kind; Sku = sku; + Identity = identity; + UniqueId = uniqueId; + DisableLocalAuth = disableLocalAuth; + ProvisioningState = provisioningState; + LinkedResources = linkedResources; + Cors = cors; CustomInit(); } @@ -62,16 +91,65 @@ public MapsAccountUpdateParameters() [JsonProperty(PropertyName = "tags")] public IDictionary Tags { get; set; } + /// + /// Gets or sets get or Set Kind property. Possible values include: + /// 'Gen1', 'Gen2' + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + /// /// Gets or sets the SKU of this account. /// [JsonProperty(PropertyName = "sku")] public Sku Sku { get; set; } + /// + /// Gets or sets sets the identity property for maps account. + /// + [JsonProperty(PropertyName = "identity")] + public ManagedServiceIdentity Identity { get; set; } + + /// + /// Gets a unique identifier for the maps account + /// + [JsonProperty(PropertyName = "properties.uniqueId")] + public string UniqueId { get; private set; } + + /// + /// Gets or sets allows toggle functionality on Azure Policy to disable + /// Azure Maps local authentication support. This will disable Shared + /// Keys authentication from any usage. + /// + [JsonProperty(PropertyName = "properties.disableLocalAuth")] + public bool? DisableLocalAuth { get; set; } + + /// + /// Gets the provisioning state of the Map account resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets sets the resources to be used for Managed Identities + /// based operations for the Map account resource. + /// + [JsonProperty(PropertyName = "properties.linkedResources")] + public IList LinkedResources { get; set; } + + /// + /// Gets or sets specifies CORS rules for the Blob service. You can + /// include up to five CorsRule elements in the request. If no CorsRule + /// elements are included in the request body, all CORS rules will be + /// deleted, and CORS will be disabled for the Blob service. + /// + [JsonProperty(PropertyName = "properties.cors")] + public CorsRules Cors { get; set; } + /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() @@ -80,6 +158,20 @@ public virtual void Validate() { Sku.Validate(); } + if (LinkedResources != null) + { + foreach (var element in LinkedResources) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Cors != null) + { + Cors.Validate(); + } } } } 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/MapsOperationsValueItem.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsOperationsValueItem.cs deleted file mode 100644 index c01dcd191d7a..000000000000 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsOperationsValueItem.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 MapsOperationsValueItem - { - /// - /// Initializes a new instance of the MapsOperationsValueItem class. - /// - public MapsOperationsValueItem() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MapsOperationsValueItem class. - /// - /// Operation name: - /// {provider}/{resource}/{operation}. - /// The human-readable description of the - /// operation. - /// The origin of the operation. - public MapsOperationsValueItem(string name = default(string), MapsOperationsValueItemDisplay display = default(MapsOperationsValueItemDisplay), string origin = default(string)) - { - Name = name; - Display = display; - Origin = origin; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets operation name: {provider}/{resource}/{operation}. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets or sets the human-readable description of the operation. - /// - [JsonProperty(PropertyName = "display")] - public MapsOperationsValueItemDisplay Display { get; set; } - - /// - /// Gets the origin of the operation. - /// - [JsonProperty(PropertyName = "origin")] - public string Origin { get; private set; } - - } -} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsOperationsValueItemDisplay.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsOperationsValueItemDisplay.cs deleted file mode 100644 index 077bdb26d503..000000000000 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MapsOperationsValueItemDisplay.cs +++ /dev/null @@ -1,80 +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; - - /// - /// The human-readable description of the operation. - /// - public partial class MapsOperationsValueItemDisplay - { - /// - /// Initializes a new instance of the MapsOperationsValueItemDisplay - /// class. - /// - public MapsOperationsValueItemDisplay() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MapsOperationsValueItemDisplay - /// class. - /// - /// Service provider: Microsoft Maps. - /// Resource on which the operation is - /// performed. - /// The action that users can perform, based on - /// their permission level. - /// The description of the operation. - public MapsOperationsValueItemDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) - { - Provider = provider; - Resource = resource; - Operation = operation; - Description = description; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets service provider: Microsoft Maps. - /// - [JsonProperty(PropertyName = "provider")] - public string Provider { get; private set; } - - /// - /// Gets resource on which the operation is performed. - /// - [JsonProperty(PropertyName = "resource")] - public string Resource { get; private set; } - - /// - /// Gets the action that users can perform, based on their permission - /// level. - /// - [JsonProperty(PropertyName = "operation")] - public string Operation { get; private set; } - - /// - /// Gets the description of the operation. - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - - } -} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MetricSpecification.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MetricSpecification.cs new file mode 100644 index 000000000000..4ec3e15b6598 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/MetricSpecification.cs @@ -0,0 +1,140 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Metric specification of operation. + /// + public partial class MetricSpecification + { + /// + /// Initializes a new instance of the MetricSpecification class. + /// + public MetricSpecification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricSpecification class. + /// + /// Name of metric specification. + /// Display name of metric + /// specification. + /// Display description of metric + /// specification. + /// Unit could be Count. + /// Dimensions of map account. + /// Aggregation type could be + /// Average. + /// The property to decide fill gap with + /// zero or not. + /// The category this metric specification + /// belong to, could be Capacity. + /// Account Resource + /// Id. + /// Source metrics account. + /// Internal metric name. + public MetricSpecification(string name = default(string), string displayName = default(string), string displayDescription = default(string), string unit = default(string), IList dimensions = default(IList), string aggregationType = default(string), bool? fillGapWithZero = default(bool?), string category = default(string), string resourceIdDimensionNameOverride = default(string), string sourceMdmAccount = default(string), string internalMetricName = default(string)) + { + Name = name; + DisplayName = displayName; + DisplayDescription = displayDescription; + Unit = unit; + Dimensions = dimensions; + AggregationType = aggregationType; + FillGapWithZero = fillGapWithZero; + Category = category; + ResourceIdDimensionNameOverride = resourceIdDimensionNameOverride; + SourceMdmAccount = sourceMdmAccount; + InternalMetricName = internalMetricName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of metric specification. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets display name of metric specification. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets display description of metric specification. + /// + [JsonProperty(PropertyName = "displayDescription")] + public string DisplayDescription { get; set; } + + /// + /// Gets or sets unit could be Count. + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; set; } + + /// + /// Gets or sets dimensions of map account. + /// + [JsonProperty(PropertyName = "dimensions")] + public IList Dimensions { get; set; } + + /// + /// Gets or sets aggregation type could be Average. + /// + [JsonProperty(PropertyName = "aggregationType")] + public string AggregationType { get; set; } + + /// + /// Gets or sets the property to decide fill gap with zero or not. + /// + [JsonProperty(PropertyName = "fillGapWithZero")] + public bool? FillGapWithZero { get; set; } + + /// + /// Gets or sets the category this metric specification belong to, + /// could be Capacity. + /// + [JsonProperty(PropertyName = "category")] + public string Category { get; set; } + + /// + /// Gets or sets account Resource Id. + /// + [JsonProperty(PropertyName = "resourceIdDimensionNameOverride")] + public string ResourceIdDimensionNameOverride { get; set; } + + /// + /// Gets or sets source metrics account. + /// + [JsonProperty(PropertyName = "sourceMdmAccount")] + public string SourceMdmAccount { get; set; } + + /// + /// Gets or sets internal metric name. + /// + [JsonProperty(PropertyName = "internalMetricName")] + public string InternalMetricName { get; set; } + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Name.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Name.cs new file mode 100644 index 000000000000..09c662515fa7 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Name.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + + /// + /// Defines values for Name. + /// + public static class Name + { + public const string S0 = "S0"; + public const string S1 = "S1"; + public const string G2 = "G2"; + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/OperationDetail.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/OperationDetail.cs new file mode 100644 index 000000000000..7e0e2ddbdf85 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/OperationDetail.cs @@ -0,0 +1,89 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Operation detail payload + /// + [Rest.Serialization.JsonTransformation] + public partial class OperationDetail + { + /// + /// Initializes a new instance of the OperationDetail class. + /// + public OperationDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDetail class. + /// + /// Name of the operation + /// Indicates whether the operation is a + /// data action + /// Display of the operation + /// Origin of the operation + /// One property of operation, + /// include metric specifications. + public OperationDetail(string name = default(string), bool? isDataAction = default(bool?), OperationDisplay display = default(OperationDisplay), string origin = default(string), ServiceSpecification serviceSpecification = default(ServiceSpecification)) + { + Name = name; + IsDataAction = isDataAction; + Display = display; + Origin = origin; + ServiceSpecification = serviceSpecification; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the operation + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets indicates whether the operation is a data action + /// + [JsonProperty(PropertyName = "isDataAction")] + public bool? IsDataAction { get; set; } + + /// + /// Gets or sets display of the operation + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + /// + /// Gets or sets origin of the operation + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; set; } + + /// + /// Gets or sets one property of operation, include metric + /// specifications. + /// + [JsonProperty(PropertyName = "properties.serviceSpecification")] + public ServiceSpecification ServiceSpecification { get; set; } + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/OperationDisplay.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..3fd702bf01a7 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Operation display payload + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + /// Resource provider of the operation + /// Resource of the operation + /// Localized friendly name for the + /// operation + /// Localized friendly description for the + /// operation + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource provider of the operation + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets resource of the operation + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets localized friendly name for the operation + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets localized friendly description for the operation + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Page.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Page.cs index d440eddd9375..032fa68652eb 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Page.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Page.cs @@ -26,7 +26,7 @@ public class Page : IPage /// /// Gets the link to the next page. /// - [JsonProperty("")] + [JsonProperty("nextLink")] public string NextPageLink { get; private set; } [JsonProperty("value")] 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/ResourceIdentityType.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ResourceIdentityType.cs new file mode 100644 index 000000000000..2e5c2a827659 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ResourceIdentityType.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ResourceIdentityType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ResourceIdentityType + { + [EnumMember(Value = "SystemAssigned")] + SystemAssigned, + [EnumMember(Value = "UserAssigned")] + UserAssigned, + [EnumMember(Value = "SystemAssigned, UserAssigned")] + SystemAssignedUserAssigned, + [EnumMember(Value = "None")] + None + } + internal static class ResourceIdentityTypeEnumExtension + { + internal static string ToSerializedValue(this ResourceIdentityType? value) + { + return value == null ? null : ((ResourceIdentityType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ResourceIdentityType value) + { + switch( value ) + { + case ResourceIdentityType.SystemAssigned: + return "SystemAssigned"; + case ResourceIdentityType.UserAssigned: + return "UserAssigned"; + case ResourceIdentityType.SystemAssignedUserAssigned: + return "SystemAssigned, UserAssigned"; + case ResourceIdentityType.None: + return "None"; + } + return null; + } + + internal static ResourceIdentityType? ParseResourceIdentityType(this string value) + { + switch( value ) + { + case "SystemAssigned": + return ResourceIdentityType.SystemAssigned; + case "UserAssigned": + return ResourceIdentityType.UserAssigned; + case "SystemAssigned, UserAssigned": + return ResourceIdentityType.SystemAssignedUserAssigned; + case "None": + return ResourceIdentityType.None; + } + return null; + } + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ServiceSpecification.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ServiceSpecification.cs new file mode 100644 index 000000000000..7990ee8411c6 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/ServiceSpecification.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// One property of operation, include metric specifications. + /// + public partial class ServiceSpecification + { + /// + /// Initializes a new instance of the ServiceSpecification class. + /// + public ServiceSpecification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceSpecification class. + /// + /// Metric specifications of + /// operation. + public ServiceSpecification(IList metricSpecifications = default(IList)) + { + MetricSpecifications = metricSpecifications; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets metric specifications of operation. + /// + [JsonProperty(PropertyName = "metricSpecifications")] + public IList MetricSpecifications { get; set; } + + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/SigningKey.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/SigningKey.cs new file mode 100644 index 000000000000..6809a93699c5 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/SigningKey.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Maps.Models +{ + + /// + /// Defines values for SigningKey. + /// + public static class SigningKey + { + public const string PrimaryKey = "primaryKey"; + public const string SecondaryKey = "secondaryKey"; + } +} diff --git a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Sku.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Sku.cs index e70a354d8940..361ded74b9ef 100644 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Sku.cs +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/Models/Sku.cs @@ -31,7 +31,7 @@ public Sku() /// Initializes a new instance of the Sku class. /// /// The name of the SKU, in standard format (such as - /// S0). + /// S0). Possible values include: 'S0', 'S1', 'G2' /// Gets the sku tier. This is based on the SKU /// name. public Sku(string name, string tier = default(string)) @@ -48,6 +48,7 @@ public Sku() /// /// Gets or sets the name of the SKU, in standard format (such as S0). + /// Possible values include: 'S0', 'S1', 'G2' /// [JsonProperty(PropertyName = "name")] public string Name { get; 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..76cf73acbbce --- /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 timestamp of resource last + /// modification (UTC) + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedBy = createdBy; + 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 timestamp of resource last modification (UTC) + /// + [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/SdkInfo_AzureMapsManagementClient.cs b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/SdkInfo_AzureMapsManagementClient.cs new file mode 100644 index 000000000000..c6fe6392c597 --- /dev/null +++ b/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/SdkInfo_AzureMapsManagementClient.cs @@ -0,0 +1,29 @@ + +// +// Code generated 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 System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_AzureMapsManagementClient + { + get + { + return new Tuple[] + { + new Tuple("Maps", "Accounts", "2021-12-01-preview"), + new Tuple("Maps", "Creators", "2021-12-01-preview"), + new Tuple("Maps", "Maps", "2021-12-01-preview"), + }.AsEnumerable(); + } + } + } +} 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 deleted file mode 100644 index 613f28a64dfc..000000000000 --- a/sdk/maps/Microsoft.Azure.Management.Maps/src/Generated/SdkInfo_AzureMapsResourceProvider.cs +++ /dev/null @@ -1,39 +0,0 @@ - -// -// Code generated 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 System; - using System.Collections.Generic; - using System.Linq; - - internal static partial class SdkInfo - { - public static IEnumerable> ApiInfo_AzureMapsResourceProvider - { - get - { - return new Tuple[] - { - new Tuple("AzureMapsResourceProvider", "Accounts", "2018-05-01"), - new Tuple("Maps", "Accounts", "2018-05-01"), - }.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 - } -} -