diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/CommunicationsOperations.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/CommunicationsOperations.cs new file mode 100644 index 000000000000..b65e7af71b25 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/CommunicationsOperations.cs @@ -0,0 +1,1078 @@ +// +// 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.Support +{ + 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; + + /// + /// CommunicationsOperations operations. + /// + internal partial class CommunicationsOperations : IServiceOperations, ICommunicationsOperations + { + /// + /// Initializes a new instance of the CommunicationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CommunicationsOperations(MicrosoftSupportClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MicrosoftSupportClient + /// + public MicrosoftSupportClient Client { get; private set; } + + /// + /// Check the availability of a resource name. This API should to be used to + /// check the uniqueness of the name for adding a new communication to the + /// support ticket. + /// + /// + /// Support ticket name + /// + /// + /// Input to check + /// + /// + /// 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(string supportTicketName, CheckNameAvailabilityInput checkNameAvailabilityInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (supportTicketName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "supportTicketName"); + } + if (checkNameAvailabilityInput == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "checkNameAvailabilityInput"); + } + if (checkNameAvailabilityInput != null) + { + checkNameAvailabilityInput.Validate(); + } + 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("supportTicketName", supportTicketName); + tracingParameters.Add("checkNameAvailabilityInput", checkNameAvailabilityInput); + 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.Support/supportTickets/{supportTicketName}/checkNameAvailability").ToString(); + _url = _url.Replace("{supportTicketName}", System.Uri.EscapeDataString(supportTicketName)); + _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(checkNameAvailabilityInput != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(checkNameAvailabilityInput, 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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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; + } + + /// + /// Lists all communications (attachments not included) for a support ticket. + /// <br/></br> You can also filter support ticket communications by + /// <i>CreatedDate</i>�or <i>CommunicationType</i> + /// using the $filter parameter. The only type of communication supported today + /// is <i>Web</i>. Output will be a paged result with + /// <i>nextLink</i>, using which you can retrieve the next set of + /// Communication results. <br/><br/> Support ticket data is + /// available for 12 months after ticket creation. If a ticket was created more + /// than 12 months ago, a request for data might cause an error. + /// + /// + /// Support ticket name + /// + /// + /// The number of values to return in the collection. Default is 10 and max is + /// 10. + /// + /// + /// The filter to apply on the operation. You can filter by communicationType + /// and createdDate properties. CommunicationType supports Equals ('eq') + /// operator and createdDate supports Greater Than ('gt') and Greater Than or + /// Equals ('ge') operators. You may combine the CommunicationType and + /// CreatedDate filters by Logical And ('and') operator. + /// + /// + /// 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(string supportTicketName, int? top = default(int?), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (supportTicketName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "supportTicketName"); + } + 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("supportTicketName", supportTicketName); + tracingParameters.Add("top", top); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications").ToString(); + _url = _url.Replace("{supportTicketName}", System.Uri.EscapeDataString(supportTicketName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + 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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns details of a specific communication in a support ticket. + /// + /// + /// Support ticket name + /// + /// + /// Communication name + /// + /// + /// 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 supportTicketName, string communicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (supportTicketName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "supportTicketName"); + } + if (communicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "communicationName"); + } + 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("supportTicketName", supportTicketName); + tracingParameters.Add("communicationName", communicationName); + 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}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}").ToString(); + _url = _url.Replace("{supportTicketName}", System.Uri.EscapeDataString(supportTicketName)); + _url = _url.Replace("{communicationName}", System.Uri.EscapeDataString(communicationName)); + _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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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; + } + + /// + /// Adds a new customer communication to an Azure support ticket. Adding + /// attachments are not currently supported via the API. <br/>To add a + /// file to a support ticket, visit the <a target='_blank' + /// href='https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/managesupportrequest'>Manage + /// support ticket</a> page in the Azure portal, select the support + /// ticket, and use the file upload control to add a new file. + /// + /// + /// Support ticket name + /// + /// + /// Communication name + /// + /// + /// Communication object + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string supportTicketName, string communicationName, CommunicationDetails createCommunicationParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(supportTicketName, communicationName, createCommunicationParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds a new customer communication to an Azure support ticket. Adding + /// attachments are not currently supported via the API. <br/>To add a + /// file to a support ticket, visit the <a target='_blank' + /// href='https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/managesupportrequest'>Manage + /// support ticket</a> page in the Azure portal, select the support + /// ticket, and use the file upload control to add a new file. + /// + /// + /// Support ticket name + /// + /// + /// Communication name + /// + /// + /// Communication object + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string supportTicketName, string communicationName, CommunicationDetails createCommunicationParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (supportTicketName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "supportTicketName"); + } + if (communicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "communicationName"); + } + if (createCommunicationParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "createCommunicationParameters"); + } + if (createCommunicationParameters != null) + { + createCommunicationParameters.Validate(); + } + 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("supportTicketName", supportTicketName); + tracingParameters.Add("communicationName", communicationName); + tracingParameters.Add("createCommunicationParameters", createCommunicationParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}").ToString(); + _url = _url.Replace("{supportTicketName}", System.Uri.EscapeDataString(supportTicketName)); + _url = _url.Replace("{communicationName}", System.Uri.EscapeDataString(communicationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(createCommunicationParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(createCommunicationParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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; + } + + /// + /// Lists all communications (attachments not included) for a support ticket. + /// <br/></br> You can also filter support ticket communications by + /// <i>CreatedDate</i>�or <i>CommunicationType</i> + /// using the $filter parameter. The only type of communication supported today + /// is <i>Web</i>. Output will be a paged result with + /// <i>nextLink</i>, using which you can retrieve the next set of + /// Communication results. <br/><br/> Support ticket data is + /// available for 12 months after ticket creation. If a ticket was created more + /// than 12 months ago, a request for data might cause an error. + /// + /// + /// 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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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/support/Microsoft.Azure.Management.Support/src/Generated/CommunicationsOperationsExtensions.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/CommunicationsOperationsExtensions.cs new file mode 100644 index 000000000000..329fab26d672 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/CommunicationsOperationsExtensions.cs @@ -0,0 +1,343 @@ +// +// 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.Support +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CommunicationsOperations. + /// + public static partial class CommunicationsOperationsExtensions + { + /// + /// Check the availability of a resource name. This API should to be used to + /// check the uniqueness of the name for adding a new communication to the + /// support ticket. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Support ticket name + /// + /// + /// Input to check + /// + public static CheckNameAvailabilityOutput CheckNameAvailability(this ICommunicationsOperations operations, string supportTicketName, CheckNameAvailabilityInput checkNameAvailabilityInput) + { + return operations.CheckNameAvailabilityAsync(supportTicketName, checkNameAvailabilityInput).GetAwaiter().GetResult(); + } + + /// + /// Check the availability of a resource name. This API should to be used to + /// check the uniqueness of the name for adding a new communication to the + /// support ticket. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Support ticket name + /// + /// + /// Input to check + /// + /// + /// The cancellation token. + /// + public static async Task CheckNameAvailabilityAsync(this ICommunicationsOperations operations, string supportTicketName, CheckNameAvailabilityInput checkNameAvailabilityInput, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(supportTicketName, checkNameAvailabilityInput, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all communications (attachments not included) for a support ticket. + /// <br/></br> You can also filter support ticket communications by + /// <i>CreatedDate</i>�or <i>CommunicationType</i> + /// using the $filter parameter. The only type of communication supported today + /// is <i>Web</i>. Output will be a paged result with + /// <i>nextLink</i>, using which you can retrieve the next set of + /// Communication results. <br/><br/> Support ticket data is + /// available for 12 months after ticket creation. If a ticket was created more + /// than 12 months ago, a request for data might cause an error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Support ticket name + /// + /// + /// The number of values to return in the collection. Default is 10 and max is + /// 10. + /// + /// + /// The filter to apply on the operation. You can filter by communicationType + /// and createdDate properties. CommunicationType supports Equals ('eq') + /// operator and createdDate supports Greater Than ('gt') and Greater Than or + /// Equals ('ge') operators. You may combine the CommunicationType and + /// CreatedDate filters by Logical And ('and') operator. + /// + public static IPage List(this ICommunicationsOperations operations, string supportTicketName, int? top = default(int?), string filter = default(string)) + { + return operations.ListAsync(supportTicketName, top, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists all communications (attachments not included) for a support ticket. + /// <br/></br> You can also filter support ticket communications by + /// <i>CreatedDate</i>�or <i>CommunicationType</i> + /// using the $filter parameter. The only type of communication supported today + /// is <i>Web</i>. Output will be a paged result with + /// <i>nextLink</i>, using which you can retrieve the next set of + /// Communication results. <br/><br/> Support ticket data is + /// available for 12 months after ticket creation. If a ticket was created more + /// than 12 months ago, a request for data might cause an error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Support ticket name + /// + /// + /// The number of values to return in the collection. Default is 10 and max is + /// 10. + /// + /// + /// The filter to apply on the operation. You can filter by communicationType + /// and createdDate properties. CommunicationType supports Equals ('eq') + /// operator and createdDate supports Greater Than ('gt') and Greater Than or + /// Equals ('ge') operators. You may combine the CommunicationType and + /// CreatedDate filters by Logical And ('and') operator. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ICommunicationsOperations operations, string supportTicketName, int? top = default(int?), string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(supportTicketName, top, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns details of a specific communication in a support ticket. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Support ticket name + /// + /// + /// Communication name + /// + public static CommunicationDetails Get(this ICommunicationsOperations operations, string supportTicketName, string communicationName) + { + return operations.GetAsync(supportTicketName, communicationName).GetAwaiter().GetResult(); + } + + /// + /// Returns details of a specific communication in a support ticket. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Support ticket name + /// + /// + /// Communication name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICommunicationsOperations operations, string supportTicketName, string communicationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(supportTicketName, communicationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Adds a new customer communication to an Azure support ticket. Adding + /// attachments are not currently supported via the API. <br/>To add a + /// file to a support ticket, visit the <a target='_blank' + /// href='https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/managesupportrequest'>Manage + /// support ticket</a> page in the Azure portal, select the support + /// ticket, and use the file upload control to add a new file. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Support ticket name + /// + /// + /// Communication name + /// + /// + /// Communication object + /// + public static CommunicationDetails Create(this ICommunicationsOperations operations, string supportTicketName, string communicationName, CommunicationDetails createCommunicationParameters) + { + return operations.CreateAsync(supportTicketName, communicationName, createCommunicationParameters).GetAwaiter().GetResult(); + } + + /// + /// Adds a new customer communication to an Azure support ticket. Adding + /// attachments are not currently supported via the API. <br/>To add a + /// file to a support ticket, visit the <a target='_blank' + /// href='https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/managesupportrequest'>Manage + /// support ticket</a> page in the Azure portal, select the support + /// ticket, and use the file upload control to add a new file. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Support ticket name + /// + /// + /// Communication name + /// + /// + /// Communication object + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ICommunicationsOperations operations, string supportTicketName, string communicationName, CommunicationDetails createCommunicationParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(supportTicketName, communicationName, createCommunicationParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Adds a new customer communication to an Azure support ticket. Adding + /// attachments are not currently supported via the API. <br/>To add a + /// file to a support ticket, visit the <a target='_blank' + /// href='https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/managesupportrequest'>Manage + /// support ticket</a> page in the Azure portal, select the support + /// ticket, and use the file upload control to add a new file. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Support ticket name + /// + /// + /// Communication name + /// + /// + /// Communication object + /// + public static CommunicationDetails BeginCreate(this ICommunicationsOperations operations, string supportTicketName, string communicationName, CommunicationDetails createCommunicationParameters) + { + return operations.BeginCreateAsync(supportTicketName, communicationName, createCommunicationParameters).GetAwaiter().GetResult(); + } + + /// + /// Adds a new customer communication to an Azure support ticket. Adding + /// attachments are not currently supported via the API. <br/>To add a + /// file to a support ticket, visit the <a target='_blank' + /// href='https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/managesupportrequest'>Manage + /// support ticket</a> page in the Azure portal, select the support + /// ticket, and use the file upload control to add a new file. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Support ticket name + /// + /// + /// Communication name + /// + /// + /// Communication object + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this ICommunicationsOperations operations, string supportTicketName, string communicationName, CommunicationDetails createCommunicationParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(supportTicketName, communicationName, createCommunicationParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all communications (attachments not included) for a support ticket. + /// <br/></br> You can also filter support ticket communications by + /// <i>CreatedDate</i>�or <i>CommunicationType</i> + /// using the $filter parameter. The only type of communication supported today + /// is <i>Web</i>. Output will be a paged result with + /// <i>nextLink</i>, using which you can retrieve the next set of + /// Communication results. <br/><br/> Support ticket data is + /// available for 12 months after ticket creation. If a ticket was created more + /// than 12 months ago, a request for data might cause an error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ICommunicationsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all communications (attachments not included) for a support ticket. + /// <br/></br> You can also filter support ticket communications by + /// <i>CreatedDate</i>�or <i>CommunicationType</i> + /// using the $filter parameter. The only type of communication supported today + /// is <i>Web</i>. Output will be a paged result with + /// <i>nextLink</i>, using which you can retrieve the next set of + /// Communication results. <br/><br/> Support ticket data is + /// available for 12 months after ticket creation. If a ticket was created more + /// than 12 months ago, a request for data might cause an error. + /// + /// + /// 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 ICommunicationsOperations 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/support/Microsoft.Azure.Management.Support/src/Generated/ICommunicationsOperations.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/ICommunicationsOperations.cs new file mode 100644 index 000000000000..83e4b68ffa9a --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/ICommunicationsOperations.cs @@ -0,0 +1,223 @@ +// +// 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.Support +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CommunicationsOperations operations. + /// + public partial interface ICommunicationsOperations + { + /// + /// Check the availability of a resource name. This API should to be + /// used to check the uniqueness of the name for adding a new + /// communication to the support ticket. + /// + /// + /// Support ticket name + /// + /// + /// Input to check + /// + /// + /// 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(string supportTicketName, CheckNameAvailabilityInput checkNameAvailabilityInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all communications (attachments not included) for a support + /// ticket. <br/></br> You can also filter support ticket + /// communications by <i>CreatedDate</i>�or + /// <i>CommunicationType</i> using the $filter parameter. + /// The only type of communication supported today is + /// <i>Web</i>. Output will be a paged result with + /// <i>nextLink</i>, using which you can retrieve the next + /// set of Communication results. <br/><br/> Support ticket + /// data is available for 12 months after ticket creation. If a ticket + /// was created more than 12 months ago, a request for data might cause + /// an error. + /// + /// + /// Support ticket name + /// + /// + /// The number of values to return in the collection. Default is 10 and + /// max is 10. + /// + /// + /// The filter to apply on the operation. You can filter by + /// communicationType and createdDate properties. CommunicationType + /// supports Equals ('eq') operator and createdDate supports Greater + /// Than ('gt') and Greater Than or Equals ('ge') operators. You may + /// combine the CommunicationType and CreatedDate filters by Logical + /// And ('and') operator. + /// + /// + /// 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(string supportTicketName, int? top = default(int?), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns details of a specific communication in a support ticket. + /// + /// + /// Support ticket name + /// + /// + /// Communication name + /// + /// + /// 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 supportTicketName, string communicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Adds a new customer communication to an Azure support ticket. + /// Adding attachments are not currently supported via the API. + /// <br/>To add a file to a support ticket, visit the <a + /// target='_blank' + /// href='https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/managesupportrequest'>Manage + /// support ticket</a> page in the Azure portal, select the + /// support ticket, and use the file upload control to add a new file. + /// + /// + /// Support ticket name + /// + /// + /// Communication name + /// + /// + /// Communication object + /// + /// + /// 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> CreateWithHttpMessagesAsync(string supportTicketName, string communicationName, CommunicationDetails createCommunicationParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Adds a new customer communication to an Azure support ticket. + /// Adding attachments are not currently supported via the API. + /// <br/>To add a file to a support ticket, visit the <a + /// target='_blank' + /// href='https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/managesupportrequest'>Manage + /// support ticket</a> page in the Azure portal, select the + /// support ticket, and use the file upload control to add a new file. + /// + /// + /// Support ticket name + /// + /// + /// Communication name + /// + /// + /// Communication object + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string supportTicketName, string communicationName, CommunicationDetails createCommunicationParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all communications (attachments not included) for a support + /// ticket. <br/></br> You can also filter support ticket + /// communications by <i>CreatedDate</i>�or + /// <i>CommunicationType</i> using the $filter parameter. + /// The only type of communication supported today is + /// <i>Web</i>. Output will be a paged result with + /// <i>nextLink</i>, using which you can retrieve the next + /// set of Communication results. <br/><br/> Support ticket + /// data is available for 12 months after ticket creation. If a ticket + /// was created more than 12 months ago, a request for data might cause + /// an error. + /// + /// + /// 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/support/Microsoft.Azure.Management.Support/src/Generated/IMicrosoftSupportClient.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/IMicrosoftSupportClient.cs new file mode 100644 index 000000000000..4a4c56470060 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/IMicrosoftSupportClient.cs @@ -0,0 +1,98 @@ +// +// 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.Support +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// Microsoft Azure Support Resource Provider. + /// + public partial interface IMicrosoftSupportClient : 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; } + + /// + /// Azure subscription id + /// + string SubscriptionId { get; set; } + + /// + /// Api version + /// + 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 IServicesOperations. + /// + IServicesOperations Services { get; } + + /// + /// Gets the IProblemClassificationsOperations. + /// + IProblemClassificationsOperations ProblemClassifications { get; } + + /// + /// Gets the ISupportTicketsOperations. + /// + ISupportTicketsOperations SupportTickets { get; } + + /// + /// Gets the ICommunicationsOperations. + /// + ICommunicationsOperations Communications { get; } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/IOperations.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/IOperations.cs new file mode 100644 index 000000000000..0d63ca133b3d --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/IOperations.cs @@ -0,0 +1,46 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Support +{ + 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 + { + /// + /// This lists all the available Microsoft Support REST API operations. + /// + /// + /// 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)); + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/IProblemClassificationsOperations.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/IProblemClassificationsOperations.cs new file mode 100644 index 000000000000..32372210d633 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/IProblemClassificationsOperations.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Support +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ProblemClassificationsOperations operations. + /// + public partial interface IProblemClassificationsOperations + { + /// + /// Lists all the problem classifications (categories) available for a + /// specific Azure service.<br/><br/> Always use the + /// service and problem classifications obtained programmatically. This + /// practice ensures that you always have the most recent set of + /// service and problem classification Ids. + /// + /// + /// Name of Azure service for which the problem classifications need to + /// be retrieved. + /// + /// + /// 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(string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the details of a specific problem classification for a + /// specific Azure service. + /// + /// + /// Name of Azure service available for support. + /// + /// + /// Name of problem classification. + /// + /// + /// 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 serviceName, string problemClassificationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/IServicesOperations.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/IServicesOperations.cs new file mode 100644 index 000000000000..417e8c867562 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/IServicesOperations.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Support +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ServicesOperations operations. + /// + public partial interface IServicesOperations + { + /// + /// Lists all the Azure services available for support ticket creation. + /// Here are the Service Ids for **Billing**, **Subscription + /// Management**, and **Service and subscription limits (Quotas)** + /// issues: <br/><table><tr><td><u>Issue + /// type</u></td><td><u>Service + /// Id</u></td></tr><tr><td>Billing</td><td>'/providers/Microsoft.Support/services/517f2da6-78fd-0498-4e22-ad26996b1dfc'</td></tr><tr><td>Subscription + /// Management</td><td>'/providers/Microsoft.Support/services/f3dc5421-79ef-1efa-41a5-42bf3cbb52c6'</td></tr><tr><td>Quota</td><td>'/providers/Microsoft.Support/services/06bfd9d3-516b-d5c6-5802-169c800dec89'</td></tr></table> + /// <br/><br/> For **Technical** issues, select the Service + /// Id that maps to the Azure service/product as displayed in the + /// **Services** drop-down list on the Azure portal's <a + /// target='_blank' + /// href='https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/overview'>New + /// support request</a> page. <br/><br/> Always use + /// the service and it's corresponding problem classification(s) + /// obtained programmatically for support ticket creation. This + /// practice ensures that you always have the most recent set of + /// service and problem classification Ids. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a specific Azure service for support ticket creation. + /// + /// + /// Name of Azure service + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/ISupportTicketsOperations.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/ISupportTicketsOperations.cs new file mode 100644 index 000000000000..381d9d5cd9fe --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/ISupportTicketsOperations.cs @@ -0,0 +1,253 @@ +// +// 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.Support +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SupportTicketsOperations operations. + /// + public partial interface ISupportTicketsOperations + { + /// + /// Check the availability of a resource name. This API should to be + /// used to check the uniqueness of the name for support ticket + /// creation for the selected subscription. + /// + /// + /// Input to check. + /// + /// + /// 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(CheckNameAvailabilityInput checkNameAvailabilityInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the support tickets for an Azure subscription. + /// <br/><br/>You can also filter the support tickets by + /// <i>Status</i> or <i>CreatedDate</i> using + /// the $filter parameter. Output will be a paged result with + /// <i>nextLink</i>, using which you can retrieve the next + /// set of support tickets. <br/><br/>Support ticket data + /// is available for 12 months after ticket creation. If a ticket was + /// created more than 12 months ago, a request for data might cause an + /// error. + /// + /// + /// The number of values to return in the collection. Default is 25 and + /// max is 100. + /// + /// + /// The filter to apply on the operation. We support 'odata v4.0' + /// filter semantics. <a target='_blank' + /// href='https://docs.microsoft.com/odata/concepts/queryoptions-overview'>Learn + /// more</a> <br/><i>Status</i> filter can only + /// be used with 'eq' operator. For <i>CreatedDate</i> + /// filter, the supported operators are 'gt' and 'ge'. When using both + /// filters, combine them using the logical 'AND'. + /// + /// + /// 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(int? top = default(int?), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets details for a specific support ticket in an Azure + /// subscription. <br/><br/>Support ticket data is + /// available for 12 months after ticket creation. If a ticket was + /// created more than 12 months ago, a request for data might cause an + /// error. + /// + /// + /// Support ticket name + /// + /// + /// 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 supportTicketName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// This API allows you to update the severity level or your contact + /// information in the support ticket. <br/><br/> Note: The + /// severity levels cannot be changed if a support ticket is actively + /// being worked upon by an Azure support engineer. In such a case, + /// contact your support engineer to request severity update by adding + /// a new communication using the Communications API. + /// + /// + /// Support ticket name + /// + /// + /// UpdateSupportTicket object + /// + /// + /// 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 supportTicketName, UpdateSupportTicket updateSupportTicket, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a new support ticket for Quota increase, Technical, + /// Billing, and Subscription Management issues for the specified + /// subscription. <br/><br/>A paid technical support plan + /// is required to create a support ticket using this API. <a + /// href='https://aka.ms/supportticketAPI'>Learn more</a> + /// <br/><br/> Use the Services API to map the right + /// Service Id to the issue type. For example: For billing tickets set + /// *serviceId* to + /// *'/providers/Microsoft.Support/services/517f2da6-78fd-0498-4e22-ad26996b1dfc'*. + /// <br/> For Technical issues, the Service id will map to the + /// Azure service you want to raise a support ticket for. + /// <br/><br/>Always call the Services and + /// ProblemClassifications API to get the most recent set of services + /// and problem categories required for support ticket creation. + /// + /// + /// Support ticket name. + /// + /// + /// Support ticket request payload. + /// + /// + /// 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> CreateWithHttpMessagesAsync(string supportTicketName, SupportTicketDetails createSupportTicketParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a new support ticket for Quota increase, Technical, + /// Billing, and Subscription Management issues for the specified + /// subscription. <br/><br/>A paid technical support plan + /// is required to create a support ticket using this API. <a + /// href='https://aka.ms/supportticketAPI'>Learn more</a> + /// <br/><br/> Use the Services API to map the right + /// Service Id to the issue type. For example: For billing tickets set + /// *serviceId* to + /// *'/providers/Microsoft.Support/services/517f2da6-78fd-0498-4e22-ad26996b1dfc'*. + /// <br/> For Technical issues, the Service id will map to the + /// Azure service you want to raise a support ticket for. + /// <br/><br/>Always call the Services and + /// ProblemClassifications API to get the most recent set of services + /// and problem categories required for support ticket creation. + /// + /// + /// Support ticket name. + /// + /// + /// Support ticket request payload. + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string supportTicketName, SupportTicketDetails createSupportTicketParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the support tickets for an Azure subscription. + /// <br/><br/>You can also filter the support tickets by + /// <i>Status</i> or <i>CreatedDate</i> using + /// the $filter parameter. Output will be a paged result with + /// <i>nextLink</i>, using which you can retrieve the next + /// set of support tickets. <br/><br/>Support ticket data + /// is available for 12 months after ticket creation. If a ticket was + /// created more than 12 months ago, a request for data might cause an + /// error. + /// + /// + /// 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/support/Microsoft.Azure.Management.Support/src/Generated/MicrosoftSupportClient.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/MicrosoftSupportClient.cs new file mode 100644 index 000000000000..e3dcf50f3400 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/MicrosoftSupportClient.cs @@ -0,0 +1,384 @@ +// +// 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.Support +{ + 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; + + /// + /// Microsoft Azure Support Resource Provider. + /// + public partial class MicrosoftSupportClient : ServiceClient, IMicrosoftSupportClient, 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; } + + /// + /// Azure subscription id + /// + public string SubscriptionId { get; set; } + + /// + /// Api version + /// + 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 IServicesOperations. + /// + public virtual IServicesOperations Services { get; private set; } + + /// + /// Gets the IProblemClassificationsOperations. + /// + public virtual IProblemClassificationsOperations ProblemClassifications { get; private set; } + + /// + /// Gets the ISupportTicketsOperations. + /// + public virtual ISupportTicketsOperations SupportTickets { get; private set; } + + /// + /// Gets the ICommunicationsOperations. + /// + public virtual ICommunicationsOperations Communications { get; private set; } + + /// + /// Initializes a new instance of the MicrosoftSupportClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling MicrosoftSupportClient.Dispose(). False: will not dispose provided httpClient + protected MicrosoftSupportClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the MicrosoftSupportClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected MicrosoftSupportClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the MicrosoftSupportClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected MicrosoftSupportClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the MicrosoftSupportClient 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 MicrosoftSupportClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the MicrosoftSupportClient 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 MicrosoftSupportClient(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 MicrosoftSupportClient 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 MicrosoftSupportClient(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 MicrosoftSupportClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling MicrosoftSupportClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public MicrosoftSupportClient(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 MicrosoftSupportClient 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 MicrosoftSupportClient(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 MicrosoftSupportClient 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 MicrosoftSupportClient(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 MicrosoftSupportClient 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 MicrosoftSupportClient(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); + Services = new ServicesOperations(this); + ProblemClassifications = new ProblemClassificationsOperations(this); + SupportTickets = new SupportTicketsOperations(this); + Communications = new CommunicationsOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2019-05-01-preview"; + 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/support/Microsoft.Azure.Management.Support/src/Generated/Models/CheckNameAvailabilityInput.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/CheckNameAvailabilityInput.cs new file mode 100644 index 000000000000..f4df2dd01849 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/CheckNameAvailabilityInput.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Support.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Input of CheckNameAvailability API. + /// + public partial class CheckNameAvailabilityInput + { + /// + /// Initializes a new instance of the CheckNameAvailabilityInput class. + /// + public CheckNameAvailabilityInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckNameAvailabilityInput class. + /// + /// The resource name to validate + /// The type of resource. Possible values include: + /// 'Microsoft.Support/supportTickets', + /// 'Microsoft.Support/communications' + public CheckNameAvailabilityInput(string name, Type type) + { + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource name to validate + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the type of resource. Possible values include: + /// 'Microsoft.Support/supportTickets', + /// 'Microsoft.Support/communications' + /// + [JsonProperty(PropertyName = "type")] + public Type Type { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/CheckNameAvailabilityOutput.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/CheckNameAvailabilityOutput.cs new file mode 100644 index 000000000000..da460591ca61 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/CheckNameAvailabilityOutput.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.Support.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Output of check name availability API. + /// + public partial class CheckNameAvailabilityOutput + { + /// + /// Initializes a new instance of the CheckNameAvailabilityOutput + /// class. + /// + public CheckNameAvailabilityOutput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckNameAvailabilityOutput + /// class. + /// + /// Indicates whether the name is + /// available. + /// The reason why the name is not + /// available. + /// The detailed error message describing why the + /// name is not available. + public CheckNameAvailabilityOutput(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 indicates whether the name is available. + /// + [JsonProperty(PropertyName = "nameAvailable")] + public bool? NameAvailable { get; private set; } + + /// + /// Gets the reason why the name is not available. + /// + [JsonProperty(PropertyName = "reason")] + public string Reason { get; private set; } + + /// + /// Gets the detailed error message describing why the name is not + /// available. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/CommunicationDetails.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/CommunicationDetails.cs new file mode 100644 index 000000000000..898c02613fc8 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/CommunicationDetails.cs @@ -0,0 +1,142 @@ +// +// 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.Support.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Object that represents Communication resource + /// + [Rest.Serialization.JsonTransformation] + public partial class CommunicationDetails : IResource + { + /// + /// Initializes a new instance of the CommunicationDetails class. + /// + public CommunicationDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CommunicationDetails class. + /// + /// Subject of the communication + /// Body of the communication + /// Id of the resource + /// Name of the resource + /// Type of the resource + /// 'Microsoft.Support/communications' + /// Communication type. Possible values + /// include: 'web', 'phone' + /// Direction of communication. + /// Possible values include: 'inbound', 'outbound' + /// Email address of the sender + /// Time in UTC (ISO 8601 format) when the + /// communication was created. + public CommunicationDetails(string subject, string body, string id = default(string), string name = default(string), string type = default(string), string communicationType = default(string), string communicationDirection = default(string), string sender = default(string), System.DateTime? createdDate = default(System.DateTime?)) + { + Id = id; + Name = name; + Type = type; + CommunicationType = communicationType; + CommunicationDirection = communicationDirection; + Sender = sender; + Subject = subject; + Body = body; + CreatedDate = createdDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets id of the resource + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets type of the resource 'Microsoft.Support/communications' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets communication type. Possible values include: 'web', 'phone' + /// + [JsonProperty(PropertyName = "properties.communicationType")] + public string CommunicationType { get; private set; } + + /// + /// Gets direction of communication. Possible values include: + /// 'inbound', 'outbound' + /// + [JsonProperty(PropertyName = "properties.communicationDirection")] + public string CommunicationDirection { get; private set; } + + /// + /// Gets or sets email address of the sender + /// + [JsonProperty(PropertyName = "properties.sender")] + public string Sender { get; set; } + + /// + /// Gets or sets subject of the communication + /// + [JsonProperty(PropertyName = "properties.subject")] + public string Subject { get; set; } + + /// + /// Gets or sets body of the communication + /// + [JsonProperty(PropertyName = "properties.body")] + public string Body { get; set; } + + /// + /// Gets time in UTC (ISO 8601 format) when the communication was + /// created. + /// + [JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Subject == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Subject"); + } + if (Body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Body"); + } + } + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/CommunicationDirection.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/CommunicationDirection.cs new file mode 100644 index 000000000000..d57a1c9454e8 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/CommunicationDirection.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Support.Models +{ + + /// + /// Defines values for CommunicationDirection. + /// + public static class CommunicationDirection + { + public const string Inbound = "inbound"; + public const string Outbound = "outbound"; + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/CommunicationType.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/CommunicationType.cs new file mode 100644 index 000000000000..5a959825bc05 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/CommunicationType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Support.Models +{ + + /// + /// Defines values for CommunicationType. + /// + public static class CommunicationType + { + public const string Web = "web"; + public const string Phone = "phone"; + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ContactProfile.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ContactProfile.cs new file mode 100644 index 000000000000..fbc60105c1d2 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ContactProfile.cs @@ -0,0 +1,189 @@ +// +// 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.Support.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Contact information associated with support ticket. + /// + public partial class ContactProfile + { + /// + /// Initializes a new instance of the ContactProfile class. + /// + public ContactProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContactProfile class. + /// + /// First name. + /// Last name. + /// Preferred contact method. + /// Possible values include: 'email', 'phone' + /// Primary email address. + /// Time zone of the user. This is the + /// name of the time zone from <a target='_blank' + /// href='https://support.microsoft.com/en-us/help/973627/microsoft-time-zone-index-values'>Microsoft + /// Time Zone Index Values</a>. + /// Country of the user. This is the ISO 3166-1 + /// alpha-3 code. + /// Preferred language of + /// support from Azure. Support languages vary based on the severity + /// you choose for your support ticket. Learn more at <a + /// target='_blank' + /// href='https://azure.microsoft.com/support/plans/response/'>Azure + /// Severity and responsiveness</a>. Use the standard + /// language-country code. Valid values are 'en-us' for English, + /// 'zh-hans' for Chinese, 'es-es' for Spanish, 'fr-fr' for French, + /// 'ja-jp' for Japanese, 'ko-kr' for Korean, 'ru-ru' for Russian, + /// 'pt-br' for Portuguese, 'it-it' for Italian, 'zh-tw' for Chinese + /// and 'de-de' for German. + /// Additional email addresses + /// listed will be copied on any correspondence about the support + /// ticket. + /// Phone number. This is required if + /// preferred contact method is phone. + public ContactProfile(string firstName, string lastName, string preferredContactMethod, string primaryEmailAddress, string preferredTimeZone, string country, string preferredSupportLanguage, IList additionalEmailAddresses = default(IList), string phoneNumber = default(string)) + { + FirstName = firstName; + LastName = lastName; + PreferredContactMethod = preferredContactMethod; + PrimaryEmailAddress = primaryEmailAddress; + AdditionalEmailAddresses = additionalEmailAddresses; + PhoneNumber = phoneNumber; + PreferredTimeZone = preferredTimeZone; + Country = country; + PreferredSupportLanguage = preferredSupportLanguage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets first name. + /// + [JsonProperty(PropertyName = "firstName")] + public string FirstName { get; set; } + + /// + /// Gets or sets last name. + /// + [JsonProperty(PropertyName = "lastName")] + public string LastName { get; set; } + + /// + /// Gets or sets preferred contact method. Possible values include: + /// 'email', 'phone' + /// + [JsonProperty(PropertyName = "preferredContactMethod")] + public string PreferredContactMethod { get; set; } + + /// + /// Gets or sets primary email address. + /// + [JsonProperty(PropertyName = "primaryEmailAddress")] + public string PrimaryEmailAddress { get; set; } + + /// + /// Gets or sets additional email addresses listed will be copied on + /// any correspondence about the support ticket. + /// + [JsonProperty(PropertyName = "additionalEmailAddresses")] + public IList AdditionalEmailAddresses { get; set; } + + /// + /// Gets or sets phone number. This is required if preferred contact + /// method is phone. + /// + [JsonProperty(PropertyName = "phoneNumber")] + public string PhoneNumber { get; set; } + + /// + /// Gets or sets time zone of the user. This is the name of the time + /// zone from &lt;a target='_blank' + /// href='https://support.microsoft.com/en-us/help/973627/microsoft-time-zone-index-values'&gt;Microsoft + /// Time Zone Index Values&lt;/a&gt;. + /// + [JsonProperty(PropertyName = "preferredTimeZone")] + public string PreferredTimeZone { get; set; } + + /// + /// Gets or sets country of the user. This is the ISO 3166-1 alpha-3 + /// code. + /// + [JsonProperty(PropertyName = "country")] + public string Country { get; set; } + + /// + /// Gets or sets preferred language of support from Azure. Support + /// languages vary based on the severity you choose for your support + /// ticket. Learn more at &lt;a target='_blank' + /// href='https://azure.microsoft.com/support/plans/response/'&gt;Azure + /// Severity and responsiveness&lt;/a&gt;. Use the standard + /// language-country code. Valid values are 'en-us' for English, + /// 'zh-hans' for Chinese, 'es-es' for Spanish, 'fr-fr' for French, + /// 'ja-jp' for Japanese, 'ko-kr' for Korean, 'ru-ru' for Russian, + /// 'pt-br' for Portuguese, 'it-it' for Italian, 'zh-tw' for Chinese + /// and 'de-de' for German. + /// + [JsonProperty(PropertyName = "preferredSupportLanguage")] + public string PreferredSupportLanguage { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (FirstName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "FirstName"); + } + if (LastName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "LastName"); + } + if (PreferredContactMethod == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PreferredContactMethod"); + } + if (PrimaryEmailAddress == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrimaryEmailAddress"); + } + if (PreferredTimeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PreferredTimeZone"); + } + if (Country == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Country"); + } + if (PreferredSupportLanguage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PreferredSupportLanguage"); + } + } + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ExceptionResponse.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ExceptionResponse.cs new file mode 100644 index 000000000000..d3071bf0ccbb --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ExceptionResponse.cs @@ -0,0 +1,51 @@ +// +// 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.Support.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The api error. + /// + public partial class ExceptionResponse + { + /// + /// Initializes a new instance of the ExceptionResponse class. + /// + public ExceptionResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExceptionResponse class. + /// + /// The api error details. + public ExceptionResponse(ServiceError error = default(ServiceError)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the api error details. + /// + [JsonProperty(PropertyName = "error")] + public ServiceError Error { get; set; } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ExceptionResponseException.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ExceptionResponseException.cs new file mode 100644 index 000000000000..fbc5307721f4 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ExceptionResponseException.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.Support.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ExceptionResponse + /// information. + /// + public partial class ExceptionResponseException : 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 ExceptionResponse Body { get; set; } + + /// + /// Initializes a new instance of the ExceptionResponseException class. + /// + public ExceptionResponseException() + { + } + + /// + /// Initializes a new instance of the ExceptionResponseException class. + /// + /// The exception message. + public ExceptionResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ExceptionResponseException class. + /// + /// The exception message. + /// Inner exception. + public ExceptionResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/Operation.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/Operation.cs new file mode 100644 index 000000000000..52b589d503c6 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/Operation.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Support.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The operation supported by Microsoft Support RP. + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + /// Operation name: + /// {provider}/{resource}/{operation} + /// The object that describes the + /// operation. + public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay)) + { + Name = name; + Display = display; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets operation name: {provider}/{resource}/{operation} + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets or sets the object that describes the operation. + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/OperationDisplay.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..6735b47a1a1c --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Support.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The object that describes the 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 description of the operation + /// The action that users can perform, based on + /// their permission level + /// Service provider: Microsoft Support + /// Resource on which the operation is + /// performed + public OperationDisplay(string description = default(string), string operation = default(string), string provider = default(string), string resource = default(string)) + { + Description = description; + Operation = operation; + Provider = provider; + Resource = resource; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the description of the operation + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + /// + /// Gets the action that users can perform, based on their permission + /// level + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; private set; } + + /// + /// Gets service provider: Microsoft Support + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; private set; } + + /// + /// Gets resource on which the operation is performed + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; private set; } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/Page.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/Page.cs new file mode 100644 index 000000000000..72b58f7ce3f1 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/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.Support.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("")] + 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/support/Microsoft.Azure.Management.Support/src/Generated/Models/Page1.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/Page1.cs new file mode 100644 index 000000000000..f96d3d48b43d --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/Page1.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.Support.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 Page1 : 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/support/Microsoft.Azure.Management.Support/src/Generated/Models/PreferredContactMethod.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/PreferredContactMethod.cs new file mode 100644 index 000000000000..75d5988cec28 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/PreferredContactMethod.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Support.Models +{ + + /// + /// Defines values for PreferredContactMethod. + /// + public static class PreferredContactMethod + { + public const string Email = "email"; + public const string Phone = "phone"; + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ProblemClassification.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ProblemClassification.cs new file mode 100644 index 000000000000..a97ada99d2e2 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ProblemClassification.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Support.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// ProblemClassification resource object + /// + [Rest.Serialization.JsonTransformation] + public partial class ProblemClassification + { + /// + /// Initializes a new instance of the ProblemClassification class. + /// + public ProblemClassification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProblemClassification class. + /// + /// Id of the resource + /// Name of the resource + /// Type of the resource + /// 'Microsoft.Support/problemClassification' + /// Localized name of problem + /// classification. + public ProblemClassification(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string)) + { + Id = id; + Name = name; + Type = type; + DisplayName = displayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets id of the resource + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets type of the resource 'Microsoft.Support/problemClassification' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets localized name of problem classification. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/QuotaChangeRequest.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/QuotaChangeRequest.cs new file mode 100644 index 000000000000..f7cd252d248e --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/QuotaChangeRequest.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.Support.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// This property is required for providing the region and new quota limits + /// + public partial class QuotaChangeRequest + { + /// + /// Initializes a new instance of the QuotaChangeRequest class. + /// + public QuotaChangeRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QuotaChangeRequest class. + /// + /// Region for which the quota increase request is + /// being made. + /// Payload of the quota increase + /// request. + public QuotaChangeRequest(string region = default(string), string payload = default(string)) + { + Region = region; + Payload = payload; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets region for which the quota increase request is being + /// made. + /// + [JsonProperty(PropertyName = "region")] + public string Region { get; set; } + + /// + /// Gets or sets payload of the quota increase request. + /// + [JsonProperty(PropertyName = "payload")] + public string Payload { get; set; } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/QuotaTicketDetails.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/QuotaTicketDetails.cs new file mode 100644 index 000000000000..e8e462791987 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/QuotaTicketDetails.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Support.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Additional set of information required for quota increase support + /// ticket for certain quota types, e.g.: Virtual machine cores. Get + /// complete details about Quota payload support request along with + /// examples at <a target='' + /// href='https://aka.ms/supportrpquotarequestpayload'>Support quota + /// request</a>. + /// + public partial class QuotaTicketDetails + { + /// + /// Initializes a new instance of the QuotaTicketDetails class. + /// + public QuotaTicketDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QuotaTicketDetails class. + /// + /// Required for certain quota + /// types when there is a sub type that you are requesting quota + /// increase for. Example: Batch + /// Quota change request + /// version + /// This property is required for + /// providing the region and new quota limits. + public QuotaTicketDetails(string quotaChangeRequestSubType = default(string), string quotaChangeRequestVersion = default(string), IList quotaChangeRequests = default(IList)) + { + QuotaChangeRequestSubType = quotaChangeRequestSubType; + QuotaChangeRequestVersion = quotaChangeRequestVersion; + QuotaChangeRequests = quotaChangeRequests; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets required for certain quota types when there is a sub + /// type that you are requesting quota increase for. Example: Batch + /// + [JsonProperty(PropertyName = "quotaChangeRequestSubType")] + public string QuotaChangeRequestSubType { get; set; } + + /// + /// Gets or sets quota change request version + /// + [JsonProperty(PropertyName = "quotaChangeRequestVersion")] + public string QuotaChangeRequestVersion { get; set; } + + /// + /// Gets or sets this property is required for providing the region and + /// new quota limits. + /// + [JsonProperty(PropertyName = "quotaChangeRequests")] + public IList QuotaChangeRequests { get; set; } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/Service.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/Service.cs new file mode 100644 index 000000000000..0ab2d2cc2ec6 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/Service.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.Support.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Object that represents a Service resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class Service + { + /// + /// Initializes a new instance of the Service class. + /// + public Service() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Service class. + /// + /// Id of the resource + /// Name of the resource + /// Type of the resource + /// 'Microsoft.Support/services' + /// Localized name of Azure service + public Service(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string)) + { + Id = id; + Name = name; + Type = type; + DisplayName = displayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets id of the resource + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets type of the resource 'Microsoft.Support/services' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets localized name of Azure service + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ServiceError.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ServiceError.cs new file mode 100644 index 000000000000..589682ee5501 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ServiceError.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Support.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The api error details. + /// + public partial class ServiceError + { + /// + /// Initializes a new instance of the ServiceError class. + /// + public ServiceError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceError class. + /// + /// The error code. + /// The error message. + /// The target of the error. + /// The list of error details. + public ServiceError(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets the target of the error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + /// + /// Gets the list of error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ServiceErrorDetail.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ServiceErrorDetail.cs new file mode 100644 index 000000000000..9c2b6fcb779c --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ServiceErrorDetail.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Support.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The error details. + /// + public partial class ServiceErrorDetail + { + /// + /// Initializes a new instance of the ServiceErrorDetail class. + /// + public ServiceErrorDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceErrorDetail class. + /// + /// The error code. + /// The error message. + /// The target of the error. + public ServiceErrorDetail(string code = default(string), string message = default(string), string target = default(string)) + { + Code = code; + Message = message; + Target = target; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets 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 or sets the target of the error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ServiceLevelAgreement.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ServiceLevelAgreement.cs new file mode 100644 index 000000000000..61041973200e --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/ServiceLevelAgreement.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.Support.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Service Level Agreement details for a support ticket. + /// + public partial class ServiceLevelAgreement + { + /// + /// Initializes a new instance of the ServiceLevelAgreement class. + /// + public ServiceLevelAgreement() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceLevelAgreement class. + /// + /// Time in UTC (ISO 8601 format) when service + /// level agreement starts. + /// Time in UTC (ISO 8601 format) when + /// service level agreement expires. + /// Service Level Agreement in minutes + public ServiceLevelAgreement(System.DateTime? startTime = default(System.DateTime?), System.DateTime? expirationTime = default(System.DateTime?), int? slaMinutes = default(int?)) + { + StartTime = startTime; + ExpirationTime = expirationTime; + SlaMinutes = slaMinutes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets time in UTC (ISO 8601 format) when service level agreement + /// starts. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; private set; } + + /// + /// Gets time in UTC (ISO 8601 format) when service level agreement + /// expires. + /// + [JsonProperty(PropertyName = "expirationTime")] + public System.DateTime? ExpirationTime { get; private set; } + + /// + /// Gets service Level Agreement in minutes + /// + [JsonProperty(PropertyName = "slaMinutes")] + public int? SlaMinutes { get; private set; } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/SeverityLevel.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/SeverityLevel.cs new file mode 100644 index 000000000000..699f2198b38a --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/SeverityLevel.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.Support.Models +{ + + /// + /// Defines values for SeverityLevel. + /// + public static class SeverityLevel + { + public const string Minimal = "minimal"; + public const string Moderate = "moderate"; + public const string Critical = "critical"; + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/SupportEngineer.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/SupportEngineer.cs new file mode 100644 index 000000000000..10867dbe454b --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/SupportEngineer.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.Support.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Support engineer information. + /// + public partial class SupportEngineer + { + /// + /// Initializes a new instance of the SupportEngineer class. + /// + public SupportEngineer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SupportEngineer class. + /// + /// Email address of the Azure Support + /// engineer assigned to the support ticket. + public SupportEngineer(string emailAddress = default(string)) + { + EmailAddress = emailAddress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets email address of the Azure Support engineer assigned to the + /// support ticket. + /// + [JsonProperty(PropertyName = "emailAddress")] + public string EmailAddress { get; private set; } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/SupportTicketDetails.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/SupportTicketDetails.cs new file mode 100644 index 000000000000..998e254e76f6 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/SupportTicketDetails.cs @@ -0,0 +1,316 @@ +// +// 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.Support.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Object that represents SupportTicketDetails resource + /// + [Rest.Serialization.JsonTransformation] + public partial class SupportTicketDetails : IResource + { + /// + /// Initializes a new instance of the SupportTicketDetails class. + /// + public SupportTicketDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SupportTicketDetails class. + /// + /// Detailed description of the question or + /// issue. + /// Each Azure service has its + /// own set of issue category called problem classification that + /// corresponds to the type of problem you're experiencing. This + /// parameter is the resource id of ProblemClassification + /// resource. + /// A value that indicates the urgency of the + /// case, which in turn determines the response time according to the + /// service level agreement of the technical support plan you have with + /// Azure. Possible values include: 'minimal', 'moderate', + /// 'critical' + /// Contact information of the user + /// requesting to create a support ticket. + /// Title of the support ticket. + /// This is the resource id of the Azure + /// service resource associated with the support ticket. + /// Id of the resource + /// Name of the resource + /// Type of the resource + /// 'Microsoft.Support/supportTickets' + /// System generated support ticket id + /// that is unique. + /// Localized name of + /// problem classification. + /// Enrollment ID associated with the + /// support ticket. + /// Indicates if this issue is a + /// production outage. + /// Indicates if this requires a 24x7 + /// response from Azure. + /// Service Level Agreement + /// information for this support ticket. + /// Information about support engineer + /// working on this support ticket. + /// Support plan type associated with the + /// support ticket. + /// Time in UTC (ISO 8601 format) when + /// the problem started. + /// Localized name of Azure + /// service. + /// Status of the support ticket. + /// Time in UTC (ISO 8601 format) when + /// support ticket was created. + /// Time in UTC (ISO 8601 format) when + /// support ticket was last modified. + /// Additional ticket details + /// associated with a technical support ticket request. + /// Additional ticket details + /// associated with a quota support ticket request. + public SupportTicketDetails(string description, string problemClassificationId, string severity, ContactProfile contactDetails, string title, string serviceId, string id = default(string), string name = default(string), string type = default(string), string supportTicketId = default(string), string problemClassificationDisplayName = default(string), string enrollmentId = default(string), bool? productionOutage = default(bool?), bool? require24X7Response = default(bool?), ServiceLevelAgreement serviceLevelAgreement = default(ServiceLevelAgreement), SupportEngineer supportEngineer = default(SupportEngineer), string supportPlanType = default(string), System.DateTime? problemStartTime = default(System.DateTime?), string serviceDisplayName = default(string), string status = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), TechnicalTicketDetails technicalTicketDetails = default(TechnicalTicketDetails), QuotaTicketDetails quotaTicketDetails = default(QuotaTicketDetails)) + { + Id = id; + Name = name; + Type = type; + SupportTicketId = supportTicketId; + Description = description; + ProblemClassificationId = problemClassificationId; + ProblemClassificationDisplayName = problemClassificationDisplayName; + Severity = severity; + EnrollmentId = enrollmentId; + ProductionOutage = productionOutage; + Require24X7Response = require24X7Response; + ContactDetails = contactDetails; + ServiceLevelAgreement = serviceLevelAgreement; + SupportEngineer = supportEngineer; + SupportPlanType = supportPlanType; + Title = title; + ProblemStartTime = problemStartTime; + ServiceId = serviceId; + ServiceDisplayName = serviceDisplayName; + Status = status; + CreatedDate = createdDate; + ModifiedDate = modifiedDate; + TechnicalTicketDetails = technicalTicketDetails; + QuotaTicketDetails = quotaTicketDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets id of the resource + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets type of the resource 'Microsoft.Support/supportTickets' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets system generated support ticket id that is unique. + /// + [JsonProperty(PropertyName = "properties.supportTicketId")] + public string SupportTicketId { get; set; } + + /// + /// Gets or sets detailed description of the question or issue. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets each Azure service has its own set of issue category + /// called problem classification that corresponds to the type of + /// problem you're experiencing. This parameter is the resource id of + /// ProblemClassification resource. + /// + [JsonProperty(PropertyName = "properties.problemClassificationId")] + public string ProblemClassificationId { get; set; } + + /// + /// Gets localized name of problem classification. + /// + [JsonProperty(PropertyName = "properties.problemClassificationDisplayName")] + public string ProblemClassificationDisplayName { get; private set; } + + /// + /// Gets or sets a value that indicates the urgency of the case, which + /// in turn determines the response time according to the service level + /// agreement of the technical support plan you have with Azure. + /// Possible values include: 'minimal', 'moderate', 'critical' + /// + [JsonProperty(PropertyName = "properties.severity")] + public string Severity { get; set; } + + /// + /// Gets enrollment ID associated with the support ticket. + /// + [JsonProperty(PropertyName = "properties.enrollmentId")] + public string EnrollmentId { get; private set; } + + /// + /// Gets indicates if this issue is a production outage. + /// + [JsonProperty(PropertyName = "properties.productionOutage")] + public bool? ProductionOutage { get; private set; } + + /// + /// Gets or sets indicates if this requires a 24x7 response from Azure. + /// + [JsonProperty(PropertyName = "properties.require24X7Response")] + public bool? Require24X7Response { get; set; } + + /// + /// Gets or sets contact information of the user requesting to create a + /// support ticket. + /// + [JsonProperty(PropertyName = "properties.contactDetails")] + public ContactProfile ContactDetails { get; set; } + + /// + /// Gets or sets service Level Agreement information for this support + /// ticket. + /// + [JsonProperty(PropertyName = "properties.serviceLevelAgreement")] + public ServiceLevelAgreement ServiceLevelAgreement { get; set; } + + /// + /// Gets or sets information about support engineer working on this + /// support ticket. + /// + [JsonProperty(PropertyName = "properties.supportEngineer")] + public SupportEngineer SupportEngineer { get; set; } + + /// + /// Gets support plan type associated with the support ticket. + /// + [JsonProperty(PropertyName = "properties.supportPlanType")] + public string SupportPlanType { get; private set; } + + /// + /// Gets or sets title of the support ticket. + /// + [JsonProperty(PropertyName = "properties.title")] + public string Title { get; set; } + + /// + /// Gets or sets time in UTC (ISO 8601 format) when the problem + /// started. + /// + [JsonProperty(PropertyName = "properties.problemStartTime")] + public System.DateTime? ProblemStartTime { get; set; } + + /// + /// Gets or sets this is the resource id of the Azure service resource + /// associated with the support ticket. + /// + [JsonProperty(PropertyName = "properties.serviceId")] + public string ServiceId { get; set; } + + /// + /// Gets localized name of Azure service. + /// + [JsonProperty(PropertyName = "properties.serviceDisplayName")] + public string ServiceDisplayName { get; private set; } + + /// + /// Gets status of the support ticket. + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets time in UTC (ISO 8601 format) when support ticket was created. + /// + [JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate { get; private set; } + + /// + /// Gets time in UTC (ISO 8601 format) when support ticket was last + /// modified. + /// + [JsonProperty(PropertyName = "properties.modifiedDate")] + public System.DateTime? ModifiedDate { get; private set; } + + /// + /// Gets or sets additional ticket details associated with a technical + /// support ticket request. + /// + [JsonProperty(PropertyName = "properties.technicalTicketDetails")] + public TechnicalTicketDetails TechnicalTicketDetails { get; set; } + + /// + /// Gets or sets additional ticket details associated with a quota + /// support ticket request. + /// + [JsonProperty(PropertyName = "properties.quotaTicketDetails")] + public QuotaTicketDetails QuotaTicketDetails { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Description == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Description"); + } + if (ProblemClassificationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ProblemClassificationId"); + } + if (Severity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Severity"); + } + if (ContactDetails == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ContactDetails"); + } + if (Title == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Title"); + } + if (ServiceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ServiceId"); + } + if (ContactDetails != null) + { + ContactDetails.Validate(); + } + } + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/TechnicalTicketDetails.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/TechnicalTicketDetails.cs new file mode 100644 index 000000000000..3cbd2707afc4 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/TechnicalTicketDetails.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.Support.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Additional information for technical support ticket. + /// + public partial class TechnicalTicketDetails + { + /// + /// Initializes a new instance of the TechnicalTicketDetails class. + /// + public TechnicalTicketDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TechnicalTicketDetails class. + /// + /// This is the resource id of the Azure + /// service resource (For example: A virtual machine resource or an + /// HDInsight resource) for which the support ticket is + /// created. + public TechnicalTicketDetails(string resourceId = default(string)) + { + ResourceId = resourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this is the resource id of the Azure service resource + /// (For example: A virtual machine resource or an HDInsight resource) + /// for which the support ticket is created. + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/Type.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/Type.cs new file mode 100644 index 000000000000..6538c2c4cee8 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/Type.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.Support.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for Type. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum Type + { + [EnumMember(Value = "Microsoft.Support/supportTickets")] + MicrosoftSupportSupportTickets, + [EnumMember(Value = "Microsoft.Support/communications")] + MicrosoftSupportCommunications + } + internal static class TypeEnumExtension + { + internal static string ToSerializedValue(this Type? value) + { + return value == null ? null : ((Type)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this Type value) + { + switch( value ) + { + case Type.MicrosoftSupportSupportTickets: + return "Microsoft.Support/supportTickets"; + case Type.MicrosoftSupportCommunications: + return "Microsoft.Support/communications"; + } + return null; + } + + internal static Type? ParseType(this string value) + { + switch( value ) + { + case "Microsoft.Support/supportTickets": + return Type.MicrosoftSupportSupportTickets; + case "Microsoft.Support/communications": + return Type.MicrosoftSupportCommunications; + } + return null; + } + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/UpdateContactProfile.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/UpdateContactProfile.cs new file mode 100644 index 000000000000..89d9d1f5d34d --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/UpdateContactProfile.cs @@ -0,0 +1,150 @@ +// +// 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.Support.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Contact information associated with the support ticket. + /// + public partial class UpdateContactProfile + { + /// + /// Initializes a new instance of the UpdateContactProfile class. + /// + public UpdateContactProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateContactProfile class. + /// + /// First name + /// Last name + /// Preferred contact method. + /// Possible values include: 'email', 'phone' + /// Primary email address + /// Email addresses listed will + /// be copied on any correspondence about the support ticket + /// Phone number. This is required if + /// preferred contact method is phone. + /// Time zone of the user. This is the + /// name of the time zone from <a target='_blank' + /// href='https://support.microsoft.com/en-us/help/973627/microsoft-time-zone-index-values'>Microsoft + /// Time Zone Index Values</a>. + /// Country of the user. This is the ISO 3166-1 + /// alpha-3 code. + /// Preferred language of + /// support from Azure. Support languages vary based on the severity + /// you choose for your support ticket. Learn more at <a + /// target='_blank' + /// href='https://azure.microsoft.com/support/plans/response/'>Azure + /// Severity and responsiveness</a>. Use the standard + /// language-country code. Valid values are 'en-us' for English, + /// 'zh-hans' for Chinese, 'es-es' for Spanish, 'fr-fr' for French, + /// 'ja-jp' for Japanese, 'ko-kr' for Korean, 'ru-ru' for Russian, + /// 'pt-br' for Portuguese, 'it-it' for Italian, 'zh-tw' for Chinese + /// and 'de-de' for German. + public UpdateContactProfile(string firstName = default(string), string lastName = default(string), string preferredContactMethod = default(string), string primaryEmailAddress = default(string), IList additionalEmailAddresses = default(IList), string phoneNumber = default(string), string preferredTimeZone = default(string), string country = default(string), string preferredSupportLanguage = default(string)) + { + FirstName = firstName; + LastName = lastName; + PreferredContactMethod = preferredContactMethod; + PrimaryEmailAddress = primaryEmailAddress; + AdditionalEmailAddresses = additionalEmailAddresses; + PhoneNumber = phoneNumber; + PreferredTimeZone = preferredTimeZone; + Country = country; + PreferredSupportLanguage = preferredSupportLanguage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets first name + /// + [JsonProperty(PropertyName = "firstName")] + public string FirstName { get; set; } + + /// + /// Gets or sets last name + /// + [JsonProperty(PropertyName = "lastName")] + public string LastName { get; set; } + + /// + /// Gets or sets preferred contact method. Possible values include: + /// 'email', 'phone' + /// + [JsonProperty(PropertyName = "preferredContactMethod")] + public string PreferredContactMethod { get; set; } + + /// + /// Gets or sets primary email address + /// + [JsonProperty(PropertyName = "primaryEmailAddress")] + public string PrimaryEmailAddress { get; set; } + + /// + /// Gets or sets email addresses listed will be copied on any + /// correspondence about the support ticket + /// + [JsonProperty(PropertyName = "additionalEmailAddresses")] + public IList AdditionalEmailAddresses { get; set; } + + /// + /// Gets or sets phone number. This is required if preferred contact + /// method is phone. + /// + [JsonProperty(PropertyName = "phoneNumber")] + public string PhoneNumber { get; set; } + + /// + /// Gets or sets time zone of the user. This is the name of the time + /// zone from &lt;a target='_blank' + /// href='https://support.microsoft.com/en-us/help/973627/microsoft-time-zone-index-values'&gt;Microsoft + /// Time Zone Index Values&lt;/a&gt;. + /// + [JsonProperty(PropertyName = "preferredTimeZone")] + public string PreferredTimeZone { get; set; } + + /// + /// Gets or sets country of the user. This is the ISO 3166-1 alpha-3 + /// code. + /// + [JsonProperty(PropertyName = "country")] + public string Country { get; set; } + + /// + /// Gets or sets preferred language of support from Azure. Support + /// languages vary based on the severity you choose for your support + /// ticket. Learn more at &lt;a target='_blank' + /// href='https://azure.microsoft.com/support/plans/response/'&gt;Azure + /// Severity and responsiveness&lt;/a&gt;. Use the standard + /// language-country code. Valid values are 'en-us' for English, + /// 'zh-hans' for Chinese, 'es-es' for Spanish, 'fr-fr' for French, + /// 'ja-jp' for Japanese, 'ko-kr' for Korean, 'ru-ru' for Russian, + /// 'pt-br' for Portuguese, 'it-it' for Italian, 'zh-tw' for Chinese + /// and 'de-de' for German. + /// + [JsonProperty(PropertyName = "preferredSupportLanguage")] + public string PreferredSupportLanguage { get; set; } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/UpdateSupportTicket.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/UpdateSupportTicket.cs new file mode 100644 index 000000000000..300922d1b005 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Models/UpdateSupportTicket.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.Support.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Updates severity and contact details in the support ticket. + /// + public partial class UpdateSupportTicket + { + /// + /// Initializes a new instance of the UpdateSupportTicket class. + /// + public UpdateSupportTicket() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateSupportTicket class. + /// + /// Severity level. Possible values include: + /// 'minimal', 'moderate', 'critical' + /// Contact details to be updated on the + /// support ticket. + public UpdateSupportTicket(string severity = default(string), UpdateContactProfile contactDetails = default(UpdateContactProfile)) + { + Severity = severity; + ContactDetails = contactDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets severity level. Possible values include: 'minimal', + /// 'moderate', 'critical' + /// + [JsonProperty(PropertyName = "severity")] + public string Severity { get; set; } + + /// + /// Gets or sets contact details to be updated on the support ticket. + /// + [JsonProperty(PropertyName = "contactDetails")] + public UpdateContactProfile ContactDetails { get; set; } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Operations.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Operations.cs new file mode 100644 index 000000000000..ad155dfd0b85 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/Operations.cs @@ -0,0 +1,222 @@ +// +// 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.Support +{ + 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(MicrosoftSupportClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MicrosoftSupportClient + /// + public MicrosoftSupportClient Client { get; private set; } + + /// + /// This lists all the available Microsoft Support REST API operations. + /// + /// + /// 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.Support/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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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/support/Microsoft.Azure.Management.Support/src/Generated/OperationsExtensions.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..cb7a6e879154 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/OperationsExtensions.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.Support +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// This lists all the available Microsoft Support REST API operations. + /// + /// + /// The operations group for this extension method. + /// + public static IEnumerable List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// This lists all the available Microsoft Support REST API operations. + /// + /// + /// 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; + } + } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/ProblemClassificationsOperations.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/ProblemClassificationsOperations.cs new file mode 100644 index 000000000000..fc32dc2a268f --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/ProblemClassificationsOperations.cs @@ -0,0 +1,422 @@ +// +// 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.Support +{ + 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; + + /// + /// ProblemClassificationsOperations operations. + /// + internal partial class ProblemClassificationsOperations : IServiceOperations, IProblemClassificationsOperations + { + /// + /// Initializes a new instance of the ProblemClassificationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ProblemClassificationsOperations(MicrosoftSupportClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MicrosoftSupportClient + /// + public MicrosoftSupportClient Client { get; private set; } + + /// + /// Lists all the problem classifications (categories) available for a specific + /// Azure service.<br/><br/> Always use the service and problem + /// classifications obtained programmatically. This practice ensures that you + /// always have the most recent set of service and problem classification Ids. + /// + /// + /// Name of Azure service for which the problem classifications need to be + /// retrieved. + /// + /// + /// 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(string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + 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("serviceName", serviceName); + 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.Support/services/{serviceName}/problemClassifications").ToString(); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + 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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the details of a specific problem classification for a specific Azure + /// service. + /// + /// + /// Name of Azure service available for support. + /// + /// + /// Name of problem classification. + /// + /// + /// 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 serviceName, string problemClassificationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (problemClassificationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "problemClassificationName"); + } + 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("serviceName", serviceName); + tracingParameters.Add("problemClassificationName", problemClassificationName); + 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("/") ? "" : "/")), "providers/Microsoft.Support/services/{serviceName}/problemClassifications/{problemClassificationName}").ToString(); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{problemClassificationName}", System.Uri.EscapeDataString(problemClassificationName)); + 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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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/support/Microsoft.Azure.Management.Support/src/Generated/ProblemClassificationsOperationsExtensions.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/ProblemClassificationsOperationsExtensions.cs new file mode 100644 index 000000000000..602497fecdba --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/ProblemClassificationsOperationsExtensions.cs @@ -0,0 +1,111 @@ +// +// 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.Support +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ProblemClassificationsOperations. + /// + public static partial class ProblemClassificationsOperationsExtensions + { + /// + /// Lists all the problem classifications (categories) available for a specific + /// Azure service.<br/><br/> Always use the service and problem + /// classifications obtained programmatically. This practice ensures that you + /// always have the most recent set of service and problem classification Ids. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of Azure service for which the problem classifications need to be + /// retrieved. + /// + public static IEnumerable List(this IProblemClassificationsOperations operations, string serviceName) + { + return operations.ListAsync(serviceName).GetAwaiter().GetResult(); + } + + /// + /// Lists all the problem classifications (categories) available for a specific + /// Azure service.<br/><br/> Always use the service and problem + /// classifications obtained programmatically. This practice ensures that you + /// always have the most recent set of service and problem classification Ids. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of Azure service for which the problem classifications need to be + /// retrieved. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IProblemClassificationsOperations operations, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(serviceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the details of a specific problem classification for a specific Azure + /// service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of Azure service available for support. + /// + /// + /// Name of problem classification. + /// + public static ProblemClassification Get(this IProblemClassificationsOperations operations, string serviceName, string problemClassificationName) + { + return operations.GetAsync(serviceName, problemClassificationName).GetAwaiter().GetResult(); + } + + /// + /// Gets the details of a specific problem classification for a specific Azure + /// service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of Azure service available for support. + /// + /// + /// Name of problem classification. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IProblemClassificationsOperations operations, string serviceName, string problemClassificationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(serviceName, problemClassificationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/SdkInfo_MicrosoftSupport.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/SdkInfo_MicrosoftSupport.cs new file mode 100644 index 000000000000..9acf12ea1015 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/SdkInfo_MicrosoftSupport.cs @@ -0,0 +1,31 @@ + +// +// 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.Support +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_MicrosoftSupport + { + get + { + return new Tuple[] + { + new Tuple("Support", "Communications", "2019-05-01-preview"), + new Tuple("Support", "Operations", "2019-05-01-preview"), + new Tuple("Support", "ProblemClassifications", "2019-05-01-preview"), + new Tuple("Support", "Services", "2019-05-01-preview"), + new Tuple("Support", "SupportTickets", "2019-05-01-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/ServicesOperations.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/ServicesOperations.cs new file mode 100644 index 000000000000..a6acae36a330 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/ServicesOperations.cs @@ -0,0 +1,414 @@ +// +// 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.Support +{ + 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; + + /// + /// ServicesOperations operations. + /// + internal partial class ServicesOperations : IServiceOperations, IServicesOperations + { + /// + /// Initializes a new instance of the ServicesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ServicesOperations(MicrosoftSupportClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MicrosoftSupportClient + /// + public MicrosoftSupportClient Client { get; private set; } + + /// + /// Lists all the Azure services available for support ticket creation. Here + /// are the Service Ids for **Billing**, **Subscription Management**, and + /// **Service and subscription limits (Quotas)** issues: + /// <br/><table><tr><td><u>Issue + /// type</u></td><td><u>Service + /// Id</u></td></tr><tr><td>Billing</td><td>'/providers/Microsoft.Support/services/517f2da6-78fd-0498-4e22-ad26996b1dfc'</td></tr><tr><td>Subscription + /// Management</td><td>'/providers/Microsoft.Support/services/f3dc5421-79ef-1efa-41a5-42bf3cbb52c6'</td></tr><tr><td>Quota</td><td>'/providers/Microsoft.Support/services/06bfd9d3-516b-d5c6-5802-169c800dec89'</td></tr></table> + /// <br/><br/> For **Technical** issues, select the Service Id that + /// maps to the Azure service/product as displayed in the **Services** + /// drop-down list on the Azure portal's <a target='_blank' + /// href='https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/overview'>New + /// support request</a> page. <br/><br/> Always use the + /// service and it's corresponding problem classification(s) obtained + /// programmatically for support ticket creation. This practice ensures that + /// you always have the most recent set of service and problem classification + /// Ids. + /// + /// + /// 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.Support/services").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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a specific Azure service for support ticket creation. + /// + /// + /// Name of Azure service + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + 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("serviceName", serviceName); + 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("/") ? "" : "/")), "providers/Microsoft.Support/services/{serviceName}").ToString(); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + 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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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/support/Microsoft.Azure.Management.Support/src/Generated/ServicesOperationsExtensions.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/ServicesOperationsExtensions.cs new file mode 100644 index 000000000000..7014a288f0bc --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/ServicesOperationsExtensions.cs @@ -0,0 +1,119 @@ +// +// 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.Support +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ServicesOperations. + /// + public static partial class ServicesOperationsExtensions + { + /// + /// Lists all the Azure services available for support ticket creation. Here + /// are the Service Ids for **Billing**, **Subscription Management**, and + /// **Service and subscription limits (Quotas)** issues: + /// <br/><table><tr><td><u>Issue + /// type</u></td><td><u>Service + /// Id</u></td></tr><tr><td>Billing</td><td>'/providers/Microsoft.Support/services/517f2da6-78fd-0498-4e22-ad26996b1dfc'</td></tr><tr><td>Subscription + /// Management</td><td>'/providers/Microsoft.Support/services/f3dc5421-79ef-1efa-41a5-42bf3cbb52c6'</td></tr><tr><td>Quota</td><td>'/providers/Microsoft.Support/services/06bfd9d3-516b-d5c6-5802-169c800dec89'</td></tr></table> + /// <br/><br/> For **Technical** issues, select the Service Id that + /// maps to the Azure service/product as displayed in the **Services** + /// drop-down list on the Azure portal's <a target='_blank' + /// href='https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/overview'>New + /// support request</a> page. <br/><br/> Always use the + /// service and it's corresponding problem classification(s) obtained + /// programmatically for support ticket creation. This practice ensures that + /// you always have the most recent set of service and problem classification + /// Ids. + /// + /// + /// The operations group for this extension method. + /// + public static IEnumerable List(this IServicesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all the Azure services available for support ticket creation. Here + /// are the Service Ids for **Billing**, **Subscription Management**, and + /// **Service and subscription limits (Quotas)** issues: + /// <br/><table><tr><td><u>Issue + /// type</u></td><td><u>Service + /// Id</u></td></tr><tr><td>Billing</td><td>'/providers/Microsoft.Support/services/517f2da6-78fd-0498-4e22-ad26996b1dfc'</td></tr><tr><td>Subscription + /// Management</td><td>'/providers/Microsoft.Support/services/f3dc5421-79ef-1efa-41a5-42bf3cbb52c6'</td></tr><tr><td>Quota</td><td>'/providers/Microsoft.Support/services/06bfd9d3-516b-d5c6-5802-169c800dec89'</td></tr></table> + /// <br/><br/> For **Technical** issues, select the Service Id that + /// maps to the Azure service/product as displayed in the **Services** + /// drop-down list on the Azure portal's <a target='_blank' + /// href='https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/overview'>New + /// support request</a> page. <br/><br/> Always use the + /// service and it's corresponding problem classification(s) obtained + /// programmatically for support ticket creation. This practice ensures that + /// you always have the most recent set of service and problem classification + /// Ids. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IServicesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a specific Azure service for support ticket creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of Azure service + /// + public static Service Get(this IServicesOperations operations, string serviceName) + { + return operations.GetAsync(serviceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a specific Azure service for support ticket creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of Azure service + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IServicesOperations operations, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(serviceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/support/Microsoft.Azure.Management.Support/src/Generated/SupportTicketsOperations.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/SupportTicketsOperations.cs new file mode 100644 index 000000000000..1ea558d7d970 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/SupportTicketsOperations.cs @@ -0,0 +1,1257 @@ +// +// 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.Support +{ + 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; + + /// + /// SupportTicketsOperations operations. + /// + internal partial class SupportTicketsOperations : IServiceOperations, ISupportTicketsOperations + { + /// + /// Initializes a new instance of the SupportTicketsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SupportTicketsOperations(MicrosoftSupportClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MicrosoftSupportClient + /// + public MicrosoftSupportClient Client { get; private set; } + + /// + /// Check the availability of a resource name. This API should to be used to + /// check the uniqueness of the name for support ticket creation for the + /// selected subscription. + /// + /// + /// Input to check. + /// + /// + /// 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(CheckNameAvailabilityInput checkNameAvailabilityInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (checkNameAvailabilityInput == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "checkNameAvailabilityInput"); + } + if (checkNameAvailabilityInput != null) + { + checkNameAvailabilityInput.Validate(); + } + 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("checkNameAvailabilityInput", checkNameAvailabilityInput); + 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.Support/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(checkNameAvailabilityInput != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(checkNameAvailabilityInput, 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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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; + } + + /// + /// Lists all the support tickets for an Azure subscription. + /// <br/><br/>You can also filter the support tickets by + /// <i>Status</i> or <i>CreatedDate</i> using the + /// $filter parameter. Output will be a paged result with + /// <i>nextLink</i>, using which you can retrieve the next set of + /// support tickets. <br/><br/>Support ticket data is available for + /// 12 months after ticket creation. If a ticket was created more than 12 + /// months ago, a request for data might cause an error. + /// + /// + /// The number of values to return in the collection. Default is 25 and max is + /// 100. + /// + /// + /// The filter to apply on the operation. We support 'odata v4.0' filter + /// semantics. <a target='_blank' + /// href='https://docs.microsoft.com/odata/concepts/queryoptions-overview'>Learn + /// more</a> <br/><i>Status</i> filter can only be used + /// with 'eq' operator. For <i>CreatedDate</i> filter, the + /// supported operators are 'gt' and 'ge'. When using both filters, combine + /// them using the logical 'AND'. + /// + /// + /// 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(int? top = default(int?), string filter = default(string), 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("top", top); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + 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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets details for a specific support ticket in an Azure subscription. + /// <br/><br/>Support ticket data is available for 12 months after + /// ticket creation. If a ticket was created more than 12 months ago, a request + /// for data might cause an error. + /// + /// + /// Support ticket name + /// + /// + /// 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 supportTicketName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (supportTicketName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "supportTicketName"); + } + 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("supportTicketName", supportTicketName); + 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}/providers/Microsoft.Support/supportTickets/{supportTicketName}").ToString(); + _url = _url.Replace("{supportTicketName}", System.Uri.EscapeDataString(supportTicketName)); + _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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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; + } + + /// + /// This API allows you to update the severity level or your contact + /// information in the support ticket. <br/><br/> Note: The + /// severity levels cannot be changed if a support ticket is actively being + /// worked upon by an Azure support engineer. In such a case, contact your + /// support engineer to request severity update by adding a new communication + /// using the Communications API. + /// + /// + /// Support ticket name + /// + /// + /// UpdateSupportTicket object + /// + /// + /// 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 supportTicketName, UpdateSupportTicket updateSupportTicket, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (supportTicketName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "supportTicketName"); + } + if (updateSupportTicket == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "updateSupportTicket"); + } + 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("supportTicketName", supportTicketName); + tracingParameters.Add("updateSupportTicket", updateSupportTicket); + 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}/providers/Microsoft.Support/supportTickets/{supportTicketName}").ToString(); + _url = _url.Replace("{supportTicketName}", System.Uri.EscapeDataString(supportTicketName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (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(updateSupportTicket != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(updateSupportTicket, 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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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; + } + + /// + /// Creates a new support ticket for Quota increase, Technical, Billing, and + /// Subscription Management issues for the specified subscription. + /// <br/><br/>A paid technical support plan is required to create a + /// support ticket using this API. <a + /// href='https://aka.ms/supportticketAPI'>Learn more</a> + /// <br/><br/> Use the Services API to map the right Service Id to + /// the issue type. For example: For billing tickets set *serviceId* to + /// *'/providers/Microsoft.Support/services/517f2da6-78fd-0498-4e22-ad26996b1dfc'*. + /// <br/> For Technical issues, the Service id will map to the Azure + /// service you want to raise a support ticket for. + /// <br/><br/>Always call the Services and ProblemClassifications + /// API to get the most recent set of services and problem categories required + /// for support ticket creation. + /// + /// + /// Support ticket name. + /// + /// + /// Support ticket request payload. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string supportTicketName, SupportTicketDetails createSupportTicketParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(supportTicketName, createSupportTicketParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new support ticket for Quota increase, Technical, Billing, and + /// Subscription Management issues for the specified subscription. + /// <br/><br/>A paid technical support plan is required to create a + /// support ticket using this API. <a + /// href='https://aka.ms/supportticketAPI'>Learn more</a> + /// <br/><br/> Use the Services API to map the right Service Id to + /// the issue type. For example: For billing tickets set *serviceId* to + /// *'/providers/Microsoft.Support/services/517f2da6-78fd-0498-4e22-ad26996b1dfc'*. + /// <br/> For Technical issues, the Service id will map to the Azure + /// service you want to raise a support ticket for. + /// <br/><br/>Always call the Services and ProblemClassifications + /// API to get the most recent set of services and problem categories required + /// for support ticket creation. + /// + /// + /// Support ticket name. + /// + /// + /// Support ticket request payload. + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string supportTicketName, SupportTicketDetails createSupportTicketParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (supportTicketName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "supportTicketName"); + } + if (createSupportTicketParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "createSupportTicketParameters"); + } + if (createSupportTicketParameters != null) + { + createSupportTicketParameters.Validate(); + } + 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("supportTicketName", supportTicketName); + tracingParameters.Add("createSupportTicketParameters", createSupportTicketParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}").ToString(); + _url = _url.Replace("{supportTicketName}", System.Uri.EscapeDataString(supportTicketName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(createSupportTicketParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(createSupportTicketParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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; + } + + /// + /// Lists all the support tickets for an Azure subscription. + /// <br/><br/>You can also filter the support tickets by + /// <i>Status</i> or <i>CreatedDate</i> using the + /// $filter parameter. Output will be a paged result with + /// <i>nextLink</i>, using which you can retrieve the next set of + /// support tickets. <br/><br/>Support ticket data is available for + /// 12 months after ticket creation. If a ticket was created more than 12 + /// months ago, a request for data might cause an error. + /// + /// + /// 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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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/support/Microsoft.Azure.Management.Support/src/Generated/SupportTicketsOperationsExtensions.cs b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/SupportTicketsOperationsExtensions.cs new file mode 100644 index 000000000000..fa19981703f5 --- /dev/null +++ b/sdk/support/Microsoft.Azure.Management.Support/src/Generated/SupportTicketsOperationsExtensions.cs @@ -0,0 +1,397 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Support +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SupportTicketsOperations. + /// + public static partial class SupportTicketsOperationsExtensions + { + /// + /// Check the availability of a resource name. This API should to be used to + /// check the uniqueness of the name for support ticket creation for the + /// selected subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Input to check. + /// + public static CheckNameAvailabilityOutput CheckNameAvailability(this ISupportTicketsOperations operations, CheckNameAvailabilityInput checkNameAvailabilityInput) + { + return operations.CheckNameAvailabilityAsync(checkNameAvailabilityInput).GetAwaiter().GetResult(); + } + + /// + /// Check the availability of a resource name. This API should to be used to + /// check the uniqueness of the name for support ticket creation for the + /// selected subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Input to check. + /// + /// + /// The cancellation token. + /// + public static async Task CheckNameAvailabilityAsync(this ISupportTicketsOperations operations, CheckNameAvailabilityInput checkNameAvailabilityInput, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(checkNameAvailabilityInput, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the support tickets for an Azure subscription. + /// <br/><br/>You can also filter the support tickets by + /// <i>Status</i> or <i>CreatedDate</i> using the + /// $filter parameter. Output will be a paged result with + /// <i>nextLink</i>, using which you can retrieve the next set of + /// support tickets. <br/><br/>Support ticket data is available for + /// 12 months after ticket creation. If a ticket was created more than 12 + /// months ago, a request for data might cause an error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The number of values to return in the collection. Default is 25 and max is + /// 100. + /// + /// + /// The filter to apply on the operation. We support 'odata v4.0' filter + /// semantics. <a target='_blank' + /// href='https://docs.microsoft.com/odata/concepts/queryoptions-overview'>Learn + /// more</a> <br/><i>Status</i> filter can only be used + /// with 'eq' operator. For <i>CreatedDate</i> filter, the + /// supported operators are 'gt' and 'ge'. When using both filters, combine + /// them using the logical 'AND'. + /// + public static IPage List(this ISupportTicketsOperations operations, int? top = default(int?), string filter = default(string)) + { + return operations.ListAsync(top, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists all the support tickets for an Azure subscription. + /// <br/><br/>You can also filter the support tickets by + /// <i>Status</i> or <i>CreatedDate</i> using the + /// $filter parameter. Output will be a paged result with + /// <i>nextLink</i>, using which you can retrieve the next set of + /// support tickets. <br/><br/>Support ticket data is available for + /// 12 months after ticket creation. If a ticket was created more than 12 + /// months ago, a request for data might cause an error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The number of values to return in the collection. Default is 25 and max is + /// 100. + /// + /// + /// The filter to apply on the operation. We support 'odata v4.0' filter + /// semantics. <a target='_blank' + /// href='https://docs.microsoft.com/odata/concepts/queryoptions-overview'>Learn + /// more</a> <br/><i>Status</i> filter can only be used + /// with 'eq' operator. For <i>CreatedDate</i> filter, the + /// supported operators are 'gt' and 'ge'. When using both filters, combine + /// them using the logical 'AND'. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISupportTicketsOperations operations, int? top = default(int?), string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(top, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets details for a specific support ticket in an Azure subscription. + /// <br/><br/>Support ticket data is available for 12 months after + /// ticket creation. If a ticket was created more than 12 months ago, a request + /// for data might cause an error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Support ticket name + /// + public static SupportTicketDetails Get(this ISupportTicketsOperations operations, string supportTicketName) + { + return operations.GetAsync(supportTicketName).GetAwaiter().GetResult(); + } + + /// + /// Gets details for a specific support ticket in an Azure subscription. + /// <br/><br/>Support ticket data is available for 12 months after + /// ticket creation. If a ticket was created more than 12 months ago, a request + /// for data might cause an error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Support ticket name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISupportTicketsOperations operations, string supportTicketName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(supportTicketName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// This API allows you to update the severity level or your contact + /// information in the support ticket. <br/><br/> Note: The + /// severity levels cannot be changed if a support ticket is actively being + /// worked upon by an Azure support engineer. In such a case, contact your + /// support engineer to request severity update by adding a new communication + /// using the Communications API. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Support ticket name + /// + /// + /// UpdateSupportTicket object + /// + public static SupportTicketDetails Update(this ISupportTicketsOperations operations, string supportTicketName, UpdateSupportTicket updateSupportTicket) + { + return operations.UpdateAsync(supportTicketName, updateSupportTicket).GetAwaiter().GetResult(); + } + + /// + /// This API allows you to update the severity level or your contact + /// information in the support ticket. <br/><br/> Note: The + /// severity levels cannot be changed if a support ticket is actively being + /// worked upon by an Azure support engineer. In such a case, contact your + /// support engineer to request severity update by adding a new communication + /// using the Communications API. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Support ticket name + /// + /// + /// UpdateSupportTicket object + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISupportTicketsOperations operations, string supportTicketName, UpdateSupportTicket updateSupportTicket, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(supportTicketName, updateSupportTicket, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a new support ticket for Quota increase, Technical, Billing, and + /// Subscription Management issues for the specified subscription. + /// <br/><br/>A paid technical support plan is required to create a + /// support ticket using this API. <a + /// href='https://aka.ms/supportticketAPI'>Learn more</a> + /// <br/><br/> Use the Services API to map the right Service Id to + /// the issue type. For example: For billing tickets set *serviceId* to + /// *'/providers/Microsoft.Support/services/517f2da6-78fd-0498-4e22-ad26996b1dfc'*. + /// <br/> For Technical issues, the Service id will map to the Azure + /// service you want to raise a support ticket for. + /// <br/><br/>Always call the Services and ProblemClassifications + /// API to get the most recent set of services and problem categories required + /// for support ticket creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Support ticket name. + /// + /// + /// Support ticket request payload. + /// + public static SupportTicketDetails Create(this ISupportTicketsOperations operations, string supportTicketName, SupportTicketDetails createSupportTicketParameters) + { + return operations.CreateAsync(supportTicketName, createSupportTicketParameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a new support ticket for Quota increase, Technical, Billing, and + /// Subscription Management issues for the specified subscription. + /// <br/><br/>A paid technical support plan is required to create a + /// support ticket using this API. <a + /// href='https://aka.ms/supportticketAPI'>Learn more</a> + /// <br/><br/> Use the Services API to map the right Service Id to + /// the issue type. For example: For billing tickets set *serviceId* to + /// *'/providers/Microsoft.Support/services/517f2da6-78fd-0498-4e22-ad26996b1dfc'*. + /// <br/> For Technical issues, the Service id will map to the Azure + /// service you want to raise a support ticket for. + /// <br/><br/>Always call the Services and ProblemClassifications + /// API to get the most recent set of services and problem categories required + /// for support ticket creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Support ticket name. + /// + /// + /// Support ticket request payload. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISupportTicketsOperations operations, string supportTicketName, SupportTicketDetails createSupportTicketParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(supportTicketName, createSupportTicketParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a new support ticket for Quota increase, Technical, Billing, and + /// Subscription Management issues for the specified subscription. + /// <br/><br/>A paid technical support plan is required to create a + /// support ticket using this API. <a + /// href='https://aka.ms/supportticketAPI'>Learn more</a> + /// <br/><br/> Use the Services API to map the right Service Id to + /// the issue type. For example: For billing tickets set *serviceId* to + /// *'/providers/Microsoft.Support/services/517f2da6-78fd-0498-4e22-ad26996b1dfc'*. + /// <br/> For Technical issues, the Service id will map to the Azure + /// service you want to raise a support ticket for. + /// <br/><br/>Always call the Services and ProblemClassifications + /// API to get the most recent set of services and problem categories required + /// for support ticket creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Support ticket name. + /// + /// + /// Support ticket request payload. + /// + public static SupportTicketDetails BeginCreate(this ISupportTicketsOperations operations, string supportTicketName, SupportTicketDetails createSupportTicketParameters) + { + return operations.BeginCreateAsync(supportTicketName, createSupportTicketParameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a new support ticket for Quota increase, Technical, Billing, and + /// Subscription Management issues for the specified subscription. + /// <br/><br/>A paid technical support plan is required to create a + /// support ticket using this API. <a + /// href='https://aka.ms/supportticketAPI'>Learn more</a> + /// <br/><br/> Use the Services API to map the right Service Id to + /// the issue type. For example: For billing tickets set *serviceId* to + /// *'/providers/Microsoft.Support/services/517f2da6-78fd-0498-4e22-ad26996b1dfc'*. + /// <br/> For Technical issues, the Service id will map to the Azure + /// service you want to raise a support ticket for. + /// <br/><br/>Always call the Services and ProblemClassifications + /// API to get the most recent set of services and problem categories required + /// for support ticket creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Support ticket name. + /// + /// + /// Support ticket request payload. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this ISupportTicketsOperations operations, string supportTicketName, SupportTicketDetails createSupportTicketParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(supportTicketName, createSupportTicketParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the support tickets for an Azure subscription. + /// <br/><br/>You can also filter the support tickets by + /// <i>Status</i> or <i>CreatedDate</i> using the + /// $filter parameter. Output will be a paged result with + /// <i>nextLink</i>, using which you can retrieve the next set of + /// support tickets. <br/><br/>Support ticket data is available for + /// 12 months after ticket creation. If a ticket was created more than 12 + /// months ago, a request for data might cause an error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISupportTicketsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the support tickets for an Azure subscription. + /// <br/><br/>You can also filter the support tickets by + /// <i>Status</i> or <i>CreatedDate</i> using the + /// $filter parameter. Output will be a paged result with + /// <i>nextLink</i>, using which you can retrieve the next set of + /// support tickets. <br/><br/>Support ticket data is available for + /// 12 months after ticket creation. If a ticket was created more than 12 + /// months ago, a request for data might cause an error. + /// + /// + /// 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 ISupportTicketsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}