diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/CommunicationServiceManagementClient.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/CommunicationServiceManagementClient.cs
new file mode 100644
index 0000000000000..d4cbdd24b3349
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/CommunicationServiceManagementClient.cs
@@ -0,0 +1,366 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Microsoft.Rest.Serialization;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+
+ ///
+ /// REST API for Azure Communication Services
+ ///
+ public partial class CommunicationServiceManagementClient : ServiceClient, ICommunicationServiceManagementClient, IAzureClient
+ {
+ ///
+ /// The base URI of the service.
+ ///
+ public System.Uri BaseUri { get; set; }
+
+ ///
+ /// Gets or sets json serialization settings.
+ ///
+ public JsonSerializerSettings SerializationSettings { get; private set; }
+
+ ///
+ /// Gets or sets json deserialization settings.
+ ///
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
+
+ ///
+ /// Credentials needed for the client to connect to Azure.
+ ///
+ public ServiceClientCredentials Credentials { get; private set; }
+
+ ///
+ /// The ID of the target subscription.
+ ///
+ public string SubscriptionId { get; set; }
+
+ ///
+ /// The API version to use for this operation.
+ ///
+ public string ApiVersion { get; private set; }
+
+ ///
+ /// The preferred language for the response.
+ ///
+ public string AcceptLanguage { get; set; }
+
+ ///
+ /// The retry timeout in seconds for Long Running Operations. Default value is
+ /// 30.
+ ///
+ public int? LongRunningOperationRetryTimeout { get; set; }
+
+ ///
+ /// Whether a unique x-ms-client-request-id should be generated. When set to
+ /// true a unique x-ms-client-request-id value is generated and included in
+ /// each request. Default is true.
+ ///
+ public bool? GenerateClientRequestId { get; set; }
+
+ ///
+ /// Gets the IOperations.
+ ///
+ public virtual IOperations Operations { get; private set; }
+
+ ///
+ /// Gets the ICommunicationServiceOperations.
+ ///
+ public virtual ICommunicationServiceOperations CommunicationService { get; private set; }
+
+ ///
+ /// Initializes a new instance of the CommunicationServiceManagementClient class.
+ ///
+ ///
+ /// HttpClient to be used
+ ///
+ ///
+ /// True: will dispose the provided httpClient on calling CommunicationServiceManagementClient.Dispose(). False: will not dispose provided httpClient
+ protected CommunicationServiceManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient)
+ {
+ Initialize();
+ }
+
+ ///
+ /// Initializes a new instance of the CommunicationServiceManagementClient class.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ protected CommunicationServiceManagementClient(params DelegatingHandler[] handlers) : base(handlers)
+ {
+ Initialize();
+ }
+
+ ///
+ /// Initializes a new instance of the CommunicationServiceManagementClient class.
+ ///
+ ///
+ /// Optional. The http client handler used to handle http transport.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ protected CommunicationServiceManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers)
+ {
+ Initialize();
+ }
+
+ ///
+ /// Initializes a new instance of the CommunicationServiceManagementClient class.
+ ///
+ ///
+ /// Optional. The base URI of the service.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ protected CommunicationServiceManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers)
+ {
+ if (baseUri == null)
+ {
+ throw new System.ArgumentNullException("baseUri");
+ }
+ BaseUri = baseUri;
+ }
+
+ ///
+ /// Initializes a new instance of the CommunicationServiceManagementClient class.
+ ///
+ ///
+ /// Optional. The base URI of the service.
+ ///
+ ///
+ /// Optional. The http client handler used to handle http transport.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ protected CommunicationServiceManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ {
+ if (baseUri == null)
+ {
+ throw new System.ArgumentNullException("baseUri");
+ }
+ BaseUri = baseUri;
+ }
+
+ ///
+ /// Initializes a new instance of the CommunicationServiceManagementClient class.
+ ///
+ ///
+ /// Required. Credentials needed for the client to connect to Azure.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public CommunicationServiceManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
+ {
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ Credentials = credentials;
+ if (Credentials != null)
+ {
+ Credentials.InitializeServiceClient(this);
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the CommunicationServiceManagementClient class.
+ ///
+ ///
+ /// Required. Credentials needed for the client to connect to Azure.
+ ///
+ ///
+ /// HttpClient to be used
+ ///
+ ///
+ /// True: will dispose the provided httpClient on calling CommunicationServiceManagementClient.Dispose(). False: will not dispose provided httpClient
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public CommunicationServiceManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient)
+ {
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ Credentials = credentials;
+ if (Credentials != null)
+ {
+ Credentials.InitializeServiceClient(this);
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the CommunicationServiceManagementClient class.
+ ///
+ ///
+ /// Required. Credentials needed for the client to connect to Azure.
+ ///
+ ///
+ /// Optional. The http client handler used to handle http transport.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public CommunicationServiceManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ {
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ Credentials = credentials;
+ if (Credentials != null)
+ {
+ Credentials.InitializeServiceClient(this);
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the CommunicationServiceManagementClient class.
+ ///
+ ///
+ /// Optional. The base URI of the service.
+ ///
+ ///
+ /// Required. Credentials needed for the client to connect to Azure.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public CommunicationServiceManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
+ {
+ if (baseUri == null)
+ {
+ throw new System.ArgumentNullException("baseUri");
+ }
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ BaseUri = baseUri;
+ Credentials = credentials;
+ if (Credentials != null)
+ {
+ Credentials.InitializeServiceClient(this);
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the CommunicationServiceManagementClient class.
+ ///
+ ///
+ /// Optional. The base URI of the service.
+ ///
+ ///
+ /// Required. Credentials needed for the client to connect to Azure.
+ ///
+ ///
+ /// Optional. The http client handler used to handle http transport.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public CommunicationServiceManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ {
+ if (baseUri == null)
+ {
+ throw new System.ArgumentNullException("baseUri");
+ }
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ BaseUri = baseUri;
+ Credentials = credentials;
+ if (Credentials != null)
+ {
+ Credentials.InitializeServiceClient(this);
+ }
+ }
+
+ ///
+ /// An optional partial-method to perform custom initialization.
+ ///
+ partial void CustomInitialize();
+ ///
+ /// Initializes client properties.
+ ///
+ private void Initialize()
+ {
+ Operations = new Operations(this);
+ CommunicationService = new CommunicationServiceOperations(this);
+ BaseUri = new System.Uri("https://management.azure.com");
+ ApiVersion = "2020-08-20";
+ AcceptLanguage = "en-US";
+ LongRunningOperationRetryTimeout = 30;
+ GenerateClientRequestId = true;
+ SerializationSettings = new JsonSerializerSettings
+ {
+ Formatting = Newtonsoft.Json.Formatting.Indented,
+ DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
+ NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
+ ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ ContractResolver = new ReadOnlyJsonContractResolver(),
+ Converters = new List
+ {
+ new Iso8601TimeSpanConverter()
+ }
+ };
+ SerializationSettings.Converters.Add(new TransformationJsonConverter());
+ DeserializationSettings = new JsonSerializerSettings
+ {
+ DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
+ NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
+ ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ ContractResolver = new ReadOnlyJsonContractResolver(),
+ Converters = new List
+ {
+ new Iso8601TimeSpanConverter()
+ }
+ };
+ CustomInitialize();
+ DeserializationSettings.Converters.Add(new TransformationJsonConverter());
+ DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
+ }
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/CommunicationServiceOperations.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/CommunicationServiceOperations.cs
new file mode 100644
index 0000000000000..44ee399606e09
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/CommunicationServiceOperations.cs
@@ -0,0 +1,2428 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication
+{
+ 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;
+
+ ///
+ /// CommunicationServiceOperations operations.
+ ///
+ internal partial class CommunicationServiceOperations : IServiceOperations, ICommunicationServiceOperations
+ {
+ ///
+ /// Initializes a new instance of the CommunicationServiceOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal CommunicationServiceOperations(CommunicationServiceManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the CommunicationServiceManagementClient
+ ///
+ public CommunicationServiceManagementClient Client { get; private set; }
+
+ ///
+ /// Check Name Availability
+ ///
+ ///
+ /// Checks that the CommunicationService name is valid and is not already in
+ /// use.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> CheckNameAvailabilityWithHttpMessagesAsync(NameAvailabilityParameters nameAvailabilityParameters = default(NameAvailabilityParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nameAvailabilityParameters", nameAvailabilityParameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability").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("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(nameAvailabilityParameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(nameAvailabilityParameters, 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;
+ }
+
+ ///
+ /// Link Notification Hub
+ ///
+ ///
+ /// Links an Azure Notification Hub to this communication service.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> LinkNotificationHubWithHttpMessagesAsync(string resourceGroupName, string communicationServiceName, LinkNotificationHubParameters linkNotificationHubParameters = default(LinkNotificationHubParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (communicationServiceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "communicationServiceName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("linkNotificationHubParameters", linkNotificationHubParameters);
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("communicationServiceName", communicationServiceName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "LinkNotificationHub", 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.Communication/communicationServices/{communicationServiceName}/linkNotificationHub").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{communicationServiceName}", System.Uri.EscapeDataString(communicationServiceName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(linkNotificationHubParameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(linkNotificationHubParameters, 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;
+ }
+
+ ///
+ /// List By Subscription
+ ///
+ ///
+ /// Handles requests to list all resources in a subscription.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Communication/communicationServices").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 By Resource Group
+ ///
+ ///
+ /// Handles requests to list all resources in a resource group.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Update
+ ///
+ ///
+ /// Operation to update an existing CommunicationService.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// Parameters for the update 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string communicationServiceName, CommunicationServiceResource parameters = default(CommunicationServiceResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (communicationServiceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "communicationServiceName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("communicationServiceName", communicationServiceName);
+ 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.Communication/communicationServices/{communicationServiceName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{communicationServiceName}", System.Uri.EscapeDataString(communicationServiceName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PATCH");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new 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
+ ///
+ ///
+ /// Get the CommunicationService and its properties.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string communicationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (communicationServiceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "communicationServiceName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("communicationServiceName", communicationServiceName);
+ 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.Communication/communicationServices/{communicationServiceName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{communicationServiceName}", System.Uri.EscapeDataString(communicationServiceName));
+ 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
+ ///
+ ///
+ /// Create a new CommunicationService or update an existing
+ /// CommunicationService.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// Parameters for the create or update operation
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string communicationServiceName, CommunicationServiceResource parameters = default(CommunicationServiceResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send Request
+ AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, communicationServiceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Delete
+ ///
+ ///
+ /// Operation to delete a CommunicationService.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string communicationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, communicationServiceName, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// List Keys
+ ///
+ ///
+ /// Get the access keys of the CommunicationService resource.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService 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> ListKeysWithHttpMessagesAsync(string resourceGroupName, string communicationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (communicationServiceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "communicationServiceName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("communicationServiceName", communicationServiceName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListKeys", 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.Communication/communicationServices/{communicationServiceName}/listKeys").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{communicationServiceName}", System.Uri.EscapeDataString(communicationServiceName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Regenerate Key
+ ///
+ ///
+ /// Regenerate CommunicationService access key. PrimaryKey and SecondaryKey
+ /// cannot be regenerated at the same time.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// The keyType to regenerate. Must be either 'primary' or
+ /// 'secondary'(case-insensitive). Possible values include: 'Primary',
+ /// 'Secondary'
+ ///
+ ///
+ /// 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> RegenerateKeyWithHttpMessagesAsync(string resourceGroupName, string communicationServiceName, KeyType? keyType = default(KeyType?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (communicationServiceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "communicationServiceName");
+ }
+ RegenerateKeyParameters parameters = new RegenerateKeyParameters();
+ if (keyType != null)
+ {
+ parameters.KeyType = keyType;
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("communicationServiceName", communicationServiceName);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "RegenerateKey", 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.Communication/communicationServices/{communicationServiceName}/regenerateKey").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{communicationServiceName}", System.Uri.EscapeDataString(communicationServiceName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Create Or Update
+ ///
+ ///
+ /// Create a new CommunicationService or update an existing
+ /// CommunicationService.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// Parameters for the create or update 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string communicationServiceName, CommunicationServiceResource parameters = default(CommunicationServiceResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (communicationServiceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "communicationServiceName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("communicationServiceName", communicationServiceName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{communicationServiceName}", System.Uri.EscapeDataString(communicationServiceName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PUT");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 201)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 201)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ try
+ {
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Delete
+ ///
+ ///
+ /// Operation to delete a CommunicationService.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string communicationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (communicationServiceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "communicationServiceName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("communicationServiceName", communicationServiceName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{communicationServiceName}", System.Uri.EscapeDataString(communicationServiceName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("DELETE");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationHeaderResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ try
+ {
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// List By Subscription
+ ///
+ ///
+ /// Handles requests to list all resources 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);
+ }
+ // 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 By Resource Group
+ ///
+ ///
+ /// Handles requests to list all resources 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
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (nextPageLink == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextPageLink", nextPageLink);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters);
+ }
+ // Construct URL
+ string _url = "{nextLink}";
+ _url = _url.Replace("{nextLink}", nextPageLink);
+ List _queryParameters = new List();
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/CommunicationServiceOperationsExtensions.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/CommunicationServiceOperationsExtensions.cs
new file mode 100644
index 0000000000000..c71e66a90dc44
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/CommunicationServiceOperationsExtensions.cs
@@ -0,0 +1,675 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for CommunicationServiceOperations.
+ ///
+ public static partial class CommunicationServiceOperationsExtensions
+ {
+ ///
+ /// Check Name Availability
+ ///
+ ///
+ /// Checks that the CommunicationService name is valid and is not already in
+ /// use.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ public static NameAvailability CheckNameAvailability(this ICommunicationServiceOperations operations, NameAvailabilityParameters nameAvailabilityParameters = default(NameAvailabilityParameters))
+ {
+ return operations.CheckNameAvailabilityAsync(nameAvailabilityParameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Check Name Availability
+ ///
+ ///
+ /// Checks that the CommunicationService name is valid and is not already in
+ /// use.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CheckNameAvailabilityAsync(this ICommunicationServiceOperations operations, NameAvailabilityParameters nameAvailabilityParameters = default(NameAvailabilityParameters), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(nameAvailabilityParameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Link Notification Hub
+ ///
+ ///
+ /// Links an Azure Notification Hub to this communication service.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ public static LinkedNotificationHub LinkNotificationHub(this ICommunicationServiceOperations operations, string resourceGroupName, string communicationServiceName, LinkNotificationHubParameters linkNotificationHubParameters = default(LinkNotificationHubParameters))
+ {
+ return operations.LinkNotificationHubAsync(resourceGroupName, communicationServiceName, linkNotificationHubParameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Link Notification Hub
+ ///
+ ///
+ /// Links an Azure Notification Hub to this communication service.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task LinkNotificationHubAsync(this ICommunicationServiceOperations operations, string resourceGroupName, string communicationServiceName, LinkNotificationHubParameters linkNotificationHubParameters = default(LinkNotificationHubParameters), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.LinkNotificationHubWithHttpMessagesAsync(resourceGroupName, communicationServiceName, linkNotificationHubParameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// List By Subscription
+ ///
+ ///
+ /// Handles requests to list all resources in a subscription.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ public static IPage ListBySubscription(this ICommunicationServiceOperations operations)
+ {
+ return operations.ListBySubscriptionAsync().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// List By Subscription
+ ///
+ ///
+ /// Handles requests to list all resources in a subscription.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListBySubscriptionAsync(this ICommunicationServiceOperations operations, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// List By Resource Group
+ ///
+ ///
+ /// Handles requests to list all resources in a resource group.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ public static IPage ListByResourceGroup(this ICommunicationServiceOperations operations, string resourceGroupName)
+ {
+ return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// List By Resource Group
+ ///
+ ///
+ /// Handles requests to list all resources in a resource group.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListByResourceGroupAsync(this ICommunicationServiceOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Update
+ ///
+ ///
+ /// Operation to update an existing CommunicationService.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// Parameters for the update operation
+ ///
+ public static CommunicationServiceResource Update(this ICommunicationServiceOperations operations, string resourceGroupName, string communicationServiceName, CommunicationServiceResource parameters = default(CommunicationServiceResource))
+ {
+ return operations.UpdateAsync(resourceGroupName, communicationServiceName, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Update
+ ///
+ ///
+ /// Operation to update an existing CommunicationService.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// Parameters for the update operation
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task UpdateAsync(this ICommunicationServiceOperations operations, string resourceGroupName, string communicationServiceName, CommunicationServiceResource parameters = default(CommunicationServiceResource), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, communicationServiceName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Get
+ ///
+ ///
+ /// Get the CommunicationService and its properties.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ public static CommunicationServiceResource Get(this ICommunicationServiceOperations operations, string resourceGroupName, string communicationServiceName)
+ {
+ return operations.GetAsync(resourceGroupName, communicationServiceName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get
+ ///
+ ///
+ /// Get the CommunicationService and its properties.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAsync(this ICommunicationServiceOperations operations, string resourceGroupName, string communicationServiceName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, communicationServiceName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Create Or Update
+ ///
+ ///
+ /// Create a new CommunicationService or update an existing
+ /// CommunicationService.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// Parameters for the create or update operation
+ ///
+ public static CommunicationServiceResource CreateOrUpdate(this ICommunicationServiceOperations operations, string resourceGroupName, string communicationServiceName, CommunicationServiceResource parameters = default(CommunicationServiceResource))
+ {
+ return operations.CreateOrUpdateAsync(resourceGroupName, communicationServiceName, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Create Or Update
+ ///
+ ///
+ /// Create a new CommunicationService or update an existing
+ /// CommunicationService.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// Parameters for the create or update operation
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateOrUpdateAsync(this ICommunicationServiceOperations operations, string resourceGroupName, string communicationServiceName, CommunicationServiceResource parameters = default(CommunicationServiceResource), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, communicationServiceName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Delete
+ ///
+ ///
+ /// Operation to delete a CommunicationService.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ public static CommunicationServiceDeleteHeaders Delete(this ICommunicationServiceOperations operations, string resourceGroupName, string communicationServiceName)
+ {
+ return operations.DeleteAsync(resourceGroupName, communicationServiceName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Delete
+ ///
+ ///
+ /// Operation to delete a CommunicationService.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task DeleteAsync(this ICommunicationServiceOperations operations, string resourceGroupName, string communicationServiceName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, communicationServiceName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Headers;
+ }
+ }
+
+ ///
+ /// List Keys
+ ///
+ ///
+ /// Get the access keys of the CommunicationService resource.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ public static CommunicationServiceKeys ListKeys(this ICommunicationServiceOperations operations, string resourceGroupName, string communicationServiceName)
+ {
+ return operations.ListKeysAsync(resourceGroupName, communicationServiceName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// List Keys
+ ///
+ ///
+ /// Get the access keys of the CommunicationService resource.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListKeysAsync(this ICommunicationServiceOperations operations, string resourceGroupName, string communicationServiceName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListKeysWithHttpMessagesAsync(resourceGroupName, communicationServiceName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Regenerate Key
+ ///
+ ///
+ /// Regenerate CommunicationService access key. PrimaryKey and SecondaryKey
+ /// cannot be regenerated at the same time.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// The keyType to regenerate. Must be either 'primary' or
+ /// 'secondary'(case-insensitive). Possible values include: 'Primary',
+ /// 'Secondary'
+ ///
+ public static CommunicationServiceKeys RegenerateKey(this ICommunicationServiceOperations operations, string resourceGroupName, string communicationServiceName, KeyType? keyType = default(KeyType?))
+ {
+ return operations.RegenerateKeyAsync(resourceGroupName, communicationServiceName, keyType).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Regenerate Key
+ ///
+ ///
+ /// Regenerate CommunicationService access key. PrimaryKey and SecondaryKey
+ /// cannot be regenerated at the same time.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// The keyType to regenerate. Must be either 'primary' or
+ /// 'secondary'(case-insensitive). Possible values include: 'Primary',
+ /// 'Secondary'
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task RegenerateKeyAsync(this ICommunicationServiceOperations operations, string resourceGroupName, string communicationServiceName, KeyType? keyType = default(KeyType?), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.RegenerateKeyWithHttpMessagesAsync(resourceGroupName, communicationServiceName, keyType, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Create Or Update
+ ///
+ ///
+ /// Create a new CommunicationService or update an existing
+ /// CommunicationService.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// Parameters for the create or update operation
+ ///
+ public static CommunicationServiceResource BeginCreateOrUpdate(this ICommunicationServiceOperations operations, string resourceGroupName, string communicationServiceName, CommunicationServiceResource parameters = default(CommunicationServiceResource))
+ {
+ return operations.BeginCreateOrUpdateAsync(resourceGroupName, communicationServiceName, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Create Or Update
+ ///
+ ///
+ /// Create a new CommunicationService or update an existing
+ /// CommunicationService.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// Parameters for the create or update operation
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task BeginCreateOrUpdateAsync(this ICommunicationServiceOperations operations, string resourceGroupName, string communicationServiceName, CommunicationServiceResource parameters = default(CommunicationServiceResource), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, communicationServiceName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Delete
+ ///
+ ///
+ /// Operation to delete a CommunicationService.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ public static CommunicationServiceDeleteHeaders BeginDelete(this ICommunicationServiceOperations operations, string resourceGroupName, string communicationServiceName)
+ {
+ return operations.BeginDeleteAsync(resourceGroupName, communicationServiceName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Delete
+ ///
+ ///
+ /// Operation to delete a CommunicationService.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task BeginDeleteAsync(this ICommunicationServiceOperations operations, string resourceGroupName, string communicationServiceName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, communicationServiceName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Headers;
+ }
+ }
+
+ ///
+ /// List By Subscription
+ ///
+ ///
+ /// Handles requests to list all resources 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 ICommunicationServiceOperations operations, string nextPageLink)
+ {
+ return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// List By Subscription
+ ///
+ ///
+ /// Handles requests to list all resources 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> ListBySubscriptionNextAsync(this ICommunicationServiceOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// List By Resource Group
+ ///
+ ///
+ /// Handles requests to list all resources in a resource group.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static IPage ListByResourceGroupNext(this ICommunicationServiceOperations operations, string nextPageLink)
+ {
+ return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// List By Resource Group
+ ///
+ ///
+ /// Handles requests to list all resources 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 ICommunicationServiceOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/ICommunicationServiceManagementClient.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/ICommunicationServiceManagementClient.cs
new file mode 100644
index 0000000000000..57b25b8ef7174
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/ICommunicationServiceManagementClient.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.Communication
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+
+ ///
+ /// REST API for Azure Communication Services
+ ///
+ public partial interface ICommunicationServiceManagementClient : System.IDisposable
+ {
+ ///
+ /// The base URI of the service.
+ ///
+ System.Uri BaseUri { get; set; }
+
+ ///
+ /// Gets or sets json serialization settings.
+ ///
+ JsonSerializerSettings SerializationSettings { get; }
+
+ ///
+ /// Gets or sets json deserialization settings.
+ ///
+ JsonSerializerSettings DeserializationSettings { get; }
+
+ ///
+ /// Credentials needed for the client to connect to Azure.
+ ///
+ ServiceClientCredentials Credentials { get; }
+
+ ///
+ /// The ID of the target subscription.
+ ///
+ string SubscriptionId { get; set; }
+
+ ///
+ /// The API version to use for this operation.
+ ///
+ string ApiVersion { get; }
+
+ ///
+ /// The preferred language for the response.
+ ///
+ string AcceptLanguage { get; set; }
+
+ ///
+ /// The retry timeout in seconds for Long Running Operations. Default
+ /// value is 30.
+ ///
+ int? LongRunningOperationRetryTimeout { get; set; }
+
+ ///
+ /// Whether a unique x-ms-client-request-id should be generated. When
+ /// set to true a unique x-ms-client-request-id value is generated and
+ /// included in each request. Default is true.
+ ///
+ bool? GenerateClientRequestId { get; set; }
+
+
+ ///
+ /// Gets the IOperations.
+ ///
+ IOperations Operations { get; }
+
+ ///
+ /// Gets the ICommunicationServiceOperations.
+ ///
+ ICommunicationServiceOperations CommunicationService { get; }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/ICommunicationServiceOperations.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/ICommunicationServiceOperations.cs
new file mode 100644
index 0000000000000..8385ee98a46c5
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/ICommunicationServiceOperations.cs
@@ -0,0 +1,416 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// CommunicationServiceOperations operations.
+ ///
+ public partial interface ICommunicationServiceOperations
+ {
+ ///
+ /// Check Name Availability
+ ///
+ ///
+ /// Checks that the CommunicationService name is valid and is not
+ /// already in use.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> CheckNameAvailabilityWithHttpMessagesAsync(NameAvailabilityParameters nameAvailabilityParameters = default(NameAvailabilityParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Link Notification Hub
+ ///
+ ///
+ /// Links an Azure Notification Hub to this communication service.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// Parameters supplied to the operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> LinkNotificationHubWithHttpMessagesAsync(string resourceGroupName, string communicationServiceName, LinkNotificationHubParameters linkNotificationHubParameters = default(LinkNotificationHubParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// List By Subscription
+ ///
+ ///
+ /// Handles requests to list all resources in a subscription.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// List By Resource Group
+ ///
+ ///
+ /// Handles requests to list all resources in a resource group.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Update
+ ///
+ ///
+ /// Operation to update an existing CommunicationService.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// Parameters for the update 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string communicationServiceName, CommunicationServiceResource parameters = default(CommunicationServiceResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Get
+ ///
+ ///
+ /// Get the CommunicationService and its properties.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetWithHttpMessagesAsync(string resourceGroupName, string communicationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Create Or Update
+ ///
+ ///
+ /// Create a new CommunicationService or update an existing
+ /// CommunicationService.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// Parameters for the create or update 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string communicationServiceName, CommunicationServiceResource parameters = default(CommunicationServiceResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Delete
+ ///
+ ///
+ /// Operation to delete a CommunicationService.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string communicationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// List Keys
+ ///
+ ///
+ /// Get the access keys of the CommunicationService resource.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService 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> ListKeysWithHttpMessagesAsync(string resourceGroupName, string communicationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Regenerate Key
+ ///
+ ///
+ /// Regenerate CommunicationService access key. PrimaryKey and
+ /// SecondaryKey cannot be regenerated at the same time.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// The keyType to regenerate. Must be either 'primary' or
+ /// 'secondary'(case-insensitive). Possible values include: 'Primary',
+ /// 'Secondary'
+ ///
+ ///
+ /// 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> RegenerateKeyWithHttpMessagesAsync(string resourceGroupName, string communicationServiceName, KeyType? keyType = default(KeyType?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Create Or Update
+ ///
+ ///
+ /// Create a new CommunicationService or update an existing
+ /// CommunicationService.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// Parameters for the create or update 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string communicationServiceName, CommunicationServiceResource parameters = default(CommunicationServiceResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Delete
+ ///
+ ///
+ /// Operation to delete a CommunicationService.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the CommunicationService resource.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string communicationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// List By Subscription
+ ///
+ ///
+ /// Handles requests to list all resources 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
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// List By Resource Group
+ ///
+ ///
+ /// Handles requests to list all resources 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));
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/IOperations.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/IOperations.cs
new file mode 100644
index 0000000000000..5b3aa896edf54
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/IOperations.cs
@@ -0,0 +1,76 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Operations operations.
+ ///
+ public partial interface IOperations
+ {
+ ///
+ /// List Operations
+ ///
+ ///
+ /// Lists all of the available REST API operations of the
+ /// Microsoft.Communication 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>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// List Operations
+ ///
+ ///
+ /// Lists all of the available REST API operations of the
+ /// Microsoft.Communication 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/ActionType.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/ActionType.cs
new file mode 100644
index 0000000000000..a6319ba4a7129
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/ActionType.cs
@@ -0,0 +1,21 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication.Models
+{
+
+ ///
+ /// Defines values for ActionType.
+ ///
+ public static class ActionType
+ {
+ public const string Internal = "Internal";
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/AzureEntityResource.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/AzureEntityResource.cs
new file mode 100644
index 0000000000000..76f19c0e16013
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/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.Communication.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/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/CommunicationServiceCreateOrUpdateHeaders.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/CommunicationServiceCreateOrUpdateHeaders.cs
new file mode 100644
index 0000000000000..04f1c11d8588a
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/CommunicationServiceCreateOrUpdateHeaders.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.Communication.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Defines headers for CreateOrUpdate operation.
+ ///
+ public partial class CommunicationServiceCreateOrUpdateHeaders
+ {
+ ///
+ /// Initializes a new instance of the
+ /// CommunicationServiceCreateOrUpdateHeaders class.
+ ///
+ public CommunicationServiceCreateOrUpdateHeaders()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the
+ /// CommunicationServiceCreateOrUpdateHeaders class.
+ ///
+ /// URL to query for status of the
+ /// operation.
+ public CommunicationServiceCreateOrUpdateHeaders(string azureAsyncOperation = default(string))
+ {
+ AzureAsyncOperation = azureAsyncOperation;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets URL to query for status of the operation.
+ ///
+ [JsonProperty(PropertyName = "Azure-AsyncOperation")]
+ public string AzureAsyncOperation { get; set; }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/CommunicationServiceDeleteHeaders.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/CommunicationServiceDeleteHeaders.cs
new file mode 100644
index 0000000000000..dce92178ad888
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/CommunicationServiceDeleteHeaders.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.Communication.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Defines headers for Delete operation.
+ ///
+ public partial class CommunicationServiceDeleteHeaders
+ {
+ ///
+ /// Initializes a new instance of the CommunicationServiceDeleteHeaders
+ /// class.
+ ///
+ public CommunicationServiceDeleteHeaders()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the CommunicationServiceDeleteHeaders
+ /// class.
+ ///
+ /// URL to query for status of the
+ /// operation.
+ public CommunicationServiceDeleteHeaders(string location = default(string))
+ {
+ Location = location;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets URL to query for status of the operation.
+ ///
+ [JsonProperty(PropertyName = "location")]
+ public string Location { get; set; }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/CommunicationServiceKeys.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/CommunicationServiceKeys.cs
new file mode 100644
index 0000000000000..a683d68fa2edc
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/CommunicationServiceKeys.cs
@@ -0,0 +1,79 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// A class representing the access keys of a CommunicationService.
+ ///
+ public partial class CommunicationServiceKeys
+ {
+ ///
+ /// Initializes a new instance of the CommunicationServiceKeys class.
+ ///
+ public CommunicationServiceKeys()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the CommunicationServiceKeys class.
+ ///
+ /// The primary access key.
+ /// The secondary access key.
+ /// CommunicationService
+ /// connection string constructed via the primaryKey
+ /// CommunicationService
+ /// connection string constructed via the secondaryKey
+ public CommunicationServiceKeys(string primaryKey = default(string), string secondaryKey = default(string), string primaryConnectionString = default(string), string secondaryConnectionString = default(string))
+ {
+ PrimaryKey = primaryKey;
+ SecondaryKey = secondaryKey;
+ PrimaryConnectionString = primaryConnectionString;
+ SecondaryConnectionString = secondaryConnectionString;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the primary access key.
+ ///
+ [JsonProperty(PropertyName = "primaryKey")]
+ public string PrimaryKey { get; set; }
+
+ ///
+ /// Gets or sets the secondary access key.
+ ///
+ [JsonProperty(PropertyName = "secondaryKey")]
+ public string SecondaryKey { get; set; }
+
+ ///
+ /// Gets or sets communicationService connection string constructed via
+ /// the primaryKey
+ ///
+ [JsonProperty(PropertyName = "primaryConnectionString")]
+ public string PrimaryConnectionString { get; set; }
+
+ ///
+ /// Gets or sets communicationService connection string constructed via
+ /// the secondaryKey
+ ///
+ [JsonProperty(PropertyName = "secondaryConnectionString")]
+ public string SecondaryConnectionString { get; set; }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/CommunicationServiceResource.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/CommunicationServiceResource.cs
new file mode 100644
index 0000000000000..62a7d5d08eb1c
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/CommunicationServiceResource.cs
@@ -0,0 +1,168 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication.Models
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// A class representing a CommunicationService resource.
+ ///
+ [Rest.Serialization.JsonTransformation]
+ public partial class CommunicationServiceResource
+ {
+ ///
+ /// Initializes a new instance of the CommunicationServiceResource
+ /// class.
+ ///
+ public CommunicationServiceResource()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the CommunicationServiceResource
+ /// class.
+ ///
+ /// The location where the communication
+ /// service stores its data at rest.
+ /// 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"
+ /// The Azure location where the
+ /// CommunicationService is running.
+ /// Tags of the service which is a list of key value
+ /// pairs that describe the resource.
+ /// Provisioning state of the resource.
+ /// Possible values include: 'Unknown', 'Succeeded', 'Failed',
+ /// 'Canceled', 'Running', 'Creating', 'Updating', 'Deleting',
+ /// 'Moving'
+ /// FQDN of the CommunicationService
+ /// instance.
+ /// Resource ID of an Azure
+ /// Notification Hub linked to this resource.
+ /// Version of the CommunicationService resource.
+ /// Probably you need the same or higher version of client
+ /// SDKs.
+ /// The immutable resource Id of the
+ /// communication service.
+ public CommunicationServiceResource(string dataLocation, string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), string hostName = default(string), string notificationHubId = default(string), string version = default(string), string immutableResourceId = default(string), SystemData systemData = default(SystemData))
+ {
+ Id = id;
+ Name = name;
+ Type = type;
+ Location = location;
+ Tags = tags;
+ ProvisioningState = provisioningState;
+ HostName = hostName;
+ DataLocation = dataLocation;
+ NotificationHubId = notificationHubId;
+ Version = version;
+ ImmutableResourceId = immutableResourceId;
+ SystemData = systemData;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// 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 resource
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; private set; }
+
+ ///
+ /// Gets the type of the resource. E.g.
+ /// "Microsoft.Compute/virtualMachines" or
+ /// "Microsoft.Storage/storageAccounts"
+ ///
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; private set; }
+
+ ///
+ /// Gets or sets the Azure location where the CommunicationService is
+ /// running.
+ ///
+ [JsonProperty(PropertyName = "location")]
+ public string Location { get; set; }
+
+ ///
+ /// Gets or sets tags of the service which is a list of key value pairs
+ /// that describe the resource.
+ ///
+ [JsonProperty(PropertyName = "tags")]
+ public IDictionary Tags { get; set; }
+
+ ///
+ /// Gets provisioning state of the resource. Possible values include:
+ /// 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Running',
+ /// 'Creating', 'Updating', 'Deleting', 'Moving'
+ ///
+ [JsonProperty(PropertyName = "properties.provisioningState")]
+ public string ProvisioningState { get; private set; }
+
+ ///
+ /// Gets FQDN of the CommunicationService instance.
+ ///
+ [JsonProperty(PropertyName = "properties.hostName")]
+ public string HostName { get; private set; }
+
+ ///
+ /// Gets or sets the location where the communication service stores
+ /// its data at rest.
+ ///
+ [JsonProperty(PropertyName = "properties.dataLocation")]
+ public string DataLocation { get; set; }
+
+ ///
+ /// Gets resource ID of an Azure Notification Hub linked to this
+ /// resource.
+ ///
+ [JsonProperty(PropertyName = "properties.notificationHubId")]
+ public string NotificationHubId { get; private set; }
+
+ ///
+ /// Gets version of the CommunicationService resource. Probably you
+ /// need the same or higher version of client SDKs.
+ ///
+ [JsonProperty(PropertyName = "properties.version")]
+ public string Version { get; private set; }
+
+ ///
+ /// Gets the immutable resource Id of the communication service.
+ ///
+ [JsonProperty(PropertyName = "properties.immutableResourceId")]
+ public string ImmutableResourceId { get; private set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "systemData")]
+ public SystemData SystemData { get; set; }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/CreatedByType.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/CreatedByType.cs
new file mode 100644
index 0000000000000..58770c86c0bd3
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/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.Communication.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/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/ErrorAdditionalInfo.cs
new file mode 100644
index 0000000000000..65431728fb9a6
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/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.Communication.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/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/ErrorDetail.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/ErrorDetail.cs
new file mode 100644
index 0000000000000..c41c63e3b7276
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/ErrorDetail.cs
@@ -0,0 +1,85 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication.Models
+{
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// The error detail.
+ ///
+ public partial class ErrorDetail
+ {
+ ///
+ /// Initializes a new instance of the ErrorDetail class.
+ ///
+ public ErrorDetail()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorDetail class.
+ ///
+ /// The error code.
+ /// The error message.
+ /// The error target.
+ /// The error details.
+ /// The error additional info.
+ public ErrorDetail(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList))
+ {
+ Code = code;
+ Message = message;
+ Target = target;
+ Details = details;
+ AdditionalInfo = additionalInfo;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets the error code.
+ ///
+ [JsonProperty(PropertyName = "code")]
+ public string Code { get; private set; }
+
+ ///
+ /// Gets the error message.
+ ///
+ [JsonProperty(PropertyName = "message")]
+ public string Message { get; private set; }
+
+ ///
+ /// Gets the error target.
+ ///
+ [JsonProperty(PropertyName = "target")]
+ public string Target { get; private set; }
+
+ ///
+ /// Gets the error details.
+ ///
+ [JsonProperty(PropertyName = "details")]
+ public IList Details { get; private set; }
+
+ ///
+ /// Gets the error additional info.
+ ///
+ [JsonProperty(PropertyName = "additionalInfo")]
+ public IList AdditionalInfo { get; private set; }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/ErrorResponse.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/ErrorResponse.cs
new file mode 100644
index 0000000000000..bd24505a30e57
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/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.Communication.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/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/ErrorResponseException.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/ErrorResponseException.cs
new file mode 100644
index 0000000000000..29562a67a9359
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/ErrorResponseException.cs
@@ -0,0 +1,62 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication.Models
+{
+ using Microsoft.Rest;
+
+ ///
+ /// Exception thrown for an invalid response with ErrorResponse
+ /// information.
+ ///
+ public partial class ErrorResponseException : RestException
+ {
+ ///
+ /// Gets information about the associated HTTP request.
+ ///
+ public HttpRequestMessageWrapper Request { get; set; }
+
+ ///
+ /// Gets information about the associated HTTP response.
+ ///
+ public HttpResponseMessageWrapper Response { get; set; }
+
+ ///
+ /// Gets or sets the body object.
+ ///
+ public ErrorResponse Body { get; set; }
+
+ ///
+ /// Initializes a new instance of the ErrorResponseException class.
+ ///
+ public ErrorResponseException()
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorResponseException class.
+ ///
+ /// The exception message.
+ public ErrorResponseException(string message)
+ : this(message, null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorResponseException class.
+ ///
+ /// The exception message.
+ /// Inner exception.
+ public ErrorResponseException(string message, System.Exception innerException)
+ : base(message, innerException)
+ {
+ }
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/KeyType.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/KeyType.cs
new file mode 100644
index 0000000000000..78dd8a3d1bdfb
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/KeyType.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.Communication.Models
+{
+ using Newtonsoft.Json;
+ using Newtonsoft.Json.Converters;
+ using System.Runtime;
+ using System.Runtime.Serialization;
+
+ ///
+ /// Defines values for KeyType.
+ ///
+ [JsonConverter(typeof(StringEnumConverter))]
+ public enum KeyType
+ {
+ [EnumMember(Value = "Primary")]
+ Primary,
+ [EnumMember(Value = "Secondary")]
+ Secondary
+ }
+ internal static class KeyTypeEnumExtension
+ {
+ internal static string ToSerializedValue(this KeyType? value)
+ {
+ return value == null ? null : ((KeyType)value).ToSerializedValue();
+ }
+
+ internal static string ToSerializedValue(this KeyType value)
+ {
+ switch( value )
+ {
+ case KeyType.Primary:
+ return "Primary";
+ case KeyType.Secondary:
+ return "Secondary";
+ }
+ return null;
+ }
+
+ internal static KeyType? ParseKeyType(this string value)
+ {
+ switch( value )
+ {
+ case "Primary":
+ return KeyType.Primary;
+ case "Secondary":
+ return KeyType.Secondary;
+ }
+ return null;
+ }
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/LinkNotificationHubParameters.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/LinkNotificationHubParameters.cs
new file mode 100644
index 0000000000000..6cd379561bd79
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/LinkNotificationHubParameters.cs
@@ -0,0 +1,64 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Description of an Azure Notification Hub to link to the communication
+ /// service
+ ///
+ public partial class LinkNotificationHubParameters
+ {
+ ///
+ /// Initializes a new instance of the LinkNotificationHubParameters
+ /// class.
+ ///
+ public LinkNotificationHubParameters()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the LinkNotificationHubParameters
+ /// class.
+ ///
+ /// The resource ID of the notification
+ /// hub
+ /// Connection string for the
+ /// notification hub
+ public LinkNotificationHubParameters(string resourceId, string connectionString)
+ {
+ ResourceId = resourceId;
+ ConnectionString = connectionString;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the resource ID of the notification hub
+ ///
+ [JsonProperty(PropertyName = "resourceId")]
+ public string ResourceId { get; set; }
+
+ ///
+ /// Gets or sets connection string for the notification hub
+ ///
+ [JsonProperty(PropertyName = "connectionString")]
+ public string ConnectionString { get; set; }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/LinkedNotificationHub.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/LinkedNotificationHub.cs
new file mode 100644
index 0000000000000..7e6d83e1382d5
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/LinkedNotificationHub.cs
@@ -0,0 +1,52 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// A notification hub that has been linked to the communication service
+ ///
+ public partial class LinkedNotificationHub
+ {
+ ///
+ /// Initializes a new instance of the LinkedNotificationHub class.
+ ///
+ public LinkedNotificationHub()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the LinkedNotificationHub class.
+ ///
+ /// The resource ID of the notification
+ /// hub
+ public LinkedNotificationHub(string resourceId = default(string))
+ {
+ ResourceId = resourceId;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the resource ID of the notification hub
+ ///
+ [JsonProperty(PropertyName = "resourceId")]
+ public string ResourceId { get; set; }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/LocationResource.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/LocationResource.cs
new file mode 100644
index 0000000000000..e94132560e0ac
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/LocationResource.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.Communication.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// An ARM resource with its own location (not a global or an inherited
+ /// location).
+ ///
+ public partial class LocationResource
+ {
+ ///
+ /// Initializes a new instance of the LocationResource class.
+ ///
+ public LocationResource()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the LocationResource class.
+ ///
+ /// The Azure location where the
+ /// CommunicationService is running.
+ public LocationResource(string location = default(string))
+ {
+ Location = location;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the Azure location where the CommunicationService is
+ /// running.
+ ///
+ [JsonProperty(PropertyName = "location")]
+ public string Location { get; set; }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/NameAvailability.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/NameAvailability.cs
new file mode 100644
index 0000000000000..213e8354c7508
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/NameAvailability.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.Communication.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Result of the request to check name availability. It contains a flag
+ /// and possible reason of failure.
+ ///
+ public partial class NameAvailability
+ {
+ ///
+ /// Initializes a new instance of the NameAvailability class.
+ ///
+ public NameAvailability()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the NameAvailability class.
+ ///
+ /// Indicates whether the name is available
+ /// or not.
+ /// The reason of the availability. Required if
+ /// name is not available.
+ /// The message of the operation.
+ public NameAvailability(bool? nameAvailable = default(bool?), string reason = default(string), string message = default(string))
+ {
+ NameAvailable = nameAvailable;
+ Reason = reason;
+ Message = message;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets indicates whether the name is available or not.
+ ///
+ [JsonProperty(PropertyName = "nameAvailable")]
+ public bool? NameAvailable { get; set; }
+
+ ///
+ /// Gets or sets the reason of the availability. Required if name is
+ /// not available.
+ ///
+ [JsonProperty(PropertyName = "reason")]
+ public string Reason { get; set; }
+
+ ///
+ /// Gets or sets the message of the operation.
+ ///
+ [JsonProperty(PropertyName = "message")]
+ public string Message { get; set; }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/NameAvailabilityParameters.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/NameAvailabilityParameters.cs
new file mode 100644
index 0000000000000..f496744e236a8
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/NameAvailabilityParameters.cs
@@ -0,0 +1,63 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Data POST-ed to the nameAvailability action
+ ///
+ public partial class NameAvailabilityParameters
+ {
+ ///
+ /// Initializes a new instance of the NameAvailabilityParameters class.
+ ///
+ public NameAvailabilityParameters()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the NameAvailabilityParameters class.
+ ///
+ /// The resource type. Should be always
+ /// "Microsoft.Communication/CommunicationServices".
+ /// The CommunicationService name to validate.
+ /// e.g."my-CommunicationService-name-here"
+ public NameAvailabilityParameters(string type, string name)
+ {
+ Type = type;
+ Name = name;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the resource type. Should be always
+ /// "Microsoft.Communication/CommunicationServices".
+ ///
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; set; }
+
+ ///
+ /// Gets or sets the CommunicationService name to validate.
+ /// e.g."my-CommunicationService-name-here"
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/Operation.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/Operation.cs
new file mode 100644
index 0000000000000..e43d6600447e2
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/Operation.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.Communication.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// REST API Operation
+ ///
+ ///
+ /// Details of a REST API operation, returned from the Resource Provider
+ /// Operations API
+ ///
+ public partial class Operation
+ {
+ ///
+ /// Initializes a new instance of the Operation class.
+ ///
+ public Operation()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the Operation class.
+ ///
+ /// The name of the operation, as per Resource-Based
+ /// Access Control (RBAC). Examples:
+ /// "Microsoft.Compute/virtualMachines/write",
+ /// "Microsoft.Compute/virtualMachines/capture/action"
+ /// Whether the operation applies to
+ /// data-plane. This is "true" for data-plane operations and "false"
+ /// for ARM/control-plane operations.
+ /// Localized display information for this
+ /// particular operation.
+ /// The intended executor of the operation; as in
+ /// Resource Based Access Control (RBAC) and audit logs UX. Default
+ /// value is "user,system". Possible values include: 'user', 'system',
+ /// 'user,system'
+ /// Enum. Indicates the action type.
+ /// "Internal" refers to actions that are for internal only APIs.
+ /// Possible values include: 'Internal'
+ public Operation(string name = default(string), bool? isDataAction = default(bool?), OperationDisplay display = default(OperationDisplay), string origin = default(string), string actionType = default(string))
+ {
+ Name = name;
+ IsDataAction = isDataAction;
+ Display = display;
+ Origin = origin;
+ ActionType = actionType;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets the name of the operation, as per Resource-Based Access
+ /// Control (RBAC). Examples:
+ /// "Microsoft.Compute/virtualMachines/write",
+ /// "Microsoft.Compute/virtualMachines/capture/action"
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; private set; }
+
+ ///
+ /// Gets whether the operation applies to data-plane. This is "true"
+ /// for data-plane operations and "false" for ARM/control-plane
+ /// operations.
+ ///
+ [JsonProperty(PropertyName = "isDataAction")]
+ public bool? IsDataAction { get; private set; }
+
+ ///
+ /// Gets or sets localized display information for this particular
+ /// operation.
+ ///
+ [JsonProperty(PropertyName = "display")]
+ public OperationDisplay Display { get; set; }
+
+ ///
+ /// Gets the intended executor of the operation; as in Resource Based
+ /// Access Control (RBAC) and audit logs UX. Default value is
+ /// "user,system". Possible values include: 'user', 'system',
+ /// 'user,system'
+ ///
+ [JsonProperty(PropertyName = "origin")]
+ public string Origin { get; private set; }
+
+ ///
+ /// Gets enum. Indicates the action type. "Internal" refers to actions
+ /// that are for internal only APIs. Possible values include:
+ /// 'Internal'
+ ///
+ [JsonProperty(PropertyName = "actionType")]
+ public string ActionType { get; private set; }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/OperationDisplay.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/OperationDisplay.cs
new file mode 100644
index 0000000000000..421a21ea5a1e8
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/OperationDisplay.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.Communication.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Localized display information for this particular operation.
+ ///
+ public partial class OperationDisplay
+ {
+ ///
+ /// Initializes a new instance of the OperationDisplay class.
+ ///
+ public OperationDisplay()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the OperationDisplay class.
+ ///
+ /// The localized friendly form of the resource
+ /// provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft
+ /// Compute".
+ /// The localized friendly name of the resource
+ /// type related to this operation. E.g. "Virtual Machines" or "Job
+ /// Schedule Collections".
+ /// The concise, localized friendly name for
+ /// the operation; suitable for dropdowns. E.g. "Create or Update
+ /// Virtual Machine", "Restart Virtual Machine".
+ /// The short, localized friendly description
+ /// of the operation; suitable for tool tips and detailed
+ /// views.
+ 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 the localized friendly form of the resource provider name,
+ /// e.g. "Microsoft Monitoring Insights" or "Microsoft Compute".
+ ///
+ [JsonProperty(PropertyName = "provider")]
+ public string Provider { get; private set; }
+
+ ///
+ /// Gets the localized friendly name of the resource type related to
+ /// this operation. E.g. "Virtual Machines" or "Job Schedule
+ /// Collections".
+ ///
+ [JsonProperty(PropertyName = "resource")]
+ public string Resource { get; private set; }
+
+ ///
+ /// Gets the concise, localized friendly name for the operation;
+ /// suitable for dropdowns. E.g. "Create or Update Virtual Machine",
+ /// "Restart Virtual Machine".
+ ///
+ [JsonProperty(PropertyName = "operation")]
+ public string Operation { get; private set; }
+
+ ///
+ /// Gets the short, localized friendly description of the operation;
+ /// suitable for tool tips and detailed views.
+ ///
+ [JsonProperty(PropertyName = "description")]
+ public string Description { get; private set; }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/Origin.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/Origin.cs
new file mode 100644
index 0000000000000..b1471a47df0da
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/Origin.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.Communication.Models
+{
+
+ ///
+ /// Defines values for Origin.
+ ///
+ public static class Origin
+ {
+ public const string User = "user";
+ public const string System = "system";
+ public const string Usersystem = "user,system";
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/Page.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/Page.cs
new file mode 100644
index 0000000000000..8dccd2b034749
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/Page.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.Communication.Models
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+
+ ///
+ /// Defines a page in Azure responses.
+ ///
+ /// Type of the page content items
+ [JsonObject]
+ public class Page : IPage
+ {
+ ///
+ /// Gets the link to the next page.
+ ///
+ [JsonProperty("nextLink")]
+ public string NextPageLink { get; private set; }
+
+ [JsonProperty("value")]
+ private IList Items{ get; set; }
+
+ ///
+ /// Returns an enumerator that iterates through the collection.
+ ///
+ /// A an enumerator that can be used to iterate through the collection.
+ public IEnumerator GetEnumerator()
+ {
+ return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator();
+ }
+
+ ///
+ /// Returns an enumerator that iterates through the collection.
+ ///
+ /// A an enumerator that can be used to iterate through the collection.
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/ProvisioningState.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/ProvisioningState.cs
new file mode 100644
index 0000000000000..cd961547553da
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/ProvisioningState.cs
@@ -0,0 +1,29 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication.Models
+{
+
+ ///
+ /// Defines values for ProvisioningState.
+ ///
+ public static class ProvisioningState
+ {
+ public const string Unknown = "Unknown";
+ public const string Succeeded = "Succeeded";
+ public const string Failed = "Failed";
+ public const string Canceled = "Canceled";
+ public const string Running = "Running";
+ public const string Creating = "Creating";
+ public const string Updating = "Updating";
+ public const string Deleting = "Deleting";
+ public const string Moving = "Moving";
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/ProxyResource.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/ProxyResource.cs
new file mode 100644
index 0000000000000..3709804b50c7d
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/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.Communication.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/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/RegenerateKeyParameters.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/RegenerateKeyParameters.cs
new file mode 100644
index 0000000000000..617af3e599d81
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/RegenerateKeyParameters.cs
@@ -0,0 +1,55 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Parameters describes the request to regenerate access keys
+ ///
+ public partial class RegenerateKeyParameters
+ {
+ ///
+ /// Initializes a new instance of the RegenerateKeyParameters class.
+ ///
+ public RegenerateKeyParameters()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the RegenerateKeyParameters class.
+ ///
+ /// The keyType to regenerate. Must be either
+ /// 'primary' or 'secondary'(case-insensitive). Possible values
+ /// include: 'Primary', 'Secondary'
+ public RegenerateKeyParameters(KeyType? keyType = default(KeyType?))
+ {
+ KeyType = keyType;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the keyType to regenerate. Must be either 'primary' or
+ /// 'secondary'(case-insensitive). Possible values include: 'Primary',
+ /// 'Secondary'
+ ///
+ [JsonProperty(PropertyName = "keyType")]
+ public KeyType? KeyType { get; set; }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/Resource.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/Resource.cs
new file mode 100644
index 0000000000000..d886e2a13a84e
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/Resource.cs
@@ -0,0 +1,79 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication.Models
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Resource
+ ///
+ ///
+ /// Common fields that are returned in the response for all Azure Resource
+ /// Manager resources
+ ///
+ public partial class Resource : IResource
+ {
+ ///
+ /// Initializes a new instance of the Resource class.
+ ///
+ public Resource()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the Resource 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 Resource(string id = default(string), string name = default(string), string type = default(string))
+ {
+ Id = id;
+ Name = name;
+ Type = type;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// 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 resource
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; private set; }
+
+ ///
+ /// 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/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/SystemData.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/SystemData.cs
new file mode 100644
index 0000000000000..3cdb05c4747eb
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/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.Communication.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/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/TaggedResource.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/TaggedResource.cs
new file mode 100644
index 0000000000000..95740641e2574
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/TaggedResource.cs
@@ -0,0 +1,55 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication.Models
+{
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// An ARM resource with that can accept tags
+ ///
+ public partial class TaggedResource
+ {
+ ///
+ /// Initializes a new instance of the TaggedResource class.
+ ///
+ public TaggedResource()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the TaggedResource class.
+ ///
+ /// Tags of the service which is a list of key value
+ /// pairs that describe the resource.
+ public TaggedResource(IDictionary tags = default(IDictionary))
+ {
+ Tags = tags;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets tags of the service which is a list of key value pairs
+ /// that describe the resource.
+ ///
+ [JsonProperty(PropertyName = "tags")]
+ public IDictionary Tags { get; set; }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/TrackedResource.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/TrackedResource.cs
new file mode 100644
index 0000000000000..6521b99bde123
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Models/TrackedResource.cs
@@ -0,0 +1,73 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication.Models
+{
+ 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; }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Operations.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Operations.cs
new file mode 100644
index 0000000000000..0fb01eb30c099
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/Operations.cs
@@ -0,0 +1,398 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication
+{
+ 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;
+
+ ///
+ /// Operations operations.
+ ///
+ internal partial class Operations : IServiceOperations, IOperations
+ {
+ ///
+ /// Initializes a new instance of the Operations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal Operations(CommunicationServiceManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the CommunicationServiceManagementClient
+ ///
+ public CommunicationServiceManagementClient Client { get; private set; }
+
+ ///
+ /// List Operations
+ ///
+ ///
+ /// Lists all of the available REST API operations of the
+ /// Microsoft.Communication 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>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Communication/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
+ ///
+ ///
+ /// Lists all of the available REST API operations of the
+ /// Microsoft.Communication 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (nextPageLink == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextPageLink", nextPageLink);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
+ }
+ // Construct URL
+ string _url = "{nextLink}";
+ _url = _url.Replace("{nextLink}", nextPageLink);
+ List _queryParameters = new List();
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/OperationsExtensions.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/OperationsExtensions.cs
new file mode 100644
index 0000000000000..db226e582e918
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/OperationsExtensions.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.Communication
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for Operations.
+ ///
+ public static partial class OperationsExtensions
+ {
+ ///
+ /// List Operations
+ ///
+ ///
+ /// Lists all of the available REST API operations of the
+ /// Microsoft.Communication provider.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ public static IPage List(this IOperations operations)
+ {
+ return operations.ListAsync().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// List Operations
+ ///
+ ///
+ /// Lists all of the available REST API operations of the
+ /// Microsoft.Communication provider.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// List Operations
+ ///
+ ///
+ /// Lists all of the available REST API operations of the
+ /// Microsoft.Communication provider.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static IPage ListNext(this IOperations operations, string nextPageLink)
+ {
+ return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// List Operations
+ ///
+ ///
+ /// Lists all of the available REST API operations of the
+ /// Microsoft.Communication 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> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/SdkInfo_CommunicationServiceManagementClient.cs b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/SdkInfo_CommunicationServiceManagementClient.cs
new file mode 100644
index 0000000000000..f33eb449f1035
--- /dev/null
+++ b/sdk/communication/Microsoft.Azure.Management.Communication/src/Generated/SdkInfo_CommunicationServiceManagementClient.cs
@@ -0,0 +1,28 @@
+
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Communication
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ internal static partial class SdkInfo
+ {
+ public static IEnumerable> ApiInfo_CommunicationServiceManagementClient
+ {
+ get
+ {
+ return new Tuple[]
+ {
+ new Tuple("Communication", "CommunicationService", "2020-08-20"),
+ new Tuple("Communication", "Operations", "2020-08-20"),
+ }.AsEnumerable();
+ }
+ }
+ }
+}