diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/DicomServicesOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/DicomServicesOperations.cs new file mode 100644 index 000000000000..fc30e55391ef --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/DicomServicesOperations.cs @@ -0,0 +1,1533 @@ +// +// 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.HealthcareApis +{ + 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; + + /// + /// DicomServicesOperations operations. + /// + internal partial class DicomServicesOperations : IServiceOperations, IDicomServicesOperations + { + /// + /// Initializes a new instance of the DicomServicesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DicomServicesOperations(HealthcareApisManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the HealthcareApisManagementClient + /// + public HealthcareApisManagementClient Client { get; private set; } + + /// + /// Lists all DICOM Services for the given workspace + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspace", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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 properties of the specified DICOM Service. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dicomServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (dicomServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dicomServiceName"); + } + if (dicomServiceName != null) + { + if (dicomServiceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "dicomServiceName", 24); + } + if (dicomServiceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "dicomServiceName", 3); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("dicomServiceName", dicomServiceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{dicomServiceName}", System.Uri.EscapeDataString(dicomServiceName)); + 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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 or updates a DICOM Service resource with the specified parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The parameters for creating or updating a Dicom Service resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dicomServiceName, DicomService dicomservice, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, dicomServiceName, dicomservice, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Patch DICOM Service details. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a Dicom Service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string dicomServiceName, string workspaceName, DicomServicePatchResource dicomservicePatchResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, dicomServiceName, workspaceName, dicomservicePatchResource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a DICOM Service. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string dicomServiceName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, dicomServiceName, workspaceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates a DICOM Service resource with the specified parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The parameters for creating or updating a Dicom Service resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dicomServiceName, DicomService dicomservice, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (dicomServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dicomServiceName"); + } + if (dicomServiceName != null) + { + if (dicomServiceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "dicomServiceName", 24); + } + if (dicomServiceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "dicomServiceName", 3); + } + } + if (dicomservice == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dicomservice"); + } + if (dicomservice != null) + { + dicomservice.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("dicomServiceName", dicomServiceName); + tracingParameters.Add("dicomservice", dicomservice); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{dicomServiceName}", System.Uri.EscapeDataString(dicomServiceName)); + 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(dicomservice != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dicomservice, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Patch DICOM Service details. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a Dicom 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string dicomServiceName, string workspaceName, DicomServicePatchResource dicomservicePatchResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (dicomServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dicomServiceName"); + } + if (dicomServiceName != null) + { + if (dicomServiceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "dicomServiceName", 24); + } + if (dicomServiceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "dicomServiceName", 3); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (dicomservicePatchResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dicomservicePatchResource"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dicomServiceName", dicomServiceName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("dicomservicePatchResource", dicomservicePatchResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{dicomServiceName}", System.Uri.EscapeDataString(dicomServiceName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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(dicomservicePatchResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dicomservicePatchResource, 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a DICOM Service. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string dicomServiceName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (dicomServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dicomServiceName"); + } + if (dicomServiceName != null) + { + if (dicomServiceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "dicomServiceName", 24); + } + if (dicomServiceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "dicomServiceName", 3); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dicomServiceName", dicomServiceName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dicomServiceName}", System.Uri.EscapeDataString(dicomServiceName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all DICOM Services for the given workspace + /// + /// + /// 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>> ListByWorkspaceNextWithHttpMessagesAsync(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, "ListByWorkspaceNext", 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/DicomServicesOperationsExtensions.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/DicomServicesOperationsExtensions.cs new file mode 100644 index 000000000000..6e315d617903 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/DicomServicesOperationsExtensions.cs @@ -0,0 +1,439 @@ +// +// 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.HealthcareApis +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DicomServicesOperations. + /// + public static partial class DicomServicesOperationsExtensions + { + /// + /// Lists all DICOM Services for the given workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + public static IPage ListByWorkspace(this IDicomServicesOperations operations, string resourceGroupName, string workspaceName) + { + return operations.ListByWorkspaceAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Lists all DICOM Services for the given workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByWorkspaceAsync(this IDicomServicesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByWorkspaceWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the properties of the specified DICOM Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of DICOM Service resource. + /// + public static DicomService Get(this IDicomServicesOperations operations, string resourceGroupName, string workspaceName, string dicomServiceName) + { + return operations.GetAsync(resourceGroupName, workspaceName, dicomServiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the properties of the specified DICOM Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDicomServicesOperations operations, string resourceGroupName, string workspaceName, string dicomServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, dicomServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a DICOM Service resource with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The parameters for creating or updating a Dicom Service resource. + /// + public static DicomService CreateOrUpdate(this IDicomServicesOperations operations, string resourceGroupName, string workspaceName, string dicomServiceName, DicomService dicomservice) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, dicomServiceName, dicomservice).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a DICOM Service resource with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The parameters for creating or updating a Dicom Service resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDicomServicesOperations operations, string resourceGroupName, string workspaceName, string dicomServiceName, DicomService dicomservice, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, dicomServiceName, dicomservice, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Patch DICOM Service details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a Dicom Service. + /// + public static DicomService Update(this IDicomServicesOperations operations, string resourceGroupName, string dicomServiceName, string workspaceName, DicomServicePatchResource dicomservicePatchResource) + { + return operations.UpdateAsync(resourceGroupName, dicomServiceName, workspaceName, dicomservicePatchResource).GetAwaiter().GetResult(); + } + + /// + /// Patch DICOM Service details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a Dicom Service. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDicomServicesOperations operations, string resourceGroupName, string dicomServiceName, string workspaceName, DicomServicePatchResource dicomservicePatchResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, dicomServiceName, workspaceName, dicomservicePatchResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a DICOM Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The name of workspace resource. + /// + public static void Delete(this IDicomServicesOperations operations, string resourceGroupName, string dicomServiceName, string workspaceName) + { + operations.DeleteAsync(resourceGroupName, dicomServiceName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a DICOM Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDicomServicesOperations operations, string resourceGroupName, string dicomServiceName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, dicomServiceName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates a DICOM Service resource with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The parameters for creating or updating a Dicom Service resource. + /// + public static DicomService BeginCreateOrUpdate(this IDicomServicesOperations operations, string resourceGroupName, string workspaceName, string dicomServiceName, DicomService dicomservice) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, workspaceName, dicomServiceName, dicomservice).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a DICOM Service resource with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The parameters for creating or updating a Dicom Service resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IDicomServicesOperations operations, string resourceGroupName, string workspaceName, string dicomServiceName, DicomService dicomservice, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, dicomServiceName, dicomservice, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Patch DICOM Service details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a Dicom Service. + /// + public static DicomService BeginUpdate(this IDicomServicesOperations operations, string resourceGroupName, string dicomServiceName, string workspaceName, DicomServicePatchResource dicomservicePatchResource) + { + return operations.BeginUpdateAsync(resourceGroupName, dicomServiceName, workspaceName, dicomservicePatchResource).GetAwaiter().GetResult(); + } + + /// + /// Patch DICOM Service details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a Dicom Service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IDicomServicesOperations operations, string resourceGroupName, string dicomServiceName, string workspaceName, DicomServicePatchResource dicomservicePatchResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, dicomServiceName, workspaceName, dicomservicePatchResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a DICOM Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The name of workspace resource. + /// + public static void BeginDelete(this IDicomServicesOperations operations, string resourceGroupName, string dicomServiceName, string workspaceName) + { + operations.BeginDeleteAsync(resourceGroupName, dicomServiceName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a DICOM Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IDicomServicesOperations operations, string resourceGroupName, string dicomServiceName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, dicomServiceName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all DICOM Services for the given workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByWorkspaceNext(this IDicomServicesOperations operations, string nextPageLink) + { + return operations.ListByWorkspaceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all DICOM Services for the given workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByWorkspaceNextAsync(this IDicomServicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByWorkspaceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/FhirDestinationsOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/FhirDestinationsOperations.cs new file mode 100644 index 000000000000..e2debe293516 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/FhirDestinationsOperations.cs @@ -0,0 +1,459 @@ +// +// 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.HealthcareApis +{ + 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; + + /// + /// FhirDestinationsOperations operations. + /// + internal partial class FhirDestinationsOperations : IServiceOperations, IFhirDestinationsOperations + { + /// + /// Initializes a new instance of the FhirDestinationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal FhirDestinationsOperations(HealthcareApisManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the HealthcareApisManagementClient + /// + public HealthcareApisManagementClient Client { get; private set; } + + /// + /// Lists all FHIR destinations for the given IoT Connector + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByIotConnectorWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string iotConnectorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (iotConnectorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iotConnectorName"); + } + if (iotConnectorName != null) + { + if (iotConnectorName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "iotConnectorName", 24); + } + if (iotConnectorName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "iotConnectorName", 3); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("iotConnectorName", iotConnectorName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByIotConnector", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{iotConnectorName}", System.Uri.EscapeDataString(iotConnectorName)); + 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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 FHIR destinations for the given IoT Connector + /// + /// + /// 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>> ListByIotConnectorNextWithHttpMessagesAsync(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, "ListByIotConnectorNext", 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/FhirDestinationsOperationsExtensions.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/FhirDestinationsOperationsExtensions.cs new file mode 100644 index 000000000000..561817fb88b8 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/FhirDestinationsOperationsExtensions.cs @@ -0,0 +1,105 @@ +// +// 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.HealthcareApis +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for FhirDestinationsOperations. + /// + public static partial class FhirDestinationsOperationsExtensions + { + /// + /// Lists all FHIR destinations for the given IoT Connector + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + public static IPage ListByIotConnector(this IFhirDestinationsOperations operations, string resourceGroupName, string workspaceName, string iotConnectorName) + { + return operations.ListByIotConnectorAsync(resourceGroupName, workspaceName, iotConnectorName).GetAwaiter().GetResult(); + } + + /// + /// Lists all FHIR destinations for the given IoT Connector + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByIotConnectorAsync(this IFhirDestinationsOperations operations, string resourceGroupName, string workspaceName, string iotConnectorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByIotConnectorWithHttpMessagesAsync(resourceGroupName, workspaceName, iotConnectorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all FHIR destinations for the given IoT Connector + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByIotConnectorNext(this IFhirDestinationsOperations operations, string nextPageLink) + { + return operations.ListByIotConnectorNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all FHIR destinations for the given IoT Connector + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByIotConnectorNextAsync(this IFhirDestinationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByIotConnectorNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/FhirServicesOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/FhirServicesOperations.cs new file mode 100644 index 000000000000..f8e4108090d1 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/FhirServicesOperations.cs @@ -0,0 +1,1533 @@ +// +// 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.HealthcareApis +{ + 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; + + /// + /// FhirServicesOperations operations. + /// + internal partial class FhirServicesOperations : IServiceOperations, IFhirServicesOperations + { + /// + /// Initializes a new instance of the FhirServicesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal FhirServicesOperations(HealthcareApisManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the HealthcareApisManagementClient + /// + public HealthcareApisManagementClient Client { get; private set; } + + /// + /// Lists all FHIR Services for the given workspace + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspace", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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 properties of the specified FHIR Service. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string fhirServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (fhirServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fhirServiceName"); + } + if (fhirServiceName != null) + { + if (fhirServiceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "fhirServiceName", 24); + } + if (fhirServiceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "fhirServiceName", 3); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("fhirServiceName", fhirServiceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{fhirServiceName}", System.Uri.EscapeDataString(fhirServiceName)); + 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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 or updates a FHIR Service resource with the specified parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The parameters for creating or updating a Fhir Service resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string fhirServiceName, FhirService fhirservice, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, fhirServiceName, fhirservice, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Patch FHIR Service details. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a Fhir Service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string fhirServiceName, string workspaceName, FhirServicePatchResource fhirservicePatchResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, fhirServiceName, workspaceName, fhirservicePatchResource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a FHIR Service. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string fhirServiceName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, fhirServiceName, workspaceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates a FHIR Service resource with the specified parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The parameters for creating or updating a Fhir Service resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string fhirServiceName, FhirService fhirservice, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (fhirServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fhirServiceName"); + } + if (fhirServiceName != null) + { + if (fhirServiceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "fhirServiceName", 24); + } + if (fhirServiceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "fhirServiceName", 3); + } + } + if (fhirservice == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fhirservice"); + } + if (fhirservice != null) + { + fhirservice.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("fhirServiceName", fhirServiceName); + tracingParameters.Add("fhirservice", fhirservice); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{fhirServiceName}", System.Uri.EscapeDataString(fhirServiceName)); + 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(fhirservice != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(fhirservice, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Patch FHIR Service details. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a Fhir 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string fhirServiceName, string workspaceName, FhirServicePatchResource fhirservicePatchResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (fhirServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fhirServiceName"); + } + if (fhirServiceName != null) + { + if (fhirServiceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "fhirServiceName", 24); + } + if (fhirServiceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "fhirServiceName", 3); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (fhirservicePatchResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fhirservicePatchResource"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("fhirServiceName", fhirServiceName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("fhirservicePatchResource", fhirservicePatchResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{fhirServiceName}", System.Uri.EscapeDataString(fhirServiceName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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(fhirservicePatchResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(fhirservicePatchResource, 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a FHIR Service. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string fhirServiceName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (fhirServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fhirServiceName"); + } + if (fhirServiceName != null) + { + if (fhirServiceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "fhirServiceName", 24); + } + if (fhirServiceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "fhirServiceName", 3); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("fhirServiceName", fhirServiceName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{fhirServiceName}", System.Uri.EscapeDataString(fhirServiceName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all FHIR Services for the given workspace + /// + /// + /// 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>> ListByWorkspaceNextWithHttpMessagesAsync(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, "ListByWorkspaceNext", 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/FhirServicesOperationsExtensions.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/FhirServicesOperationsExtensions.cs new file mode 100644 index 000000000000..e968c42608a3 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/FhirServicesOperationsExtensions.cs @@ -0,0 +1,439 @@ +// +// 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.HealthcareApis +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for FhirServicesOperations. + /// + public static partial class FhirServicesOperationsExtensions + { + /// + /// Lists all FHIR Services for the given workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + public static IPage ListByWorkspace(this IFhirServicesOperations operations, string resourceGroupName, string workspaceName) + { + return operations.ListByWorkspaceAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Lists all FHIR Services for the given workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByWorkspaceAsync(this IFhirServicesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByWorkspaceWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the properties of the specified FHIR Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of FHIR Service resource. + /// + public static FhirService Get(this IFhirServicesOperations operations, string resourceGroupName, string workspaceName, string fhirServiceName) + { + return operations.GetAsync(resourceGroupName, workspaceName, fhirServiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the properties of the specified FHIR Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IFhirServicesOperations operations, string resourceGroupName, string workspaceName, string fhirServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, fhirServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a FHIR Service resource with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The parameters for creating or updating a Fhir Service resource. + /// + public static FhirService CreateOrUpdate(this IFhirServicesOperations operations, string resourceGroupName, string workspaceName, string fhirServiceName, FhirService fhirservice) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, fhirServiceName, fhirservice).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a FHIR Service resource with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The parameters for creating or updating a Fhir Service resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IFhirServicesOperations operations, string resourceGroupName, string workspaceName, string fhirServiceName, FhirService fhirservice, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, fhirServiceName, fhirservice, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Patch FHIR Service details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a Fhir Service. + /// + public static FhirService Update(this IFhirServicesOperations operations, string resourceGroupName, string fhirServiceName, string workspaceName, FhirServicePatchResource fhirservicePatchResource) + { + return operations.UpdateAsync(resourceGroupName, fhirServiceName, workspaceName, fhirservicePatchResource).GetAwaiter().GetResult(); + } + + /// + /// Patch FHIR Service details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a Fhir Service. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IFhirServicesOperations operations, string resourceGroupName, string fhirServiceName, string workspaceName, FhirServicePatchResource fhirservicePatchResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, fhirServiceName, workspaceName, fhirservicePatchResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a FHIR Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The name of workspace resource. + /// + public static void Delete(this IFhirServicesOperations operations, string resourceGroupName, string fhirServiceName, string workspaceName) + { + operations.DeleteAsync(resourceGroupName, fhirServiceName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a FHIR Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IFhirServicesOperations operations, string resourceGroupName, string fhirServiceName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, fhirServiceName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates a FHIR Service resource with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The parameters for creating or updating a Fhir Service resource. + /// + public static FhirService BeginCreateOrUpdate(this IFhirServicesOperations operations, string resourceGroupName, string workspaceName, string fhirServiceName, FhirService fhirservice) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, workspaceName, fhirServiceName, fhirservice).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a FHIR Service resource with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The parameters for creating or updating a Fhir Service resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IFhirServicesOperations operations, string resourceGroupName, string workspaceName, string fhirServiceName, FhirService fhirservice, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, fhirServiceName, fhirservice, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Patch FHIR Service details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a Fhir Service. + /// + public static FhirService BeginUpdate(this IFhirServicesOperations operations, string resourceGroupName, string fhirServiceName, string workspaceName, FhirServicePatchResource fhirservicePatchResource) + { + return operations.BeginUpdateAsync(resourceGroupName, fhirServiceName, workspaceName, fhirservicePatchResource).GetAwaiter().GetResult(); + } + + /// + /// Patch FHIR Service details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a Fhir Service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IFhirServicesOperations operations, string resourceGroupName, string fhirServiceName, string workspaceName, FhirServicePatchResource fhirservicePatchResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, fhirServiceName, workspaceName, fhirservicePatchResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a FHIR Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The name of workspace resource. + /// + public static void BeginDelete(this IFhirServicesOperations operations, string resourceGroupName, string fhirServiceName, string workspaceName) + { + operations.BeginDeleteAsync(resourceGroupName, fhirServiceName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a FHIR Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IFhirServicesOperations operations, string resourceGroupName, string fhirServiceName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, fhirServiceName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all FHIR Services for the given workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByWorkspaceNext(this IFhirServicesOperations operations, string nextPageLink) + { + return operations.ListByWorkspaceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all FHIR Services for the given workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByWorkspaceNextAsync(this IFhirServicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByWorkspaceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/HealthcareApisManagementClient.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/HealthcareApisManagementClient.cs index 810198cb5de2..c86105c37167 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/HealthcareApisManagementClient.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/HealthcareApisManagementClient.cs @@ -56,6 +56,11 @@ public partial class HealthcareApisManagementClient : ServiceClient public string ApiVersion { get; private set; } + /// + /// Client Api Version. + /// + public string ApiVersion1 { get; set; } + /// /// The preferred language for the response. /// @@ -80,24 +85,64 @@ public partial class HealthcareApisManagementClient : ServiceClient - /// Gets the IOperations. + /// Gets the IPrivateEndpointConnectionsOperations. /// - public virtual IOperations Operations { get; private set; } + public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } /// - /// Gets the IOperationResultsOperations. + /// Gets the IPrivateLinkResourcesOperations. /// - public virtual IOperationResultsOperations OperationResults { get; private set; } + public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } /// - /// Gets the IPrivateEndpointConnectionsOperations. + /// Gets the IWorkspacesOperations. /// - public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } + public virtual IWorkspacesOperations Workspaces { get; private set; } /// - /// Gets the IPrivateLinkResourcesOperations. + /// Gets the IDicomServicesOperations. /// - public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } + public virtual IDicomServicesOperations DicomServices { get; private set; } + + /// + /// Gets the IIotConnectorsOperations. + /// + public virtual IIotConnectorsOperations IotConnectors { get; private set; } + + /// + /// Gets the IFhirDestinationsOperations. + /// + public virtual IFhirDestinationsOperations FhirDestinations { get; private set; } + + /// + /// Gets the IIotConnectorFhirDestinationOperations. + /// + public virtual IIotConnectorFhirDestinationOperations IotConnectorFhirDestination { get; private set; } + + /// + /// Gets the IFhirServicesOperations. + /// + public virtual IFhirServicesOperations FhirServices { get; private set; } + + /// + /// Gets the IWorkspacePrivateEndpointConnectionsOperations. + /// + public virtual IWorkspacePrivateEndpointConnectionsOperations WorkspacePrivateEndpointConnections { get; private set; } + + /// + /// Gets the IWorkspacePrivateLinkResourcesOperations. + /// + public virtual IWorkspacePrivateLinkResourcesOperations WorkspacePrivateLinkResources { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the IOperationResultsOperations. + /// + public virtual IOperationResultsOperations OperationResults { get; private set; } /// /// Initializes a new instance of the HealthcareApisManagementClient class. @@ -341,12 +386,20 @@ public HealthcareApisManagementClient(System.Uri baseUri, ServiceClientCredentia private void Initialize() { Services = new ServicesOperations(this); - Operations = new Operations(this); - OperationResults = new OperationResultsOperations(this); PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); PrivateLinkResources = new PrivateLinkResourcesOperations(this); + Workspaces = new WorkspacesOperations(this); + DicomServices = new DicomServicesOperations(this); + IotConnectors = new IotConnectorsOperations(this); + FhirDestinations = new FhirDestinationsOperations(this); + IotConnectorFhirDestination = new IotConnectorFhirDestinationOperations(this); + FhirServices = new FhirServicesOperations(this); + WorkspacePrivateEndpointConnections = new WorkspacePrivateEndpointConnectionsOperations(this); + WorkspacePrivateLinkResources = new WorkspacePrivateLinkResourcesOperations(this); + Operations = new Operations(this); + OperationResults = new OperationResultsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2020-03-30"; + ApiVersion = "2021-11-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IDicomServicesOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IDicomServicesOperations.cs new file mode 100644 index 000000000000..bab472a807a1 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IDicomServicesOperations.cs @@ -0,0 +1,278 @@ +// +// 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.HealthcareApis +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DicomServicesOperations operations. + /// + public partial interface IDicomServicesOperations + { + /// + /// Lists all DICOM Services for the given workspace + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the properties of the specified DICOM Service. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dicomServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a DICOM Service resource with the specified + /// parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The parameters for creating or updating a Dicom Service resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dicomServiceName, DicomService dicomservice, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Patch DICOM Service details. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a Dicom 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string dicomServiceName, string workspaceName, DicomServicePatchResource dicomservicePatchResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a DICOM Service. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string dicomServiceName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a DICOM Service resource with the specified + /// parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The parameters for creating or updating a Dicom Service resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dicomServiceName, DicomService dicomservice, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Patch DICOM Service details. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a Dicom 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string dicomServiceName, string workspaceName, DicomServicePatchResource dicomservicePatchResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a DICOM Service. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of DICOM Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string dicomServiceName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all DICOM Services for the given workspace + /// + /// + /// 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>> ListByWorkspaceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IFhirDestinationsOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IFhirDestinationsOperations.cs new file mode 100644 index 000000000000..8338161e57ac --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IFhirDestinationsOperations.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.HealthcareApis +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// FhirDestinationsOperations operations. + /// + public partial interface IFhirDestinationsOperations + { + /// + /// Lists all FHIR destinations for the given IoT Connector + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByIotConnectorWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string iotConnectorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all FHIR destinations for the given IoT Connector + /// + /// + /// 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>> ListByIotConnectorNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IFhirServicesOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IFhirServicesOperations.cs new file mode 100644 index 000000000000..b1d124e59602 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IFhirServicesOperations.cs @@ -0,0 +1,278 @@ +// +// 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.HealthcareApis +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// FhirServicesOperations operations. + /// + public partial interface IFhirServicesOperations + { + /// + /// Lists all FHIR Services for the given workspace + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the properties of the specified FHIR Service. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string fhirServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a FHIR Service resource with the specified + /// parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The parameters for creating or updating a Fhir Service resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string fhirServiceName, FhirService fhirservice, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Patch FHIR Service details. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a Fhir 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string fhirServiceName, string workspaceName, FhirServicePatchResource fhirservicePatchResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a FHIR Service. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string fhirServiceName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a FHIR Service resource with the specified + /// parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The parameters for creating or updating a Fhir Service resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string fhirServiceName, FhirService fhirservice, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Patch FHIR Service details. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a Fhir 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string fhirServiceName, string workspaceName, FhirServicePatchResource fhirservicePatchResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a FHIR Service. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of FHIR Service resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string fhirServiceName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all FHIR Services for the given workspace + /// + /// + /// 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>> ListByWorkspaceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IHealthcareApisManagementClient.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IHealthcareApisManagementClient.cs index 49344e08b98d..0ccd850e59aa 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IHealthcareApisManagementClient.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IHealthcareApisManagementClient.cs @@ -50,6 +50,11 @@ public partial interface IHealthcareApisManagementClient : System.IDisposable /// string ApiVersion { get; } + /// + /// Client Api Version. + /// + string ApiVersion1 { get; set; } + /// /// The preferred language for the response. /// @@ -75,24 +80,64 @@ public partial interface IHealthcareApisManagementClient : System.IDisposable IServicesOperations Services { get; } /// - /// Gets the IOperations. + /// Gets the IPrivateEndpointConnectionsOperations. /// - IOperations Operations { get; } + IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } /// - /// Gets the IOperationResultsOperations. + /// Gets the IPrivateLinkResourcesOperations. /// - IOperationResultsOperations OperationResults { get; } + IPrivateLinkResourcesOperations PrivateLinkResources { get; } /// - /// Gets the IPrivateEndpointConnectionsOperations. + /// Gets the IWorkspacesOperations. /// - IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } + IWorkspacesOperations Workspaces { get; } /// - /// Gets the IPrivateLinkResourcesOperations. + /// Gets the IDicomServicesOperations. /// - IPrivateLinkResourcesOperations PrivateLinkResources { get; } + IDicomServicesOperations DicomServices { get; } + + /// + /// Gets the IIotConnectorsOperations. + /// + IIotConnectorsOperations IotConnectors { get; } + + /// + /// Gets the IFhirDestinationsOperations. + /// + IFhirDestinationsOperations FhirDestinations { get; } + + /// + /// Gets the IIotConnectorFhirDestinationOperations. + /// + IIotConnectorFhirDestinationOperations IotConnectorFhirDestination { get; } + + /// + /// Gets the IFhirServicesOperations. + /// + IFhirServicesOperations FhirServices { get; } + + /// + /// Gets the IWorkspacePrivateEndpointConnectionsOperations. + /// + IWorkspacePrivateEndpointConnectionsOperations WorkspacePrivateEndpointConnections { get; } + + /// + /// Gets the IWorkspacePrivateLinkResourcesOperations. + /// + IWorkspacePrivateLinkResourcesOperations WorkspacePrivateLinkResources { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the IOperationResultsOperations. + /// + IOperationResultsOperations OperationResults { get; } } } diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IIotConnectorFhirDestinationOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IIotConnectorFhirDestinationOperations.cs new file mode 100644 index 000000000000..e7410e6593e4 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IIotConnectorFhirDestinationOperations.cs @@ -0,0 +1,187 @@ +// +// 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.HealthcareApis +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// IotConnectorFhirDestinationOperations operations. + /// + public partial interface IIotConnectorFhirDestinationOperations + { + /// + /// Gets the properties of the specified Iot Connector FHIR + /// destination. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates an IoT Connector FHIR destination resource with + /// the specified parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + /// + /// The parameters for creating or updating an IoT Connector FHIR + /// destination resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName, IotFhirDestination iotFhirDestination, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an IoT Connector FHIR destination. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates an IoT Connector FHIR destination resource with + /// the specified parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + /// + /// The parameters for creating or updating an IoT Connector FHIR + /// destination resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName, IotFhirDestination iotFhirDestination, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an IoT Connector FHIR destination. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IIotConnectorsOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IIotConnectorsOperations.cs new file mode 100644 index 000000000000..ba857554cb9e --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IIotConnectorsOperations.cs @@ -0,0 +1,278 @@ +// +// 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.HealthcareApis +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// IotConnectorsOperations operations. + /// + public partial interface IIotConnectorsOperations + { + /// + /// Lists all IoT Connectors for the given workspace + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the properties of the specified IoT Connector. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string iotConnectorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates an IoT Connector resource with the specified + /// parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The parameters for creating or updating an IoT Connectors resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string iotConnectorName, IotConnector iotConnector, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Patch an IoT Connector. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating an IoT Connector. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string iotConnectorName, string workspaceName, IotConnectorPatchResource iotConnectorPatchResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an IoT Connector. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string iotConnectorName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates an IoT Connector resource with the specified + /// parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The parameters for creating or updating an IoT Connectors resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string iotConnectorName, IotConnector iotConnector, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Patch an IoT Connector. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating an IoT Connector. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string iotConnectorName, string workspaceName, IotConnectorPatchResource iotConnectorPatchResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an IoT Connector. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string iotConnectorName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all IoT Connectors for the given workspace + /// + /// + /// 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>> ListByWorkspaceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IOperationResultsOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IOperationResultsOperations.cs index 072d94dbbe93..1709669cb761 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IOperationResultsOperations.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IOperationResultsOperations.cs @@ -47,6 +47,6 @@ public partial interface IOperationResultsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string locationName, string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string locationName, string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IOperations.cs index ee1d8175ac68..bd43f76accdc 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IOperations.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IOperations.cs @@ -24,7 +24,8 @@ namespace Microsoft.Azure.Management.HealthcareApis public partial interface IOperations { /// - /// Lists all of the available Healthcare service REST API operations. + /// Lists all of the available operations supported by Microsoft + /// Healthcare resource provider. /// /// /// The headers that will be added to request. @@ -41,9 +42,10 @@ public partial interface IOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Lists all of the available Healthcare service REST API operations. + /// Lists all of the available operations supported by Microsoft + /// Healthcare resource provider. /// /// /// The NextLink from the previous successful call to List operation. @@ -63,6 +65,6 @@ public partial interface IOperations /// /// Thrown when a required parameter is null /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IPrivateEndpointConnectionsOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IPrivateEndpointConnectionsOperations.cs index cd1799395bcf..5353386a44df 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IPrivateEndpointConnectionsOperations.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IPrivateEndpointConnectionsOperations.cs @@ -47,7 +47,7 @@ public partial interface IPrivateEndpointConnectionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the specified private endpoint connection associated with the /// service. @@ -77,7 +77,7 @@ public partial interface IPrivateEndpointConnectionsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Update the state of the specified private endpoint connection /// associated with the service. @@ -110,7 +110,7 @@ public partial interface IPrivateEndpointConnectionsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a private endpoint connection. /// @@ -169,7 +169,7 @@ public partial interface IPrivateEndpointConnectionsOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a private endpoint connection. /// diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IPrivateLinkResourcesOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IPrivateLinkResourcesOperations.cs index 2c212bec22ab..2ed80818e6e8 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IPrivateLinkResourcesOperations.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IPrivateLinkResourcesOperations.cs @@ -10,8 +10,10 @@ namespace Microsoft.Azure.Management.HealthcareApis { + using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; + using System.Collections; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -46,7 +48,7 @@ public partial interface IPrivateLinkResourcesOperations /// /// Thrown when a required parameter is null /// - Task> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a private link resource that need to be created for a service. /// @@ -74,6 +76,6 @@ public partial interface IPrivateLinkResourcesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IWorkspacePrivateEndpointConnectionsOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IWorkspacePrivateEndpointConnectionsOperations.cs new file mode 100644 index 000000000000..7b40ee6616ab --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IWorkspacePrivateEndpointConnectionsOperations.cs @@ -0,0 +1,200 @@ +// +// 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.HealthcareApis +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WorkspacePrivateEndpointConnectionsOperations operations. + /// + public partial interface IWorkspacePrivateEndpointConnectionsOperations + { + /// + /// Lists all private endpoint connections for a workspace. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the specified private endpoint connection associated with the + /// workspace. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the + /// Azure resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the state of the specified private endpoint connection + /// associated with the workspace. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the + /// Azure resource + /// + /// + /// The private endpoint connection properties. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string privateEndpointConnectionName, PrivateEndpointConnectionDescription properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a private endpoint connection. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the + /// Azure resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the state of the specified private endpoint connection + /// associated with the workspace. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the + /// Azure resource + /// + /// + /// The private endpoint connection properties. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string privateEndpointConnectionName, PrivateEndpointConnectionDescription properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a private endpoint connection. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the + /// Azure resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IWorkspacePrivateLinkResourcesOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IWorkspacePrivateLinkResourcesOperations.cs new file mode 100644 index 000000000000..9b772566a9f8 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IWorkspacePrivateLinkResourcesOperations.cs @@ -0,0 +1,82 @@ +// +// 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.HealthcareApis +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WorkspacePrivateLinkResourcesOperations operations. + /// + public partial interface IWorkspacePrivateLinkResourcesOperations + { + /// + /// Gets the private link resources that need to be created for a + /// workspace. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a private link resource that need to be created for a + /// workspace. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private link resource group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IWorkspacesOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IWorkspacesOperations.cs new file mode 100644 index 000000000000..a83d63abc487 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IWorkspacesOperations.cs @@ -0,0 +1,299 @@ +// +// 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.HealthcareApis +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WorkspacesOperations operations. + /// + public partial interface IWorkspacesOperations + { + /// + /// Lists all the available workspaces under the specified + /// subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the available workspaces under the specified resource + /// group. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the properties of the specified workspace. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a workspace resource with the specified + /// parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for creating or updating a healthcare workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace workspace, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Patch workspace details. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a specified workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, WorkspacePatchResource workspacePatchResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a specified workspace. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a workspace resource with the specified + /// parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for creating or updating a healthcare workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace workspace, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Patch workspace details. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a specified workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, WorkspacePatchResource workspacePatchResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a specified workspace. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the available workspaces under the specified + /// subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the available workspaces under the specified resource + /// group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IotConnectorFhirDestinationOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IotConnectorFhirDestinationOperations.cs new file mode 100644 index 000000000000..9c92c7dc050b --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IotConnectorFhirDestinationOperations.cs @@ -0,0 +1,921 @@ +// +// 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.HealthcareApis +{ + 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; + + /// + /// IotConnectorFhirDestinationOperations operations. + /// + internal partial class IotConnectorFhirDestinationOperations : IServiceOperations, IIotConnectorFhirDestinationOperations + { + /// + /// Initializes a new instance of the IotConnectorFhirDestinationOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal IotConnectorFhirDestinationOperations(HealthcareApisManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the HealthcareApisManagementClient + /// + public HealthcareApisManagementClient Client { get; private set; } + + /// + /// Gets the properties of the specified Iot Connector FHIR destination. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (iotConnectorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iotConnectorName"); + } + if (iotConnectorName != null) + { + if (iotConnectorName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "iotConnectorName", 24); + } + if (iotConnectorName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "iotConnectorName", 3); + } + } + if (fhirDestinationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fhirDestinationName"); + } + if (fhirDestinationName != null) + { + if (fhirDestinationName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "fhirDestinationName", 24); + } + if (fhirDestinationName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "fhirDestinationName", 3); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("iotConnectorName", iotConnectorName); + tracingParameters.Add("fhirDestinationName", fhirDestinationName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{iotConnectorName}", System.Uri.EscapeDataString(iotConnectorName)); + _url = _url.Replace("{fhirDestinationName}", System.Uri.EscapeDataString(fhirDestinationName)); + 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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 or updates an IoT Connector FHIR destination resource with the + /// specified parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + /// + /// The parameters for creating or updating an IoT Connector FHIR destination + /// resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName, IotFhirDestination iotFhirDestination, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, iotConnectorName, fhirDestinationName, iotFhirDestination, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an IoT Connector FHIR destination. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, iotConnectorName, fhirDestinationName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates an IoT Connector FHIR destination resource with the + /// specified parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + /// + /// The parameters for creating or updating an IoT Connector FHIR destination + /// resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName, IotFhirDestination iotFhirDestination, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (iotConnectorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iotConnectorName"); + } + if (iotConnectorName != null) + { + if (iotConnectorName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "iotConnectorName", 24); + } + if (iotConnectorName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "iotConnectorName", 3); + } + } + if (fhirDestinationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fhirDestinationName"); + } + if (fhirDestinationName != null) + { + if (fhirDestinationName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "fhirDestinationName", 24); + } + if (fhirDestinationName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "fhirDestinationName", 3); + } + } + if (iotFhirDestination == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iotFhirDestination"); + } + if (iotFhirDestination != null) + { + iotFhirDestination.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("iotConnectorName", iotConnectorName); + tracingParameters.Add("fhirDestinationName", fhirDestinationName); + tracingParameters.Add("iotFhirDestination", iotFhirDestination); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{iotConnectorName}", System.Uri.EscapeDataString(iotConnectorName)); + _url = _url.Replace("{fhirDestinationName}", System.Uri.EscapeDataString(fhirDestinationName)); + 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(iotFhirDestination != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(iotFhirDestination, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes an IoT Connector FHIR destination. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (iotConnectorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iotConnectorName"); + } + if (iotConnectorName != null) + { + if (iotConnectorName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "iotConnectorName", 24); + } + if (iotConnectorName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "iotConnectorName", 3); + } + } + if (fhirDestinationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fhirDestinationName"); + } + if (fhirDestinationName != null) + { + if (fhirDestinationName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "fhirDestinationName", 24); + } + if (fhirDestinationName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "fhirDestinationName", 3); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("iotConnectorName", iotConnectorName); + tracingParameters.Add("fhirDestinationName", fhirDestinationName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{iotConnectorName}", System.Uri.EscapeDataString(iotConnectorName)); + _url = _url.Replace("{fhirDestinationName}", System.Uri.EscapeDataString(fhirDestinationName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IotConnectorFhirDestinationOperationsExtensions.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IotConnectorFhirDestinationOperationsExtensions.cs new file mode 100644 index 000000000000..6f97733b380b --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IotConnectorFhirDestinationOperationsExtensions.cs @@ -0,0 +1,299 @@ +// +// 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.HealthcareApis +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for IotConnectorFhirDestinationOperations. + /// + public static partial class IotConnectorFhirDestinationOperationsExtensions + { + /// + /// Gets the properties of the specified Iot Connector FHIR destination. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + public static IotFhirDestination Get(this IIotConnectorFhirDestinationOperations operations, string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName) + { + return operations.GetAsync(resourceGroupName, workspaceName, iotConnectorName, fhirDestinationName).GetAwaiter().GetResult(); + } + + /// + /// Gets the properties of the specified Iot Connector FHIR destination. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IIotConnectorFhirDestinationOperations operations, string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, iotConnectorName, fhirDestinationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates an IoT Connector FHIR destination resource with the + /// specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + /// + /// The parameters for creating or updating an IoT Connector FHIR destination + /// resource. + /// + public static IotFhirDestination CreateOrUpdate(this IIotConnectorFhirDestinationOperations operations, string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName, IotFhirDestination iotFhirDestination) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, iotConnectorName, fhirDestinationName, iotFhirDestination).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an IoT Connector FHIR destination resource with the + /// specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + /// + /// The parameters for creating or updating an IoT Connector FHIR destination + /// resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IIotConnectorFhirDestinationOperations operations, string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName, IotFhirDestination iotFhirDestination, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, iotConnectorName, fhirDestinationName, iotFhirDestination, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an IoT Connector FHIR destination. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + public static void Delete(this IIotConnectorFhirDestinationOperations operations, string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName) + { + operations.DeleteAsync(resourceGroupName, workspaceName, iotConnectorName, fhirDestinationName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an IoT Connector FHIR destination. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IIotConnectorFhirDestinationOperations operations, string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, iotConnectorName, fhirDestinationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates an IoT Connector FHIR destination resource with the + /// specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + /// + /// The parameters for creating or updating an IoT Connector FHIR destination + /// resource. + /// + public static IotFhirDestination BeginCreateOrUpdate(this IIotConnectorFhirDestinationOperations operations, string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName, IotFhirDestination iotFhirDestination) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, workspaceName, iotConnectorName, fhirDestinationName, iotFhirDestination).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an IoT Connector FHIR destination resource with the + /// specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + /// + /// The parameters for creating or updating an IoT Connector FHIR destination + /// resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IIotConnectorFhirDestinationOperations operations, string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName, IotFhirDestination iotFhirDestination, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, iotConnectorName, fhirDestinationName, iotFhirDestination, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an IoT Connector FHIR destination. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + public static void BeginDelete(this IIotConnectorFhirDestinationOperations operations, string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName) + { + operations.BeginDeleteAsync(resourceGroupName, workspaceName, iotConnectorName, fhirDestinationName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an IoT Connector FHIR destination. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of IoT Connector FHIR destination resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IIotConnectorFhirDestinationOperations operations, string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, iotConnectorName, fhirDestinationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IotConnectorsOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IotConnectorsOperations.cs new file mode 100644 index 000000000000..eb121e9e3208 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IotConnectorsOperations.cs @@ -0,0 +1,1533 @@ +// +// 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.HealthcareApis +{ + 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; + + /// + /// IotConnectorsOperations operations. + /// + internal partial class IotConnectorsOperations : IServiceOperations, IIotConnectorsOperations + { + /// + /// Initializes a new instance of the IotConnectorsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal IotConnectorsOperations(HealthcareApisManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the HealthcareApisManagementClient + /// + public HealthcareApisManagementClient Client { get; private set; } + + /// + /// Lists all IoT Connectors for the given workspace + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspace", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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 properties of the specified IoT Connector. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string iotConnectorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (iotConnectorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iotConnectorName"); + } + if (iotConnectorName != null) + { + if (iotConnectorName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "iotConnectorName", 24); + } + if (iotConnectorName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "iotConnectorName", 3); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("iotConnectorName", iotConnectorName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{iotConnectorName}", System.Uri.EscapeDataString(iotConnectorName)); + 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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 or updates an IoT Connector resource with the specified parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The parameters for creating or updating an IoT Connectors resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string iotConnectorName, IotConnector iotConnector, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, iotConnectorName, iotConnector, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Patch an IoT Connector. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating an IoT Connector. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string iotConnectorName, string workspaceName, IotConnectorPatchResource iotConnectorPatchResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, iotConnectorName, workspaceName, iotConnectorPatchResource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an IoT Connector. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string iotConnectorName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, iotConnectorName, workspaceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates an IoT Connector resource with the specified parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The parameters for creating or updating an IoT Connectors resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string iotConnectorName, IotConnector iotConnector, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (iotConnectorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iotConnectorName"); + } + if (iotConnectorName != null) + { + if (iotConnectorName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "iotConnectorName", 24); + } + if (iotConnectorName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "iotConnectorName", 3); + } + } + if (iotConnector == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iotConnector"); + } + if (iotConnector != null) + { + iotConnector.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("iotConnectorName", iotConnectorName); + tracingParameters.Add("iotConnector", iotConnector); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{iotConnectorName}", System.Uri.EscapeDataString(iotConnectorName)); + 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(iotConnector != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(iotConnector, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Patch an IoT Connector. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating an IoT Connector. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string iotConnectorName, string workspaceName, IotConnectorPatchResource iotConnectorPatchResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (iotConnectorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iotConnectorName"); + } + if (iotConnectorName != null) + { + if (iotConnectorName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "iotConnectorName", 24); + } + if (iotConnectorName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "iotConnectorName", 3); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (iotConnectorPatchResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iotConnectorPatchResource"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("iotConnectorName", iotConnectorName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("iotConnectorPatchResource", iotConnectorPatchResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{iotConnectorName}", System.Uri.EscapeDataString(iotConnectorName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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(iotConnectorPatchResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(iotConnectorPatchResource, 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes an IoT Connector. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string iotConnectorName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (iotConnectorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iotConnectorName"); + } + if (iotConnectorName != null) + { + if (iotConnectorName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "iotConnectorName", 24); + } + if (iotConnectorName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "iotConnectorName", 3); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("iotConnectorName", iotConnectorName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{iotConnectorName}", System.Uri.EscapeDataString(iotConnectorName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all IoT Connectors for the given workspace + /// + /// + /// 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>> ListByWorkspaceNextWithHttpMessagesAsync(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, "ListByWorkspaceNext", 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IotConnectorsOperationsExtensions.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IotConnectorsOperationsExtensions.cs new file mode 100644 index 000000000000..0a9f82670c8f --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IotConnectorsOperationsExtensions.cs @@ -0,0 +1,439 @@ +// +// 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.HealthcareApis +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for IotConnectorsOperations. + /// + public static partial class IotConnectorsOperationsExtensions + { + /// + /// Lists all IoT Connectors for the given workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + public static IPage ListByWorkspace(this IIotConnectorsOperations operations, string resourceGroupName, string workspaceName) + { + return operations.ListByWorkspaceAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Lists all IoT Connectors for the given workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByWorkspaceAsync(this IIotConnectorsOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByWorkspaceWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the properties of the specified IoT Connector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + public static IotConnector Get(this IIotConnectorsOperations operations, string resourceGroupName, string workspaceName, string iotConnectorName) + { + return operations.GetAsync(resourceGroupName, workspaceName, iotConnectorName).GetAwaiter().GetResult(); + } + + /// + /// Gets the properties of the specified IoT Connector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IIotConnectorsOperations operations, string resourceGroupName, string workspaceName, string iotConnectorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, iotConnectorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates an IoT Connector resource with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The parameters for creating or updating an IoT Connectors resource. + /// + public static IotConnector CreateOrUpdate(this IIotConnectorsOperations operations, string resourceGroupName, string workspaceName, string iotConnectorName, IotConnector iotConnector) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, iotConnectorName, iotConnector).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an IoT Connector resource with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The parameters for creating or updating an IoT Connectors resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IIotConnectorsOperations operations, string resourceGroupName, string workspaceName, string iotConnectorName, IotConnector iotConnector, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, iotConnectorName, iotConnector, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Patch an IoT Connector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating an IoT Connector. + /// + public static IotConnector Update(this IIotConnectorsOperations operations, string resourceGroupName, string iotConnectorName, string workspaceName, IotConnectorPatchResource iotConnectorPatchResource) + { + return operations.UpdateAsync(resourceGroupName, iotConnectorName, workspaceName, iotConnectorPatchResource).GetAwaiter().GetResult(); + } + + /// + /// Patch an IoT Connector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating an IoT Connector. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IIotConnectorsOperations operations, string resourceGroupName, string iotConnectorName, string workspaceName, IotConnectorPatchResource iotConnectorPatchResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, iotConnectorName, workspaceName, iotConnectorPatchResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an IoT Connector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of workspace resource. + /// + public static void Delete(this IIotConnectorsOperations operations, string resourceGroupName, string iotConnectorName, string workspaceName) + { + operations.DeleteAsync(resourceGroupName, iotConnectorName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an IoT Connector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IIotConnectorsOperations operations, string resourceGroupName, string iotConnectorName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, iotConnectorName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates an IoT Connector resource with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The parameters for creating or updating an IoT Connectors resource. + /// + public static IotConnector BeginCreateOrUpdate(this IIotConnectorsOperations operations, string resourceGroupName, string workspaceName, string iotConnectorName, IotConnector iotConnector) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, workspaceName, iotConnectorName, iotConnector).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an IoT Connector resource with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The parameters for creating or updating an IoT Connectors resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IIotConnectorsOperations operations, string resourceGroupName, string workspaceName, string iotConnectorName, IotConnector iotConnector, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, iotConnectorName, iotConnector, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Patch an IoT Connector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating an IoT Connector. + /// + public static IotConnector BeginUpdate(this IIotConnectorsOperations operations, string resourceGroupName, string iotConnectorName, string workspaceName, IotConnectorPatchResource iotConnectorPatchResource) + { + return operations.BeginUpdateAsync(resourceGroupName, iotConnectorName, workspaceName, iotConnectorPatchResource).GetAwaiter().GetResult(); + } + + /// + /// Patch an IoT Connector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating an IoT Connector. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IIotConnectorsOperations operations, string resourceGroupName, string iotConnectorName, string workspaceName, IotConnectorPatchResource iotConnectorPatchResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, iotConnectorName, workspaceName, iotConnectorPatchResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an IoT Connector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of workspace resource. + /// + public static void BeginDelete(this IIotConnectorsOperations operations, string resourceGroupName, string iotConnectorName, string workspaceName) + { + operations.BeginDeleteAsync(resourceGroupName, iotConnectorName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an IoT Connector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of IoT Connector resource. + /// + /// + /// The name of workspace resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IIotConnectorsOperations operations, string resourceGroupName, string iotConnectorName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, iotConnectorName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all IoT Connectors for the given workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByWorkspaceNext(this IIotConnectorsOperations operations, string nextPageLink) + { + return operations.ListByWorkspaceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all IoT Connectors for the given workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByWorkspaceNextAsync(this IIotConnectorsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByWorkspaceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ActionType.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ActionType.cs new file mode 100644 index 000000000000..a3e2dd7f4a7f --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ActionType.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + + /// + /// Defines values for ActionType. + /// + public static class ActionType + { + public const string Internal = "Internal"; + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/CreatedByType.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/CreatedByType.cs new file mode 100644 index 000000000000..30b5e3d497fa --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/CreatedByType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + + /// + /// Defines values for CreatedByType. + /// + public static class CreatedByType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/DicomService.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/DicomService.cs new file mode 100644 index 000000000000..73c7d6cc0d7f --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/DicomService.cs @@ -0,0 +1,160 @@ +// +// 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.HealthcareApis.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The description of Dicom Service + /// + [Rest.Serialization.JsonTransformation] + public partial class DicomService + { + /// + /// Initializes a new instance of the DicomService class. + /// + public DicomService() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DicomService class. + /// + /// Resource tags. + /// The resource location. + /// Setting indicating whether the service has a + /// managed identity associated with it. + /// The provisioning state. Possible + /// values include: 'Deleting', 'Succeeded', 'Creating', 'Accepted', + /// 'Verifying', 'Updating', 'Failed', 'Canceled', 'Deprovisioned', + /// 'Moving', 'Suspended', 'Warned', 'SystemMaintenance' + /// Dicom Service + /// authentication configuration. + /// The url of the Dicom Services. + /// The list of private + /// endpoint connections that are set up for this resource. + /// Control permission for data plane + /// traffic coming from public networks while private endpoint is + /// enabled. Possible values include: 'Enabled', 'Disabled' + /// Metadata pertaining to creation and last + /// modification of the resource. + public DicomService(IDictionary tags = default(IDictionary), string location = default(string), ServiceManagedIdentityIdentity identity = default(ServiceManagedIdentityIdentity), string provisioningState = default(string), DicomServiceAuthenticationConfiguration authenticationConfiguration = default(DicomServiceAuthenticationConfiguration), string serviceUrl = default(string), IList privateEndpointConnections = default(IList), string publicNetworkAccess = default(string), SystemData systemData = default(SystemData)) + { + Tags = tags; + Location = location; + Identity = identity; + ProvisioningState = provisioningState; + AuthenticationConfiguration = authenticationConfiguration; + ServiceUrl = serviceUrl; + PrivateEndpointConnections = privateEndpointConnections; + PublicNetworkAccess = publicNetworkAccess; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets setting indicating whether the service has a managed + /// identity associated with it. + /// + [JsonProperty(PropertyName = "identity")] + public ServiceManagedIdentityIdentity Identity { get; set; } + + /// + /// Gets or sets the provisioning state. Possible values include: + /// 'Deleting', 'Succeeded', 'Creating', 'Accepted', 'Verifying', + /// 'Updating', 'Failed', 'Canceled', 'Deprovisioned', 'Moving', + /// 'Suspended', 'Warned', 'SystemMaintenance' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets dicom Service authentication configuration. + /// + [JsonProperty(PropertyName = "properties.authenticationConfiguration")] + public DicomServiceAuthenticationConfiguration AuthenticationConfiguration { get; set; } + + /// + /// Gets the url of the Dicom Services. + /// + [JsonProperty(PropertyName = "properties.serviceUrl")] + public string ServiceUrl { get; private set; } + + /// + /// Gets the list of private endpoint connections that are set up for + /// this resource. + /// + [JsonProperty(PropertyName = "properties.privateEndpointConnections")] + public IList PrivateEndpointConnections { get; private set; } + + /// + /// Gets or sets control permission for data plane traffic coming from + /// public networks while private endpoint is enabled. Possible values + /// include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + + /// + /// Gets or sets metadata pertaining to creation and last modification + /// of the resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Identity != null) + { + Identity.Validate(); + } + if (PrivateEndpointConnections != null) + { + foreach (var element in PrivateEndpointConnections) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/DicomServiceAuthenticationConfiguration.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/DicomServiceAuthenticationConfiguration.cs new file mode 100644 index 000000000000..a2f9397b7a40 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/DicomServiceAuthenticationConfiguration.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Authentication configuration information + /// + public partial class DicomServiceAuthenticationConfiguration + { + /// + /// Initializes a new instance of the + /// DicomServiceAuthenticationConfiguration class. + /// + public DicomServiceAuthenticationConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// DicomServiceAuthenticationConfiguration class. + /// + /// The authority url for the service + /// The audiences for the service + public DicomServiceAuthenticationConfiguration(string authority = default(string), IList audiences = default(IList)) + { + Authority = authority; + Audiences = audiences; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the authority url for the service + /// + [JsonProperty(PropertyName = "authority")] + public string Authority { get; private set; } + + /// + /// Gets the audiences for the service + /// + [JsonProperty(PropertyName = "audiences")] + public IList Audiences { get; private set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/DicomServicePatchResource.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/DicomServicePatchResource.cs new file mode 100644 index 000000000000..be35537cdd2d --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/DicomServicePatchResource.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Dicom Service patch properties + /// + public partial class DicomServicePatchResource + { + /// + /// Initializes a new instance of the DicomServicePatchResource class. + /// + public DicomServicePatchResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DicomServicePatchResource class. + /// + /// Resource tags. + /// Setting indicating whether the service has a + /// managed identity associated with it. + public DicomServicePatchResource(IDictionary tags = default(IDictionary), ServiceManagedIdentityIdentity identity = default(ServiceManagedIdentityIdentity)) + { + Tags = tags; + Identity = identity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets setting indicating whether the service has a managed + /// identity associated with it. + /// + [JsonProperty(PropertyName = "identity")] + public ServiceManagedIdentityIdentity Identity { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Identity != null) + { + Identity.Validate(); + } + } + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/Error.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/Error.cs new file mode 100644 index 000000000000..e1707b031062 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/Error.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.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error details. + /// + public partial class Error + { + /// + /// Initializes a new instance of the Error class. + /// + public Error() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Error class. + /// + /// Error details + public Error(ErrorDetailsInternal errorProperty = default(ErrorDetailsInternal)) + { + ErrorProperty = errorProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error details + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetailsInternal ErrorProperty { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ErrorDetails.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ErrorDetails.cs index abd720281d28..0d39f9431f8d 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ErrorDetails.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ErrorDetails.cs @@ -29,7 +29,7 @@ public ErrorDetails() /// /// Initializes a new instance of the ErrorDetails class. /// - /// Object containing error details. + /// Error details public ErrorDetails(ErrorDetailsInternal error = default(ErrorDetailsInternal)) { Error = error; @@ -42,7 +42,7 @@ public ErrorDetails() partial void CustomInit(); /// - /// Gets or sets object containing error details. + /// Gets or sets error details /// [JsonProperty(PropertyName = "error")] public ErrorDetailsInternal Error { get; set; } diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ErrorException.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ErrorException.cs new file mode 100644 index 000000000000..f9955ba42d1f --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ErrorException.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.HealthcareApis.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with Error information. + /// + public partial class ErrorException : 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 Error Body { get; set; } + + /// + /// Initializes a new instance of the ErrorException class. + /// + public ErrorException() + { + } + + /// + /// Initializes a new instance of the ErrorException class. + /// + /// The exception message. + public ErrorException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorException class. + /// + /// The exception message. + /// Inner exception. + public ErrorException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirResourceVersionPolicy.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirResourceVersionPolicy.cs new file mode 100644 index 000000000000..9f433e54203f --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirResourceVersionPolicy.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.HealthcareApis.Models +{ + + /// + /// Defines values for FhirResourceVersionPolicy. + /// + public static class FhirResourceVersionPolicy + { + public const string NoVersion = "no-version"; + public const string Versioned = "versioned"; + public const string VersionedUpdate = "versioned-update"; + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirService.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirService.cs new file mode 100644 index 000000000000..29129c1b301d --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirService.cs @@ -0,0 +1,230 @@ +// +// 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.HealthcareApis.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The description of Fhir Service + /// + [Rest.Serialization.JsonTransformation] + public partial class FhirService + { + /// + /// Initializes a new instance of the FhirService class. + /// + public FhirService() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FhirService class. + /// + /// Resource tags. + /// The resource location. + /// Setting indicating whether the service has a + /// managed identity associated with it. + /// The kind of the service. Possible values + /// include: 'fhir-Stu3', 'fhir-R4' + /// The provisioning state. Possible + /// values include: 'Deleting', 'Succeeded', 'Creating', 'Accepted', + /// 'Verifying', 'Updating', 'Failed', 'Canceled', 'Deprovisioned', + /// 'Moving', 'Suspended', 'Warned', 'SystemMaintenance' + /// Fhir Service access policies. + /// Fhir Service Azure container + /// registry configuration. + /// Fhir Service + /// authentication configuration. + /// Fhir Service Cors + /// configuration. + /// Fhir Service export + /// configuration. + /// The list of private + /// endpoint connections that are set up for this resource. + /// Control permission for data plane + /// traffic coming from public networks while private endpoint is + /// enabled. Possible values include: 'Enabled', 'Disabled' + /// Fhir Service event support status. + /// Possible values include: 'Disabled', 'Enabled', 'Updating' + /// Determines + /// tracking of history for resources. + /// Metadata pertaining to creation and last + /// modification of the resource. + public FhirService(IDictionary tags = default(IDictionary), string location = default(string), ServiceManagedIdentityIdentity identity = default(ServiceManagedIdentityIdentity), string kind = default(string), string provisioningState = default(string), IList accessPolicies = default(IList), FhirServiceAcrConfiguration acrConfiguration = default(FhirServiceAcrConfiguration), FhirServiceAuthenticationConfiguration authenticationConfiguration = default(FhirServiceAuthenticationConfiguration), FhirServiceCorsConfiguration corsConfiguration = default(FhirServiceCorsConfiguration), FhirServiceExportConfiguration exportConfiguration = default(FhirServiceExportConfiguration), IList privateEndpointConnections = default(IList), string publicNetworkAccess = default(string), string eventState = default(string), ResourceVersionPolicyConfiguration resourceVersionPolicyConfiguration = default(ResourceVersionPolicyConfiguration), SystemData systemData = default(SystemData)) + { + Tags = tags; + Location = location; + Identity = identity; + Kind = kind; + ProvisioningState = provisioningState; + AccessPolicies = accessPolicies; + AcrConfiguration = acrConfiguration; + AuthenticationConfiguration = authenticationConfiguration; + CorsConfiguration = corsConfiguration; + ExportConfiguration = exportConfiguration; + PrivateEndpointConnections = privateEndpointConnections; + PublicNetworkAccess = publicNetworkAccess; + EventState = eventState; + ResourceVersionPolicyConfiguration = resourceVersionPolicyConfiguration; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets setting indicating whether the service has a managed + /// identity associated with it. + /// + [JsonProperty(PropertyName = "identity")] + public ServiceManagedIdentityIdentity Identity { get; set; } + + /// + /// Gets or sets the kind of the service. Possible values include: + /// 'fhir-Stu3', 'fhir-R4' + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets or sets the provisioning state. Possible values include: + /// 'Deleting', 'Succeeded', 'Creating', 'Accepted', 'Verifying', + /// 'Updating', 'Failed', 'Canceled', 'Deprovisioned', 'Moving', + /// 'Suspended', 'Warned', 'SystemMaintenance' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets fhir Service access policies. + /// + [JsonProperty(PropertyName = "properties.accessPolicies")] + public IList AccessPolicies { get; set; } + + /// + /// Gets or sets fhir Service Azure container registry configuration. + /// + [JsonProperty(PropertyName = "properties.acrConfiguration")] + public FhirServiceAcrConfiguration AcrConfiguration { get; set; } + + /// + /// Gets or sets fhir Service authentication configuration. + /// + [JsonProperty(PropertyName = "properties.authenticationConfiguration")] + public FhirServiceAuthenticationConfiguration AuthenticationConfiguration { get; set; } + + /// + /// Gets or sets fhir Service Cors configuration. + /// + [JsonProperty(PropertyName = "properties.corsConfiguration")] + public FhirServiceCorsConfiguration CorsConfiguration { get; set; } + + /// + /// Gets or sets fhir Service export configuration. + /// + [JsonProperty(PropertyName = "properties.exportConfiguration")] + public FhirServiceExportConfiguration ExportConfiguration { get; set; } + + /// + /// Gets the list of private endpoint connections that are set up for + /// this resource. + /// + [JsonProperty(PropertyName = "properties.privateEndpointConnections")] + public IList PrivateEndpointConnections { get; private set; } + + /// + /// Gets or sets control permission for data plane traffic coming from + /// public networks while private endpoint is enabled. Possible values + /// include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + + /// + /// Gets or sets fhir Service event support status. Possible values + /// include: 'Disabled', 'Enabled', 'Updating' + /// + [JsonProperty(PropertyName = "properties.eventState")] + public string EventState { get; set; } + + /// + /// Gets or sets determines tracking of history for resources. + /// + [JsonProperty(PropertyName = "properties.resourceVersionPolicyConfiguration")] + public ResourceVersionPolicyConfiguration ResourceVersionPolicyConfiguration { get; set; } + + /// + /// Gets or sets metadata pertaining to creation and last modification + /// of the resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Identity != null) + { + Identity.Validate(); + } + if (AccessPolicies != null) + { + foreach (var element in AccessPolicies) + { + if (element != null) + { + element.Validate(); + } + } + } + if (CorsConfiguration != null) + { + CorsConfiguration.Validate(); + } + if (PrivateEndpointConnections != null) + { + foreach (var element1 in PrivateEndpointConnections) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + } + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServiceAccessPolicyEntry.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServiceAccessPolicyEntry.cs new file mode 100644 index 000000000000..678867143e4a --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServiceAccessPolicyEntry.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An access policy entry. + /// + public partial class FhirServiceAccessPolicyEntry + { + /// + /// Initializes a new instance of the FhirServiceAccessPolicyEntry + /// class. + /// + public FhirServiceAccessPolicyEntry() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FhirServiceAccessPolicyEntry + /// class. + /// + /// An Azure AD object ID (User or Apps) that is + /// allowed access to the FHIR service. + public FhirServiceAccessPolicyEntry(string objectId) + { + ObjectId = objectId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets an Azure AD object ID (User or Apps) that is allowed + /// access to the FHIR service. + /// + [JsonProperty(PropertyName = "objectId")] + public string ObjectId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ObjectId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ObjectId"); + } + if (ObjectId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(ObjectId, "^(([0-9A-Fa-f]{8}[-]?(?:[0-9A-Fa-f]{4}[-]?){3}[0-9A-Fa-f]{12}){1})+$")) + { + throw new ValidationException(ValidationRules.Pattern, "ObjectId", "^(([0-9A-Fa-f]{8}[-]?(?:[0-9A-Fa-f]{4}[-]?){3}[0-9A-Fa-f]{12}){1})+$"); + } + } + } + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServiceAcrConfiguration.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServiceAcrConfiguration.cs new file mode 100644 index 000000000000..f30ce779f71a --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServiceAcrConfiguration.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Azure container registry configuration information + /// + public partial class FhirServiceAcrConfiguration + { + /// + /// Initializes a new instance of the FhirServiceAcrConfiguration + /// class. + /// + public FhirServiceAcrConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FhirServiceAcrConfiguration + /// class. + /// + /// The list of the Azure container registry + /// login servers. + /// The list of Open Container Initiative + /// (OCI) artifacts. + public FhirServiceAcrConfiguration(IList loginServers = default(IList), IList ociArtifacts = default(IList)) + { + LoginServers = loginServers; + OciArtifacts = ociArtifacts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of the Azure container registry login + /// servers. + /// + [JsonProperty(PropertyName = "loginServers")] + public IList LoginServers { get; set; } + + /// + /// Gets or sets the list of Open Container Initiative (OCI) artifacts. + /// + [JsonProperty(PropertyName = "ociArtifacts")] + public IList OciArtifacts { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServiceAuthenticationConfiguration.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServiceAuthenticationConfiguration.cs new file mode 100644 index 000000000000..2477cd347f75 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServiceAuthenticationConfiguration.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Authentication configuration information + /// + public partial class FhirServiceAuthenticationConfiguration + { + /// + /// Initializes a new instance of the + /// FhirServiceAuthenticationConfiguration class. + /// + public FhirServiceAuthenticationConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// FhirServiceAuthenticationConfiguration class. + /// + /// The authority url for the service + /// The audience url for the service + /// If the SMART on FHIR proxy is + /// enabled + public FhirServiceAuthenticationConfiguration(string authority = default(string), string audience = default(string), bool? smartProxyEnabled = default(bool?)) + { + Authority = authority; + Audience = audience; + SmartProxyEnabled = smartProxyEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the authority url for the service + /// + [JsonProperty(PropertyName = "authority")] + public string Authority { get; set; } + + /// + /// Gets or sets the audience url for the service + /// + [JsonProperty(PropertyName = "audience")] + public string Audience { get; set; } + + /// + /// Gets or sets if the SMART on FHIR proxy is enabled + /// + [JsonProperty(PropertyName = "smartProxyEnabled")] + public bool? SmartProxyEnabled { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServiceCorsConfiguration.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServiceCorsConfiguration.cs new file mode 100644 index 000000000000..efd2e860fad3 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServiceCorsConfiguration.cs @@ -0,0 +1,106 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The settings for the CORS configuration of the service instance. + /// + public partial class FhirServiceCorsConfiguration + { + /// + /// Initializes a new instance of the FhirServiceCorsConfiguration + /// class. + /// + public FhirServiceCorsConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FhirServiceCorsConfiguration + /// class. + /// + /// The origins to be allowed via CORS. + /// The headers to be allowed via CORS. + /// The methods to be allowed via CORS. + /// The max age to be allowed via CORS. + /// If credentials are allowed via + /// CORS. + public FhirServiceCorsConfiguration(IList origins = default(IList), IList headers = default(IList), IList methods = default(IList), int? maxAge = default(int?), bool? allowCredentials = default(bool?)) + { + Origins = origins; + Headers = headers; + Methods = methods; + MaxAge = maxAge; + AllowCredentials = allowCredentials; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the origins to be allowed via CORS. + /// + [JsonProperty(PropertyName = "origins")] + public IList Origins { get; set; } + + /// + /// Gets or sets the headers to be allowed via CORS. + /// + [JsonProperty(PropertyName = "headers")] + public IList Headers { get; set; } + + /// + /// Gets or sets the methods to be allowed via CORS. + /// + [JsonProperty(PropertyName = "methods")] + public IList Methods { get; set; } + + /// + /// Gets or sets the max age to be allowed via CORS. + /// + [JsonProperty(PropertyName = "maxAge")] + public int? MaxAge { get; set; } + + /// + /// Gets or sets if credentials are allowed via CORS. + /// + [JsonProperty(PropertyName = "allowCredentials")] + public bool? AllowCredentials { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MaxAge > 99999) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxAge", 99999); + } + if (MaxAge < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxAge", 0); + } + } + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServiceExportConfiguration.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServiceExportConfiguration.cs new file mode 100644 index 000000000000..f2bcdec883ef --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServiceExportConfiguration.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Export operation configuration information + /// + public partial class FhirServiceExportConfiguration + { + /// + /// Initializes a new instance of the FhirServiceExportConfiguration + /// class. + /// + public FhirServiceExportConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FhirServiceExportConfiguration + /// class. + /// + /// The name of the default export + /// storage account. + public FhirServiceExportConfiguration(string storageAccountName = default(string)) + { + StorageAccountName = storageAccountName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the default export storage account. + /// + [JsonProperty(PropertyName = "storageAccountName")] + public string StorageAccountName { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServiceKind.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServiceKind.cs new file mode 100644 index 000000000000..e85855d64f75 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServiceKind.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.HealthcareApis.Models +{ + + /// + /// Defines values for FhirServiceKind. + /// + public static class FhirServiceKind + { + public const string FhirStu3 = "fhir-Stu3"; + public const string FhirR4 = "fhir-R4"; + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServicePatchResource.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServicePatchResource.cs new file mode 100644 index 000000000000..727d694e10cc --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/FhirServicePatchResource.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// FhirService patch properties + /// + public partial class FhirServicePatchResource + { + /// + /// Initializes a new instance of the FhirServicePatchResource class. + /// + public FhirServicePatchResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FhirServicePatchResource class. + /// + /// Resource tags. + /// Setting indicating whether the service has a + /// managed identity associated with it. + public FhirServicePatchResource(IDictionary tags = default(IDictionary), ServiceManagedIdentityIdentity identity = default(ServiceManagedIdentityIdentity)) + { + Tags = tags; + Identity = identity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets setting indicating whether the service has a managed + /// identity associated with it. + /// + [JsonProperty(PropertyName = "identity")] + public ServiceManagedIdentityIdentity Identity { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Identity != null) + { + Identity.Validate(); + } + } + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotConnector.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotConnector.cs new file mode 100644 index 000000000000..eacb469cd124 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotConnector.cs @@ -0,0 +1,128 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// IoT Connector definition. + /// + [Rest.Serialization.JsonTransformation] + public partial class IotConnector + { + /// + /// Initializes a new instance of the IotConnector class. + /// + public IotConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IotConnector class. + /// + /// Resource tags. + /// The resource location. + /// Setting indicating whether the service has a + /// managed identity associated with it. + /// The provisioning state. Possible + /// values include: 'Deleting', 'Succeeded', 'Creating', 'Accepted', + /// 'Verifying', 'Updating', 'Failed', 'Canceled', 'Deprovisioned', + /// 'Moving', 'Suspended', 'Warned', 'SystemMaintenance' + /// Source + /// configuration. + /// Device Mappings. + /// Metadata pertaining to creation and last + /// modification of the resource. + public IotConnector(IDictionary tags = default(IDictionary), string location = default(string), ServiceManagedIdentityIdentity identity = default(ServiceManagedIdentityIdentity), string provisioningState = default(string), IotEventHubIngestionEndpointConfiguration ingestionEndpointConfiguration = default(IotEventHubIngestionEndpointConfiguration), IotMappingProperties deviceMapping = default(IotMappingProperties), SystemData systemData = default(SystemData)) + { + Tags = tags; + Location = location; + Identity = identity; + ProvisioningState = provisioningState; + IngestionEndpointConfiguration = ingestionEndpointConfiguration; + DeviceMapping = deviceMapping; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets setting indicating whether the service has a managed + /// identity associated with it. + /// + [JsonProperty(PropertyName = "identity")] + public ServiceManagedIdentityIdentity Identity { get; set; } + + /// + /// Gets or sets the provisioning state. Possible values include: + /// 'Deleting', 'Succeeded', 'Creating', 'Accepted', 'Verifying', + /// 'Updating', 'Failed', 'Canceled', 'Deprovisioned', 'Moving', + /// 'Suspended', 'Warned', 'SystemMaintenance' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets source configuration. + /// + [JsonProperty(PropertyName = "properties.ingestionEndpointConfiguration")] + public IotEventHubIngestionEndpointConfiguration IngestionEndpointConfiguration { get; set; } + + /// + /// Gets or sets device Mappings. + /// + [JsonProperty(PropertyName = "properties.deviceMapping")] + public IotMappingProperties DeviceMapping { get; set; } + + /// + /// Gets or sets metadata pertaining to creation and last modification + /// of the resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Identity != null) + { + Identity.Validate(); + } + } + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotConnectorPatchResource.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotConnectorPatchResource.cs new file mode 100644 index 000000000000..b13889a66d57 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotConnectorPatchResource.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Iot Connector patch properties + /// + public partial class IotConnectorPatchResource + { + /// + /// Initializes a new instance of the IotConnectorPatchResource class. + /// + public IotConnectorPatchResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IotConnectorPatchResource class. + /// + /// Resource tags. + /// Setting indicating whether the service has a + /// managed identity associated with it. + public IotConnectorPatchResource(IDictionary tags = default(IDictionary), ServiceManagedIdentityIdentity identity = default(ServiceManagedIdentityIdentity)) + { + Tags = tags; + Identity = identity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets setting indicating whether the service has a managed + /// identity associated with it. + /// + [JsonProperty(PropertyName = "identity")] + public ServiceManagedIdentityIdentity Identity { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Identity != null) + { + Identity.Validate(); + } + } + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotDestinationProperties.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotDestinationProperties.cs new file mode 100644 index 000000000000..a32a81426f31 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotDestinationProperties.cs @@ -0,0 +1,57 @@ +// +// 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.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Common IoT Connector destination properties. + /// + public partial class IotDestinationProperties + { + /// + /// Initializes a new instance of the IotDestinationProperties class. + /// + public IotDestinationProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IotDestinationProperties class. + /// + /// The provisioning state. Possible + /// values include: 'Deleting', 'Succeeded', 'Creating', 'Accepted', + /// 'Verifying', 'Updating', 'Failed', 'Canceled', 'Deprovisioned', + /// 'Moving', 'Suspended', 'Warned', 'SystemMaintenance' + public IotDestinationProperties(string provisioningState = default(string)) + { + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the provisioning state. Possible values include: + /// 'Deleting', 'Succeeded', 'Creating', 'Accepted', 'Verifying', + /// 'Updating', 'Failed', 'Canceled', 'Deprovisioned', 'Moving', + /// 'Suspended', 'Warned', 'SystemMaintenance' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotEventHubIngestionEndpointConfiguration.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotEventHubIngestionEndpointConfiguration.cs new file mode 100644 index 000000000000..11ecb29e98e9 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotEventHubIngestionEndpointConfiguration.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Event Hub ingestion endpoint configuration + /// + public partial class IotEventHubIngestionEndpointConfiguration + { + /// + /// Initializes a new instance of the + /// IotEventHubIngestionEndpointConfiguration class. + /// + public IotEventHubIngestionEndpointConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// IotEventHubIngestionEndpointConfiguration class. + /// + /// Event Hub name to connect to. + /// Consumer group of the event hub to + /// connected to. + /// Fully qualified + /// namespace of the Event Hub to connect to. + public IotEventHubIngestionEndpointConfiguration(string eventHubName = default(string), string consumerGroup = default(string), string fullyQualifiedEventHubNamespace = default(string)) + { + EventHubName = eventHubName; + ConsumerGroup = consumerGroup; + FullyQualifiedEventHubNamespace = fullyQualifiedEventHubNamespace; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets event Hub name to connect to. + /// + [JsonProperty(PropertyName = "eventHubName")] + public string EventHubName { get; set; } + + /// + /// Gets or sets consumer group of the event hub to connected to. + /// + [JsonProperty(PropertyName = "consumerGroup")] + public string ConsumerGroup { get; set; } + + /// + /// Gets or sets fully qualified namespace of the Event Hub to connect + /// to. + /// + [JsonProperty(PropertyName = "fullyQualifiedEventHubNamespace")] + public string FullyQualifiedEventHubNamespace { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotFhirDestination.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotFhirDestination.cs new file mode 100644 index 000000000000..0f1d974a31ce --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotFhirDestination.cs @@ -0,0 +1,122 @@ +// +// 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.HealthcareApis.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// IoT Connector FHIR destination definition. + /// + [Rest.Serialization.JsonTransformation] + public partial class IotFhirDestination : LocationBasedResource + { + /// + /// Initializes a new instance of the IotFhirDestination class. + /// + public IotFhirDestination() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IotFhirDestination class. + /// + /// Determines how + /// resource identity is resolved on the destination. Possible values + /// include: 'Create', 'Lookup' + /// Fully qualified resource id of + /// the FHIR service to connect to. + /// FHIR Mappings + /// The resource location. + /// The provisioning state. Possible + /// values include: 'Deleting', 'Succeeded', 'Creating', 'Accepted', + /// 'Verifying', 'Updating', 'Failed', 'Canceled', 'Deprovisioned', + /// 'Moving', 'Suspended', 'Warned', 'SystemMaintenance' + /// Metadata pertaining to creation and last + /// modification of the resource. + public IotFhirDestination(string resourceIdentityResolutionType, string fhirServiceResourceId, IotMappingProperties fhirMapping, string location = default(string), string provisioningState = default(string), SystemData systemData = default(SystemData)) + : base(location) + { + ProvisioningState = provisioningState; + ResourceIdentityResolutionType = resourceIdentityResolutionType; + FhirServiceResourceId = fhirServiceResourceId; + FhirMapping = fhirMapping; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the provisioning state. Possible values include: + /// 'Deleting', 'Succeeded', 'Creating', 'Accepted', 'Verifying', + /// 'Updating', 'Failed', 'Canceled', 'Deprovisioned', 'Moving', + /// 'Suspended', 'Warned', 'SystemMaintenance' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets determines how resource identity is resolved on the + /// destination. Possible values include: 'Create', 'Lookup' + /// + [JsonProperty(PropertyName = "properties.resourceIdentityResolutionType")] + public string ResourceIdentityResolutionType { get; set; } + + /// + /// Gets or sets fully qualified resource id of the FHIR service to + /// connect to. + /// + [JsonProperty(PropertyName = "properties.fhirServiceResourceId")] + public string FhirServiceResourceId { get; set; } + + /// + /// Gets or sets FHIR Mappings + /// + [JsonProperty(PropertyName = "properties.fhirMapping")] + public IotMappingProperties FhirMapping { get; set; } + + /// + /// Gets or sets metadata pertaining to creation and last modification + /// of the resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ResourceIdentityResolutionType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ResourceIdentityResolutionType"); + } + if (FhirServiceResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "FhirServiceResourceId"); + } + if (FhirMapping == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "FhirMapping"); + } + } + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotIdentityResolutionType.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotIdentityResolutionType.cs new file mode 100644 index 000000000000..6a334bb62308 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotIdentityResolutionType.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.HealthcareApis.Models +{ + + /// + /// Defines values for IotIdentityResolutionType. + /// + public static class IotIdentityResolutionType + { + public const string Create = "Create"; + public const string Lookup = "Lookup"; + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotMappingProperties.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotMappingProperties.cs new file mode 100644 index 000000000000..e8e6d3b5f321 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/IotMappingProperties.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.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The mapping content. + /// + public partial class IotMappingProperties + { + /// + /// Initializes a new instance of the IotMappingProperties class. + /// + public IotMappingProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IotMappingProperties class. + /// + /// The mapping. + public IotMappingProperties(object content = default(object)) + { + Content = content; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the mapping. + /// + [JsonProperty(PropertyName = "content")] + public object Content { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/LocationBasedResource.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/LocationBasedResource.cs new file mode 100644 index 000000000000..5d1ce95bf6bf --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/LocationBasedResource.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The common properties for any location based resource, tracked or + /// proxy. + /// + public partial class LocationBasedResource : IResource + { + /// + /// Initializes a new instance of the LocationBasedResource class. + /// + public LocationBasedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LocationBasedResource class. + /// + /// The resource location. + public LocationBasedResource(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/LogSpecification.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/LogSpecification.cs new file mode 100644 index 000000000000..8c734ccdaa83 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/LogSpecification.cs @@ -0,0 +1,68 @@ +// +// 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.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifications of the Log for Azure Monitoring + /// + public partial class LogSpecification + { + /// + /// Initializes a new instance of the LogSpecification class. + /// + public LogSpecification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LogSpecification class. + /// + /// Name of the log + /// Localized friendly display name of the + /// log + /// Blob duration of the log + public LogSpecification(string name = default(string), string displayName = default(string), string blobDuration = default(string)) + { + Name = name; + DisplayName = displayName; + BlobDuration = blobDuration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the log + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets localized friendly display name of the log + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets blob duration of the log + /// + [JsonProperty(PropertyName = "blobDuration")] + public string BlobDuration { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/MetricDimension.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/MetricDimension.cs new file mode 100644 index 000000000000..304122b35b45 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/MetricDimension.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifications of the Dimension of metrics + /// + public partial class MetricDimension + { + /// + /// Initializes a new instance of the MetricDimension class. + /// + public MetricDimension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricDimension class. + /// + /// Name of the dimension + /// Localized friendly display name of the + /// dimension + /// Whether this dimension should + /// be included for the Shoebox export scenario + public MetricDimension(string name = default(string), string displayName = default(string), bool? toBeExportedForShoebox = default(bool?)) + { + Name = name; + DisplayName = displayName; + ToBeExportedForShoebox = toBeExportedForShoebox; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the dimension + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets localized friendly display name of the dimension + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets whether this dimension should be included for the + /// Shoebox export scenario + /// + [JsonProperty(PropertyName = "toBeExportedForShoebox")] + public bool? ToBeExportedForShoebox { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/MetricSpecification.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/MetricSpecification.cs new file mode 100644 index 000000000000..e1b38a8a7be2 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/MetricSpecification.cs @@ -0,0 +1,146 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifications of the Metrics for Azure Monitoring + /// + public partial class MetricSpecification + { + /// + /// Initializes a new instance of the MetricSpecification class. + /// + public MetricSpecification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricSpecification class. + /// + /// Name of the metric + /// Localized friendly display name of the + /// metric + /// Localized friendly description of + /// the metric + /// Unit that makes sense for the metric + /// Name of the metric category that the metric + /// belongs to. A metric can only belong to a single category. + /// Only provide one value for this + /// field. Valid values: Average, Minimum, Maximum, Total, + /// Count. + /// Supported aggregation + /// types + /// Supported time grain + /// types + /// Optional. If set to true, then zero + /// will be returned for time duration where no metric is + /// emitted/published. + /// Dimensions of the metric + /// Name of the MDM namespace. + /// Optional. + public MetricSpecification(string name = default(string), string displayName = default(string), string displayDescription = default(string), string unit = default(string), string category = default(string), string aggregationType = default(string), IList supportedAggregationTypes = default(IList), IList supportedTimeGrainTypes = default(IList), bool? fillGapWithZero = default(bool?), IList dimensions = default(IList), string sourceMdmNamespace = default(string)) + { + Name = name; + DisplayName = displayName; + DisplayDescription = displayDescription; + Unit = unit; + Category = category; + AggregationType = aggregationType; + SupportedAggregationTypes = supportedAggregationTypes; + SupportedTimeGrainTypes = supportedTimeGrainTypes; + FillGapWithZero = fillGapWithZero; + Dimensions = dimensions; + SourceMdmNamespace = sourceMdmNamespace; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the metric + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets localized friendly display name of the metric + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets localized friendly description of the metric + /// + [JsonProperty(PropertyName = "displayDescription")] + public string DisplayDescription { get; set; } + + /// + /// Gets or sets unit that makes sense for the metric + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; set; } + + /// + /// Gets or sets name of the metric category that the metric belongs + /// to. A metric can only belong to a single category. + /// + [JsonProperty(PropertyName = "category")] + public string Category { get; set; } + + /// + /// Gets or sets only provide one value for this field. Valid values: + /// Average, Minimum, Maximum, Total, Count. + /// + [JsonProperty(PropertyName = "aggregationType")] + public string AggregationType { get; set; } + + /// + /// Gets or sets supported aggregation types + /// + [JsonProperty(PropertyName = "supportedAggregationTypes")] + public IList SupportedAggregationTypes { get; set; } + + /// + /// Gets or sets supported time grain types + /// + [JsonProperty(PropertyName = "supportedTimeGrainTypes")] + public IList SupportedTimeGrainTypes { get; set; } + + /// + /// Gets or sets optional. If set to true, then zero will be returned + /// for time duration where no metric is emitted/published. + /// + [JsonProperty(PropertyName = "fillGapWithZero")] + public bool? FillGapWithZero { get; set; } + + /// + /// Gets or sets dimensions of the metric + /// + [JsonProperty(PropertyName = "dimensions")] + public IList Dimensions { get; set; } + + /// + /// Gets or sets name of the MDM namespace. Optional. + /// + [JsonProperty(PropertyName = "sourceMdmNamespace")] + public string SourceMdmNamespace { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/Operation.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/Operation.cs deleted file mode 100644 index 1c5769542e26..000000000000 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/Operation.cs +++ /dev/null @@ -1,70 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.HealthcareApis.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Service REST API operation. - /// - 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}/{read | - /// write | action | delete} - /// Default value is 'user,system'. - /// The information displayed about the - /// operation. - public Operation(string name = default(string), string origin = default(string), OperationDisplay display = default(OperationDisplay)) - { - Name = name; - Origin = origin; - Display = display; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets operation name: {provider}/{resource}/{read | write | action | - /// delete} - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets default value is 'user,system'. - /// - [JsonProperty(PropertyName = "origin")] - public string Origin { get; private set; } - - /// - /// Gets or sets the information displayed about the operation. - /// - [JsonProperty(PropertyName = "display")] - public OperationDisplay Display { get; set; } - - } -} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/OperationDetail.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/OperationDetail.cs new file mode 100644 index 000000000000..018c6b98e322 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/OperationDetail.cs @@ -0,0 +1,99 @@ +// +// 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.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Service REST API operation. + /// + public partial class OperationDetail + { + /// + /// Initializes a new instance of the OperationDetail class. + /// + public OperationDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDetail class. + /// + /// Name of the operation + /// Whether the operation applies to + /// data-plane. This is "true" for data-plane operations and "false" + /// for ARM/control-plane operations. + /// Display of the operation + /// Default value is 'user,system'. + /// Enum. Indicates the action type. + /// "Internal" refers to actions that are for internal only APIs. + /// Possible values include: 'Internal' + /// Properties of the operation + public OperationDetail(string name = default(string), bool? isDataAction = default(bool?), OperationDisplay display = default(OperationDisplay), string origin = default(string), string actionType = default(string), OperationProperties properties = default(OperationProperties)) + { + Name = name; + IsDataAction = isDataAction; + Display = display; + Origin = origin; + ActionType = actionType; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets name of the operation + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets whether the operation applies to data-plane. This is "true" + /// for data-plane operations and "false" for ARM/control-plane + /// operations. + /// + [JsonProperty(PropertyName = "isDataAction")] + public bool? IsDataAction { get; private set; } + + /// + /// Gets or sets display of the operation + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + /// + /// Gets default value is 'user,system'. + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; private set; } + + /// + /// Gets enum. Indicates the action type. "Internal" refers to actions + /// that are for internal only APIs. Possible values include: + /// 'Internal' + /// + [JsonProperty(PropertyName = "actionType")] + public string ActionType { get; private set; } + + /// + /// Gets or sets properties of the operation + /// + [JsonProperty(PropertyName = "properties")] + public OperationProperties Properties { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/OperationProperties.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/OperationProperties.cs new file mode 100644 index 000000000000..470e4dd32159 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/OperationProperties.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Extra Operation properties + /// + public partial class OperationProperties + { + /// + /// Initializes a new instance of the OperationProperties class. + /// + public OperationProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationProperties class. + /// + /// Service specifications of the + /// operation + public OperationProperties(ServiceSpecification serviceSpecification = default(ServiceSpecification)) + { + ServiceSpecification = serviceSpecification; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service specifications of the operation + /// + [JsonProperty(PropertyName = "serviceSpecification")] + public ServiceSpecification ServiceSpecification { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/OperationResultsDescription.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/OperationResultsDescription.cs index 89c96275059e..7f135999404b 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/OperationResultsDescription.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/OperationResultsDescription.cs @@ -39,14 +39,16 @@ public OperationResultsDescription() /// 'Requested', 'Running' /// The time that the operation was /// started. + /// The time that the operation finished. /// Additional properties of the operation /// result. - public OperationResultsDescription(string id = default(string), string name = default(string), string status = default(string), string startTime = default(string), object properties = default(object)) + public OperationResultsDescription(string id = default(string), string name = default(string), string status = default(string), string startTime = default(string), string endTime = default(string), object properties = default(object)) { Id = id; Name = name; Status = status; StartTime = startTime; + EndTime = endTime; Properties = properties; CustomInit(); } @@ -81,6 +83,12 @@ public OperationResultsDescription() [JsonProperty(PropertyName = "startTime")] public string StartTime { get; private set; } + /// + /// Gets the time that the operation finished. + /// + [JsonProperty(PropertyName = "endTime")] + public string EndTime { get; private set; } + /// /// Gets or sets additional properties of the operation result. /// diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/PrivateEndpointConnectionDescription.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/PrivateEndpointConnectionDescription.cs new file mode 100644 index 000000000000..b7f3da7828b2 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/PrivateEndpointConnectionDescription.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.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Private Endpoint Connection resource. + /// + public partial class PrivateEndpointConnectionDescription : PrivateEndpointConnection + { + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionDescription class. + /// + public PrivateEndpointConnectionDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionDescription class. + /// + /// A collection of + /// information about the state of the connection between service + /// consumer and provider. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// The resource of private end + /// point. + /// The provisioning state of the + /// private endpoint connection resource. Possible values include: + /// 'Succeeded', 'Creating', 'Deleting', 'Failed' + /// Metadata pertaining to creation and last + /// modification of the resource. + public PrivateEndpointConnectionDescription(PrivateLinkServiceConnectionState privateLinkServiceConnectionState, string id = default(string), string name = default(string), string type = default(string), PrivateEndpoint privateEndpoint = default(PrivateEndpoint), string provisioningState = default(string), SystemData systemData = default(SystemData)) + : base(privateLinkServiceConnectionState, id, name, type, privateEndpoint, provisioningState) + { + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets metadata pertaining to creation and last modification + /// of the resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/PrivateEndpointConnectionListResult.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/PrivateEndpointConnectionListResult.cs new file mode 100644 index 000000000000..ec1d651b7489 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/PrivateEndpointConnectionListResult.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.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of private endpoint connection associated with the specified + /// storage account + /// + public partial class PrivateEndpointConnectionListResult + { + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionListResult class. + /// + public PrivateEndpointConnectionListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionListResult class. + /// + /// Array of private endpoint connections + public PrivateEndpointConnectionListResult(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of private endpoint connections + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/PrivateLinkResourceDescription.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/PrivateLinkResourceDescription.cs new file mode 100644 index 000000000000..3057436980bc --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/PrivateLinkResourceDescription.cs @@ -0,0 +1,69 @@ +// +// 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.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Private Endpoint Connection resource. + /// + public partial class PrivateLinkResourceDescription : PrivateLinkResource + { + /// + /// Initializes a new instance of the PrivateLinkResourceDescription + /// class. + /// + public PrivateLinkResourceDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResourceDescription + /// class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// The private link resource group id. + /// The private link resource required + /// member names. + /// The private link resource Private + /// link DNS zone name. + /// Metadata pertaining to creation and last + /// modification of the resource. + public PrivateLinkResourceDescription(string id = default(string), string name = default(string), string type = default(string), string groupId = default(string), IList requiredMembers = default(IList), IList requiredZoneNames = default(IList), SystemData systemData = default(SystemData)) + : base(id, name, type, groupId, requiredMembers, requiredZoneNames) + { + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets metadata pertaining to creation and last modification + /// of the resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/PrivateLinkResourceListResult.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/PrivateLinkResourceListResultDescription.cs similarity index 68% rename from sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/PrivateLinkResourceListResult.cs rename to sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/PrivateLinkResourceListResultDescription.cs index 8a5978b870df..393aa3e78b40 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/PrivateLinkResourceListResult.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/PrivateLinkResourceListResultDescription.cs @@ -18,23 +18,23 @@ namespace Microsoft.Azure.Management.HealthcareApis.Models /// /// A list of private link resources /// - public partial class PrivateLinkResourceListResult + public partial class PrivateLinkResourceListResultDescription { /// - /// Initializes a new instance of the PrivateLinkResourceListResult - /// class. + /// Initializes a new instance of the + /// PrivateLinkResourceListResultDescription class. /// - public PrivateLinkResourceListResult() + public PrivateLinkResourceListResultDescription() { CustomInit(); } /// - /// Initializes a new instance of the PrivateLinkResourceListResult - /// class. + /// Initializes a new instance of the + /// PrivateLinkResourceListResultDescription class. /// /// Array of private link resources - public PrivateLinkResourceListResult(IList value = default(IList)) + public PrivateLinkResourceListResultDescription(IList value = default(IList)) { Value = value; CustomInit(); @@ -49,7 +49,7 @@ public PrivateLinkResourceListResult() /// Gets or sets array of private link resources /// [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } + public IList Value { get; set; } } } diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ProvisioningState.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ProvisioningState.cs index f40c0f0d8a66..5882bf4d62cb 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ProvisioningState.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ProvisioningState.cs @@ -25,5 +25,9 @@ public static class ProvisioningState public const string Failed = "Failed"; public const string Canceled = "Canceled"; public const string Deprovisioned = "Deprovisioned"; + public const string Moving = "Moving"; + public const string Suspended = "Suspended"; + public const string Warned = "Warned"; + public const string SystemMaintenance = "SystemMaintenance"; } } diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ResourceCore.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ResourceCore.cs new file mode 100644 index 000000000000..6b1e813de6e5 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ResourceCore.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The common properties for any resource, tracked or proxy. + /// + public partial class ResourceCore : IResource + { + /// + /// Initializes a new instance of the ResourceCore class. + /// + public ResourceCore() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceCore class. + /// + /// The resource identifier. + /// The resource name. + /// The resource type. + /// An etag associated with the resource, used for + /// optimistic concurrency when editing it. + public ResourceCore(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + { + Id = id; + Name = name; + Type = type; + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the resource identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets an etag associated with the resource, used for + /// optimistic concurrency when editing it. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^[a-z0-9][a-z0-9-]{1,21}[a-z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "Name", "^[a-z0-9][a-z0-9-]{1,21}[a-z0-9]$"); + } + } + } + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ResourceTags.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ResourceTags.cs new file mode 100644 index 000000000000..45d568962d7b --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ResourceTags.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of key value pairs that describe the resource. This will overwrite + /// the existing tags. + /// + public partial class ResourceTags + { + /// + /// Initializes a new instance of the ResourceTags class. + /// + public ResourceTags() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceTags class. + /// + /// Resource tags. + public ResourceTags(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ResourceVersionPolicyConfiguration.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ResourceVersionPolicyConfiguration.cs new file mode 100644 index 000000000000..c44336eb916c --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ResourceVersionPolicyConfiguration.cs @@ -0,0 +1,69 @@ +// +// 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.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The settings for history tracking for FHIR resources. + /// + public partial class ResourceVersionPolicyConfiguration + { + /// + /// Initializes a new instance of the + /// ResourceVersionPolicyConfiguration class. + /// + public ResourceVersionPolicyConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceVersionPolicyConfiguration class. + /// + /// The default value for tracking + /// history across all resources. Possible values include: + /// 'no-version', 'versioned', 'versioned-update' + /// A list of FHIR Resources and + /// their version policy overrides. + public ResourceVersionPolicyConfiguration(string defaultProperty = default(string), IDictionary resourceTypeOverrides = default(IDictionary)) + { + DefaultProperty = defaultProperty; + ResourceTypeOverrides = resourceTypeOverrides; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the default value for tracking history across all + /// resources. Possible values include: 'no-version', 'versioned', + /// 'versioned-update' + /// + [JsonProperty(PropertyName = "default")] + public string DefaultProperty { get; set; } + + /// + /// Gets or sets a list of FHIR Resources and their version policy + /// overrides. + /// + [JsonProperty(PropertyName = "resourceTypeOverrides")] + public IDictionary ResourceTypeOverrides { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceAcrConfigurationInfo.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceAcrConfigurationInfo.cs new file mode 100644 index 000000000000..33fb444e4fa2 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceAcrConfigurationInfo.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Azure container registry configuration information + /// + public partial class ServiceAcrConfigurationInfo + { + /// + /// Initializes a new instance of the ServiceAcrConfigurationInfo + /// class. + /// + public ServiceAcrConfigurationInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceAcrConfigurationInfo + /// class. + /// + /// The list of the ACR login + /// servers. + /// The list of Open Container Initiative + /// (OCI) artifacts. + public ServiceAcrConfigurationInfo(IList loginServers = default(IList), IList ociArtifacts = default(IList)) + { + LoginServers = loginServers; + OciArtifacts = ociArtifacts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of the ACR login servers. + /// + [JsonProperty(PropertyName = "loginServers")] + public IList LoginServers { get; set; } + + /// + /// Gets or sets the list of Open Container Initiative (OCI) artifacts. + /// + [JsonProperty(PropertyName = "ociArtifacts")] + public IList OciArtifacts { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceEventState.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceEventState.cs new file mode 100644 index 000000000000..1e26c6a9fdbd --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceEventState.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.HealthcareApis.Models +{ + + /// + /// Defines values for ServiceEventState. + /// + public static class ServiceEventState + { + public const string Disabled = "Disabled"; + public const string Enabled = "Enabled"; + public const string Updating = "Updating"; + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceManagedIdentity.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceManagedIdentity.cs new file mode 100644 index 000000000000..10335b9c4a96 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceManagedIdentity.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.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Managed service identity (system assigned and/or user assigned + /// identities) + /// + public partial class ServiceManagedIdentity + { + /// + /// Initializes a new instance of the ServiceManagedIdentity class. + /// + public ServiceManagedIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceManagedIdentity class. + /// + /// Setting indicating whether the service has a + /// managed identity associated with it. + public ServiceManagedIdentity(ServiceManagedIdentityIdentity identity = default(ServiceManagedIdentityIdentity)) + { + Identity = identity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets setting indicating whether the service has a managed + /// identity associated with it. + /// + [JsonProperty(PropertyName = "identity")] + public ServiceManagedIdentityIdentity Identity { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Identity != null) + { + Identity.Validate(); + } + } + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceManagedIdentityIdentity.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceManagedIdentityIdentity.cs new file mode 100644 index 000000000000..d65ffb737ac2 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceManagedIdentityIdentity.cs @@ -0,0 +1,104 @@ +// +// 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.HealthcareApis.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Setting indicating whether the service has a managed identity + /// associated with it. + /// + public partial class ServiceManagedIdentityIdentity + { + /// + /// Initializes a new instance of the ServiceManagedIdentityIdentity + /// class. + /// + public ServiceManagedIdentityIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceManagedIdentityIdentity + /// class. + /// + /// Type of identity being specified, currently + /// SystemAssigned and None are allowed. Possible values include: + /// 'None', 'SystemAssigned', 'UserAssigned', + /// 'SystemAssigned,UserAssigned' + /// The service principal ID of the system + /// assigned identity. This property will only be provided for a system + /// assigned identity. + /// The tenant ID of the system assigned + /// identity. This property will only be provided for a system assigned + /// identity. + public ServiceManagedIdentityIdentity(string type, System.Guid? principalId = default(System.Guid?), System.Guid? tenantId = default(System.Guid?), IDictionary userAssignedIdentities = default(IDictionary)) + { + Type = type; + PrincipalId = principalId; + TenantId = tenantId; + UserAssignedIdentities = userAssignedIdentities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of identity being specified, currently + /// SystemAssigned and None are allowed. Possible values include: + /// 'None', 'SystemAssigned', 'UserAssigned', + /// 'SystemAssigned,UserAssigned' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets the service principal ID of the system assigned identity. This + /// property will only be provided for a system assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public System.Guid? PrincipalId { get; private set; } + + /// + /// Gets the tenant ID of the system assigned identity. This property + /// will only be provided for a system assigned identity. + /// + [JsonProperty(PropertyName = "tenantId")] + public System.Guid? TenantId { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + } + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceManagedIdentityType.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceManagedIdentityType.cs new file mode 100644 index 000000000000..c6e77f04c519 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceManagedIdentityType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + + /// + /// Defines values for ServiceManagedIdentityType. + /// + public static class ServiceManagedIdentityType + { + public const string None = "None"; + public const string SystemAssigned = "SystemAssigned"; + public const string UserAssigned = "UserAssigned"; + public const string SystemAssignedUserAssigned = "SystemAssigned,UserAssigned"; + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceOciArtifactEntry.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceOciArtifactEntry.cs new file mode 100644 index 000000000000..6287de0b2603 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceOciArtifactEntry.cs @@ -0,0 +1,68 @@ +// +// 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.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An Open Container Initiative (OCI) artifact. + /// + public partial class ServiceOciArtifactEntry + { + /// + /// Initializes a new instance of the ServiceOciArtifactEntry class. + /// + public ServiceOciArtifactEntry() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceOciArtifactEntry class. + /// + /// The Azure Container Registry login + /// server. + /// The artifact name. + /// The artifact digest. + public ServiceOciArtifactEntry(string loginServer = default(string), string imageName = default(string), string digest = default(string)) + { + LoginServer = loginServer; + ImageName = imageName; + Digest = digest; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Azure Container Registry login server. + /// + [JsonProperty(PropertyName = "loginServer")] + public string LoginServer { get; set; } + + /// + /// Gets or sets the artifact name. + /// + [JsonProperty(PropertyName = "imageName")] + public string ImageName { get; set; } + + /// + /// Gets or sets the artifact digest. + /// + [JsonProperty(PropertyName = "digest")] + public string Digest { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceSpecification.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceSpecification.cs new file mode 100644 index 000000000000..0633f0db7a1d --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceSpecification.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Service specification payload + /// + public partial class ServiceSpecification + { + /// + /// Initializes a new instance of the ServiceSpecification class. + /// + public ServiceSpecification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceSpecification class. + /// + /// Specifications of the Log for Azure + /// Monitoring + /// Specifications of the Metrics + /// for Azure Monitoring + public ServiceSpecification(IList logSpecifications = default(IList), IList metricSpecifications = default(IList)) + { + LogSpecifications = logSpecifications; + MetricSpecifications = metricSpecifications; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifications of the Log for Azure Monitoring + /// + [JsonProperty(PropertyName = "logSpecifications")] + public IList LogSpecifications { get; set; } + + /// + /// Gets or sets specifications of the Metrics for Azure Monitoring + /// + [JsonProperty(PropertyName = "metricSpecifications")] + public IList MetricSpecifications { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServicesDescription.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServicesDescription.cs index 9b390417a9ff..2a709a898da3 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServicesDescription.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServicesDescription.cs @@ -44,10 +44,13 @@ public ServicesDescription() /// managed identity associated with it. /// The common properties of a /// service. - public ServicesDescription(Kind kind, string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string etag = default(string), ServicesResourceIdentity identity = default(ServicesResourceIdentity), ServicesProperties properties = default(ServicesProperties)) + /// Metadata pertaining to creation and last + /// modification of the resource. + public ServicesDescription(Kind kind, string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string etag = default(string), ServicesResourceIdentity identity = default(ServicesResourceIdentity), ServicesProperties properties = default(ServicesProperties), SystemData systemData = default(SystemData)) : base(kind, location, id, name, type, tags, etag, identity) { Properties = properties; + SystemData = systemData; CustomInit(); } @@ -62,6 +65,13 @@ public ServicesDescription() [JsonProperty(PropertyName = "properties")] public ServicesProperties Properties { get; set; } + /// + /// Gets or sets metadata pertaining to creation and last modification + /// of the resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + /// /// Validate the object. /// diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServicesProperties.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServicesProperties.cs index 32517b0b0ee3..648e84aab2a4 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServicesProperties.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServicesProperties.cs @@ -33,8 +33,8 @@ public ServicesProperties() /// /// The provisioning state. Possible /// values include: 'Deleting', 'Succeeded', 'Creating', 'Accepted', - /// 'Verifying', 'Updating', 'Failed', 'Canceled', - /// 'Deprovisioned' + /// 'Verifying', 'Updating', 'Failed', 'Canceled', 'Deprovisioned', + /// 'Moving', 'Suspended', 'Warned', 'SystemMaintenance' /// The access policies of the service /// instance. /// The settings for the Cosmos DB @@ -50,7 +50,10 @@ public ServicesProperties() /// Control permission for data plane /// traffic coming from public networks while private endpoint is /// enabled. Possible values include: 'Enabled', 'Disabled' - public ServicesProperties(string provisioningState = default(string), IList accessPolicies = default(IList), ServiceCosmosDbConfigurationInfo cosmosDbConfiguration = default(ServiceCosmosDbConfigurationInfo), ServiceAuthenticationConfigurationInfo authenticationConfiguration = default(ServiceAuthenticationConfigurationInfo), ServiceCorsConfigurationInfo corsConfiguration = default(ServiceCorsConfigurationInfo), ServiceExportConfigurationInfo exportConfiguration = default(ServiceExportConfigurationInfo), IList privateEndpointConnections = default(IList), string publicNetworkAccess = default(string)) + /// The azure container registry + /// settings used for convert data operation of the service + /// instance. + public ServicesProperties(string provisioningState = default(string), IList accessPolicies = default(IList), ServiceCosmosDbConfigurationInfo cosmosDbConfiguration = default(ServiceCosmosDbConfigurationInfo), ServiceAuthenticationConfigurationInfo authenticationConfiguration = default(ServiceAuthenticationConfigurationInfo), ServiceCorsConfigurationInfo corsConfiguration = default(ServiceCorsConfigurationInfo), ServiceExportConfigurationInfo exportConfiguration = default(ServiceExportConfigurationInfo), IList privateEndpointConnections = default(IList), string publicNetworkAccess = default(string), ServiceAcrConfigurationInfo acrConfiguration = default(ServiceAcrConfigurationInfo)) { ProvisioningState = provisioningState; AccessPolicies = accessPolicies; @@ -60,6 +63,7 @@ public ServicesProperties() ExportConfiguration = exportConfiguration; PrivateEndpointConnections = privateEndpointConnections; PublicNetworkAccess = publicNetworkAccess; + AcrConfiguration = acrConfiguration; CustomInit(); } @@ -69,12 +73,13 @@ public ServicesProperties() partial void CustomInit(); /// - /// Gets the provisioning state. Possible values include: 'Deleting', - /// 'Succeeded', 'Creating', 'Accepted', 'Verifying', 'Updating', - /// 'Failed', 'Canceled', 'Deprovisioned' + /// Gets or sets the provisioning state. Possible values include: + /// 'Deleting', 'Succeeded', 'Creating', 'Accepted', 'Verifying', + /// 'Updating', 'Failed', 'Canceled', 'Deprovisioned', 'Moving', + /// 'Suspended', 'Warned', 'SystemMaintenance' /// [JsonProperty(PropertyName = "provisioningState")] - public string ProvisioningState { get; private set; } + public string ProvisioningState { get; set; } /// /// Gets or sets the access policies of the service instance. @@ -125,6 +130,13 @@ public ServicesProperties() [JsonProperty(PropertyName = "publicNetworkAccess")] public string PublicNetworkAccess { get; set; } + /// + /// Gets or sets the azure container registry settings used for convert + /// data operation of the service instance. + /// + [JsonProperty(PropertyName = "acrConfiguration")] + public ServiceAcrConfigurationInfo AcrConfiguration { get; set; } + /// /// Validate the object. /// diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/SystemData.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/SystemData.cs new file mode 100644 index 000000000000..ce78e3b7379b --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/SystemData.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata pertaining to creation and last modification of the resource. + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// The identity that created the + /// resource. + /// The type of identity that created the + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// The timestamp of resource creation + /// (UTC). + /// The identity that last modified the + /// resource. + /// The type of identity that last + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The timestamp of resource last + /// modification (UTC) + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity that created the resource. + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource creation (UTC). + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTime? CreatedAt { get; set; } + + /// + /// Gets or sets the identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource last modification (UTC) + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTime? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/TaggedResource.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/TaggedResource.cs new file mode 100644 index 000000000000..7bed4c6fb3d3 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/TaggedResource.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The common properties of tracked resources in the service. + /// + public partial class TaggedResource : IResource + { + /// + /// Initializes a new instance of the TaggedResource class. + /// + public TaggedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TaggedResource class. + /// + /// Resource tags. + /// The resource location. + public TaggedResource(IDictionary tags = default(IDictionary), string location = default(string)) + { + Tags = tags; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/UserAssignedIdentity.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/UserAssignedIdentity.cs new file mode 100644 index 000000000000..52931e8e9f5e --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/UserAssignedIdentity.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.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// User assigned identity properties + /// + public partial class UserAssignedIdentity + { + /// + /// Initializes a new instance of the UserAssignedIdentity class. + /// + public UserAssignedIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserAssignedIdentity class. + /// + /// The principal ID of the assigned + /// identity. + /// The client ID of the assigned + /// identity. + public UserAssignedIdentity(System.Guid? principalId = default(System.Guid?), System.Guid? clientId = default(System.Guid?)) + { + PrincipalId = principalId; + ClientId = clientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal ID of the assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public System.Guid? PrincipalId { get; private set; } + + /// + /// Gets the client ID of the assigned identity. + /// + [JsonProperty(PropertyName = "clientId")] + public System.Guid? ClientId { get; private set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/Workspace.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/Workspace.cs new file mode 100644 index 000000000000..c3c63fdac168 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/Workspace.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.HealthcareApis.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Workspace resource. + /// + public partial class Workspace : TaggedResource + { + /// + /// Initializes a new instance of the Workspace class. + /// + public Workspace() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Workspace class. + /// + /// Resource tags. + /// The resource location. + /// Workspaces resource specific + /// properties. + /// Metadata pertaining to creation and last + /// modification of the resource. + public Workspace(IDictionary tags = default(IDictionary), string location = default(string), WorkspaceProperties properties = default(WorkspaceProperties), SystemData systemData = default(SystemData)) + : base(tags, location) + { + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets workspaces resource specific properties. + /// + [JsonProperty(PropertyName = "properties")] + public WorkspaceProperties Properties { get; set; } + + /// + /// Gets or sets metadata pertaining to creation and last modification + /// of the resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/WorkspacePatchResource.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/WorkspacePatchResource.cs new file mode 100644 index 000000000000..c81d017b0641 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/WorkspacePatchResource.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.HealthcareApis.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Workspace patch properties + /// + public partial class WorkspacePatchResource : ResourceTags + { + /// + /// Initializes a new instance of the WorkspacePatchResource class. + /// + public WorkspacePatchResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkspacePatchResource class. + /// + /// Resource tags. + public WorkspacePatchResource(IDictionary tags = default(IDictionary)) + : base(tags) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/WorkspaceProperties.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/WorkspaceProperties.cs new file mode 100644 index 000000000000..25c66a8f32f5 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/WorkspaceProperties.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Workspaces resource specific properties. + /// + public partial class WorkspaceProperties : IResource + { + /// + /// Initializes a new instance of the WorkspaceProperties class. + /// + public WorkspaceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkspaceProperties class. + /// + /// The provisioning state. Possible + /// values include: 'Deleting', 'Succeeded', 'Creating', 'Accepted', + /// 'Verifying', 'Updating', 'Failed', 'Canceled', 'Deprovisioned', + /// 'Moving', 'Suspended', 'Warned', 'SystemMaintenance' + /// The list of private + /// endpoint connections that are set up for this resource. + /// Control permission for data plane + /// traffic coming from public networks while private endpoint is + /// enabled. Possible values include: 'Enabled', 'Disabled' + public WorkspaceProperties(string provisioningState = default(string), IList privateEndpointConnections = default(IList), string publicNetworkAccess = default(string)) + { + ProvisioningState = provisioningState; + PrivateEndpointConnections = privateEndpointConnections; + PublicNetworkAccess = publicNetworkAccess; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the provisioning state. Possible values include: + /// 'Deleting', 'Succeeded', 'Creating', 'Accepted', 'Verifying', + /// 'Updating', 'Failed', 'Canceled', 'Deprovisioned', 'Moving', + /// 'Suspended', 'Warned', 'SystemMaintenance' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets the list of private endpoint connections that are set up for + /// this resource. + /// + [JsonProperty(PropertyName = "privateEndpointConnections")] + public IList PrivateEndpointConnections { get; private set; } + + /// + /// Gets or sets control permission for data plane traffic coming from + /// public networks while private endpoint is enabled. Possible values + /// include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationResultsOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationResultsOperations.cs index c037a4dbe436..b50bc5a05085 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationResultsOperations.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationResultsOperations.cs @@ -80,7 +80,7 @@ internal OperationResultsOperations(HealthcareApisManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string locationName, string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string locationName, string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -179,7 +179,7 @@ internal OperationResultsOperations(HealthcareApisManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 404) + if ((int)_statusCode != 200) { var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -209,7 +209,7 @@ internal OperationResultsOperations(HealthcareApisManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -234,24 +234,6 @@ internal OperationResultsOperations(HealthcareApisManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } - // Deserialize Response - if ((int)_statusCode == 404) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationResultsOperationsExtensions.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationResultsOperationsExtensions.cs index 929b7e8c1c5f..f1cd33868190 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationResultsOperationsExtensions.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationResultsOperationsExtensions.cs @@ -33,7 +33,7 @@ public static partial class OperationResultsOperationsExtensions /// /// The ID of the operation result to get. /// - public static object Get(this IOperationResultsOperations operations, string locationName, string operationResultId) + public static OperationResultsDescription Get(this IOperationResultsOperations operations, string locationName, string operationResultId) { return operations.GetAsync(locationName, operationResultId).GetAwaiter().GetResult(); } @@ -53,7 +53,7 @@ public static object Get(this IOperationResultsOperations operations, string loc /// /// The cancellation token. /// - public static async Task GetAsync(this IOperationResultsOperations operations, string locationName, string operationResultId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IOperationResultsOperations operations, string locationName, string operationResultId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(locationName, operationResultId, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Operations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Operations.cs index 5f5cb16bf3f3..0b8037cec7cf 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Operations.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Operations.cs @@ -51,7 +51,8 @@ internal Operations(HealthcareApisManagementClient client) public HealthcareApisManagementClient Client { get; private set; } /// - /// Lists all of the available Healthcare service REST API operations. + /// Lists all of the available operations supported by Microsoft Healthcare + /// resource provider. /// /// /// Headers that will be added to request. @@ -74,7 +75,7 @@ internal Operations(HealthcareApisManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -186,7 +187,7 @@ internal Operations(HealthcareApisManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -199,7 +200,7 @@ internal Operations(HealthcareApisManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -219,7 +220,8 @@ internal Operations(HealthcareApisManagementClient client) } /// - /// Lists all of the available Healthcare service REST API operations. + /// Lists all of the available operations supported by Microsoft Healthcare + /// resource provider. /// /// /// The NextLink from the previous successful call to List operation. @@ -245,7 +247,7 @@ internal Operations(HealthcareApisManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -354,7 +356,7 @@ internal Operations(HealthcareApisManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -367,7 +369,7 @@ internal Operations(HealthcareApisManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationsExtensions.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationsExtensions.cs index 04b65e0846a7..a643dfd06f6a 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationsExtensions.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationsExtensions.cs @@ -22,18 +22,20 @@ namespace Microsoft.Azure.Management.HealthcareApis public static partial class OperationsExtensions { /// - /// Lists all of the available Healthcare service REST API operations. + /// Lists all of the available operations supported by Microsoft Healthcare + /// resource provider. /// /// /// The operations group for this extension method. /// - public static IPage List(this IOperations operations) + public static IPage List(this IOperations operations) { return operations.ListAsync().GetAwaiter().GetResult(); } /// - /// Lists all of the available Healthcare service REST API operations. + /// Lists all of the available operations supported by Microsoft Healthcare + /// resource provider. /// /// /// The operations group for this extension method. @@ -41,7 +43,7 @@ public static IPage List(this IOperations operations) /// /// The cancellation token. /// - public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { @@ -50,7 +52,8 @@ public static IPage List(this IOperations operations) } /// - /// Lists all of the available Healthcare service REST API operations. + /// Lists all of the available operations supported by Microsoft Healthcare + /// resource provider. /// /// /// The operations group for this extension method. @@ -58,13 +61,14 @@ public static IPage List(this IOperations operations) /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListNext(this IOperations operations, string nextPageLink) + public static IPage ListNext(this IOperations operations, string nextPageLink) { return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Lists all of the available Healthcare service REST API operations. + /// Lists all of the available operations supported by Microsoft Healthcare + /// resource provider. /// /// /// The operations group for this extension method. @@ -75,7 +79,7 @@ public static IPage ListNext(this IOperations operations, string next /// /// The cancellation token. /// - public static async Task> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/PrivateEndpointConnectionsOperations.cs index f9e7ede63d27..db0b1a36ae78 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/PrivateEndpointConnectionsOperations.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/PrivateEndpointConnectionsOperations.cs @@ -80,7 +80,7 @@ internal PrivateEndpointConnectionsOperations(HealthcareApisManagementClient cli /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -235,7 +235,7 @@ internal PrivateEndpointConnectionsOperations(HealthcareApisManagementClient cli throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -248,7 +248,7 @@ internal PrivateEndpointConnectionsOperations(HealthcareApisManagementClient cli _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -301,7 +301,7 @@ internal PrivateEndpointConnectionsOperations(HealthcareApisManagementClient cli /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -462,7 +462,7 @@ internal PrivateEndpointConnectionsOperations(HealthcareApisManagementClient cli throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -475,7 +475,7 @@ internal PrivateEndpointConnectionsOperations(HealthcareApisManagementClient cli _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -517,10 +517,10 @@ internal PrivateEndpointConnectionsOperations(HealthcareApisManagementClient cli /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, properties, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, properties, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -588,7 +588,7 @@ internal PrivateEndpointConnectionsOperations(HealthcareApisManagementClient cli /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -764,7 +764,7 @@ internal PrivateEndpointConnectionsOperations(HealthcareApisManagementClient cli throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -777,7 +777,7 @@ internal PrivateEndpointConnectionsOperations(HealthcareApisManagementClient cli _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs index fcdc25e837f0..de90a7843380 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs @@ -35,7 +35,7 @@ public static partial class PrivateEndpointConnectionsOperationsExtensions /// /// The name of the service instance. /// - public static IEnumerable ListByService(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName) + public static IEnumerable ListByService(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName) { return operations.ListByServiceAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); } @@ -55,7 +55,7 @@ public static IEnumerable ListByService(this IPrivate /// /// The cancellation token. /// - public static async Task> ListByServiceAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServiceAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) { @@ -79,7 +79,7 @@ public static IEnumerable ListByService(this IPrivate /// The name of the private endpoint connection associated with the Azure /// resource /// - public static PrivateEndpointConnection Get(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName) + public static PrivateEndpointConnectionDescription Get(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName) { return operations.GetAsync(resourceGroupName, resourceName, privateEndpointConnectionName).GetAwaiter().GetResult(); } @@ -103,7 +103,7 @@ public static PrivateEndpointConnection Get(this IPrivateEndpointConnectionsOper /// /// The cancellation token. /// - public static async Task GetAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) { @@ -131,7 +131,7 @@ public static PrivateEndpointConnection Get(this IPrivateEndpointConnectionsOper /// /// The private endpoint connection properties. /// - public static PrivateEndpointConnection CreateOrUpdate(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties) + public static PrivateEndpointConnectionDescription CreateOrUpdate(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties) { return operations.CreateOrUpdateAsync(resourceGroupName, resourceName, privateEndpointConnectionName, properties).GetAwaiter().GetResult(); } @@ -159,7 +159,7 @@ public static PrivateEndpointConnection CreateOrUpdate(this IPrivateEndpointConn /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, properties, null, cancellationToken).ConfigureAwait(false)) { @@ -232,7 +232,7 @@ public static void Delete(this IPrivateEndpointConnectionsOperations operations, /// /// The private endpoint connection properties. /// - public static PrivateEndpointConnection BeginCreateOrUpdate(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties) + public static PrivateEndpointConnectionDescription BeginCreateOrUpdate(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties) { return operations.BeginCreateOrUpdateAsync(resourceGroupName, resourceName, privateEndpointConnectionName, properties).GetAwaiter().GetResult(); } @@ -260,7 +260,7 @@ public static PrivateEndpointConnection BeginCreateOrUpdate(this IPrivateEndpoin /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, properties, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/PrivateLinkResourcesOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/PrivateLinkResourcesOperations.cs index 86f84eeb29de..068c57db7cdd 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/PrivateLinkResourcesOperations.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/PrivateLinkResourcesOperations.cs @@ -80,7 +80,7 @@ internal PrivateLinkResourcesOperations(HealthcareApisManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -235,7 +235,7 @@ internal PrivateLinkResourcesOperations(HealthcareApisManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -248,7 +248,7 @@ internal PrivateLinkResourcesOperations(HealthcareApisManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -300,7 +300,7 @@ internal PrivateLinkResourcesOperations(HealthcareApisManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -461,7 +461,7 @@ internal PrivateLinkResourcesOperations(HealthcareApisManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -474,7 +474,7 @@ internal PrivateLinkResourcesOperations(HealthcareApisManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/PrivateLinkResourcesOperationsExtensions.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/PrivateLinkResourcesOperationsExtensions.cs index c73da1e3a23e..6a4a6e977c9e 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/PrivateLinkResourcesOperationsExtensions.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/PrivateLinkResourcesOperationsExtensions.cs @@ -33,7 +33,7 @@ public static partial class PrivateLinkResourcesOperationsExtensions /// /// The name of the service instance. /// - public static PrivateLinkResourceListResult ListByService(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string resourceName) + public static PrivateLinkResourceListResultDescription ListByService(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string resourceName) { return operations.ListByServiceAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); } @@ -53,7 +53,7 @@ public static PrivateLinkResourceListResult ListByService(this IPrivateLinkResou /// /// The cancellation token. /// - public static async Task ListByServiceAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByServiceAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) { @@ -76,7 +76,7 @@ public static PrivateLinkResourceListResult ListByService(this IPrivateLinkResou /// /// The name of the private link resource group. /// - public static PrivateLinkResource Get(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string resourceName, string groupName) + public static PrivateLinkResourceDescription Get(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string resourceName, string groupName) { return operations.GetAsync(resourceGroupName, resourceName, groupName).GetAwaiter().GetResult(); } @@ -99,7 +99,7 @@ public static PrivateLinkResource Get(this IPrivateLinkResourcesOperations opera /// /// The cancellation token. /// - public static async Task GetAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string resourceName, string groupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string resourceName, string groupName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, groupName, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/SdkInfo_HealthcareApisManagementClient.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/SdkInfo_HealthcareApisManagementClient.cs index ff1141c40624..894ad8c66d21 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/SdkInfo_HealthcareApisManagementClient.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/SdkInfo_HealthcareApisManagementClient.cs @@ -19,24 +19,21 @@ public static IEnumerable> ApiInfo_HealthcareApisM { return new Tuple[] { - new Tuple("HealthcareApis", "OperationResults", "2020-03-30"), - new Tuple("HealthcareApis", "Operations", "2020-03-30"), - new Tuple("HealthcareApis", "PrivateEndpointConnections", "2020-03-30"), - new Tuple("HealthcareApis", "PrivateLinkResources", "2020-03-30"), - new Tuple("HealthcareApis", "Services", "2020-03-30"), + new Tuple("HealthcareApis", "DicomServices", "2021-11-01"), + new Tuple("HealthcareApis", "FhirDestinations", "2021-11-01"), + new Tuple("HealthcareApis", "FhirServices", "2021-11-01"), + new Tuple("HealthcareApis", "IotConnectorFhirDestination", "2021-11-01"), + new Tuple("HealthcareApis", "IotConnectors", "2021-11-01"), + new Tuple("HealthcareApis", "OperationResults", "2021-11-01"), + new Tuple("HealthcareApis", "Operations", "2021-11-01"), + new Tuple("HealthcareApis", "PrivateEndpointConnections", "2021-11-01"), + new Tuple("HealthcareApis", "PrivateLinkResources", "2021-11-01"), + new Tuple("HealthcareApis", "Services", "2021-11-01"), + new Tuple("HealthcareApis", "WorkspacePrivateEndpointConnections", "2021-11-01"), + new Tuple("HealthcareApis", "WorkspacePrivateLinkResources", "2021-11-01"), + new Tuple("HealthcareApis", "Workspaces", "2021-11-01"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/healthcareapis/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "3faca877220bd1d20af91576946e3e6c5819ce96"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/WorkspacePrivateEndpointConnectionsOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/WorkspacePrivateEndpointConnectionsOperations.cs new file mode 100644 index 000000000000..9fa59fddf2e5 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/WorkspacePrivateEndpointConnectionsOperations.cs @@ -0,0 +1,1007 @@ +// +// 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.HealthcareApis +{ + 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; + + /// + /// WorkspacePrivateEndpointConnectionsOperations operations. + /// + internal partial class WorkspacePrivateEndpointConnectionsOperations : IServiceOperations, IWorkspacePrivateEndpointConnectionsOperations + { + /// + /// Initializes a new instance of the WorkspacePrivateEndpointConnectionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WorkspacePrivateEndpointConnectionsOperations(HealthcareApisManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the HealthcareApisManagementClient + /// + public HealthcareApisManagementClient Client { get; private set; } + + /// + /// Lists all private endpoint connections for a workspace. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspace", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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 specified private endpoint connection associated with the + /// workspace. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update the state of the specified private endpoint connection associated + /// with the workspace. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The private endpoint connection properties. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string privateEndpointConnectionName, PrivateEndpointConnectionDescription properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, privateEndpointConnectionName, properties, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a private endpoint connection. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, privateEndpointConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update the state of the specified private endpoint connection associated + /// with the workspace. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The private endpoint connection properties. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string privateEndpointConnectionName, PrivateEndpointConnectionDescription properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "properties"); + } + if (properties != null) + { + properties.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("properties", properties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + 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(properties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(properties, 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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; + } + + /// + /// Deletes a private endpoint connection. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/WorkspacePrivateEndpointConnectionsOperationsExtensions.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/WorkspacePrivateEndpointConnectionsOperationsExtensions.cs new file mode 100644 index 000000000000..981e3a056a6e --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/WorkspacePrivateEndpointConnectionsOperationsExtensions.cs @@ -0,0 +1,319 @@ +// +// 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.HealthcareApis +{ + 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 WorkspacePrivateEndpointConnectionsOperations. + /// + public static partial class WorkspacePrivateEndpointConnectionsOperationsExtensions + { + /// + /// Lists all private endpoint connections for a workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + public static IEnumerable ListByWorkspace(this IWorkspacePrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName) + { + return operations.ListByWorkspaceAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Lists all private endpoint connections for a workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByWorkspaceAsync(this IWorkspacePrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByWorkspaceWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the specified private endpoint connection associated with the + /// workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + public static PrivateEndpointConnectionDescription Get(this IWorkspacePrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) + { + return operations.GetAsync(resourceGroupName, workspaceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Gets the specified private endpoint connection associated with the + /// workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IWorkspacePrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the state of the specified private endpoint connection associated + /// with the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The private endpoint connection properties. + /// + public static PrivateEndpointConnectionDescription CreateOrUpdate(this IWorkspacePrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, PrivateEndpointConnectionDescription properties) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, privateEndpointConnectionName, properties).GetAwaiter().GetResult(); + } + + /// + /// Update the state of the specified private endpoint connection associated + /// with the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The private endpoint connection properties. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IWorkspacePrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, PrivateEndpointConnectionDescription properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, privateEndpointConnectionName, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + public static void Delete(this IWorkspacePrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) + { + operations.DeleteAsync(resourceGroupName, workspaceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IWorkspacePrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Update the state of the specified private endpoint connection associated + /// with the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The private endpoint connection properties. + /// + public static PrivateEndpointConnectionDescription BeginCreateOrUpdate(this IWorkspacePrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, PrivateEndpointConnectionDescription properties) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, workspaceName, privateEndpointConnectionName, properties).GetAwaiter().GetResult(); + } + + /// + /// Update the state of the specified private endpoint connection associated + /// with the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The private endpoint connection properties. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IWorkspacePrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, PrivateEndpointConnectionDescription properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, privateEndpointConnectionName, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + public static void BeginDelete(this IWorkspacePrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) + { + operations.BeginDeleteAsync(resourceGroupName, workspaceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IWorkspacePrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/WorkspacePrivateLinkResourcesOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/WorkspacePrivateLinkResourcesOperations.cs new file mode 100644 index 000000000000..db40ef8cfd70 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/WorkspacePrivateLinkResourcesOperations.cs @@ -0,0 +1,497 @@ +// +// 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.HealthcareApis +{ + 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; + + /// + /// WorkspacePrivateLinkResourcesOperations operations. + /// + internal partial class WorkspacePrivateLinkResourcesOperations : IServiceOperations, IWorkspacePrivateLinkResourcesOperations + { + /// + /// Initializes a new instance of the WorkspacePrivateLinkResourcesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WorkspacePrivateLinkResourcesOperations(HealthcareApisManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the HealthcareApisManagementClient + /// + public HealthcareApisManagementClient Client { get; private set; } + + /// + /// Gets the private link resources that need to be created for a workspace. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspace", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/privateLinkResources").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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 private link resource that need to be created for a workspace. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private link resource group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (groupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "groupName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("groupName", groupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/privateLinkResources/{groupName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{groupName}", System.Uri.EscapeDataString(groupName)); + 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/WorkspacePrivateLinkResourcesOperationsExtensions.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/WorkspacePrivateLinkResourcesOperationsExtensions.cs new file mode 100644 index 000000000000..e1171726d4f4 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/WorkspacePrivateLinkResourcesOperationsExtensions.cs @@ -0,0 +1,113 @@ +// +// 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.HealthcareApis +{ + 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 WorkspacePrivateLinkResourcesOperations. + /// + public static partial class WorkspacePrivateLinkResourcesOperationsExtensions + { + /// + /// Gets the private link resources that need to be created for a workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + public static IEnumerable ListByWorkspace(this IWorkspacePrivateLinkResourcesOperations operations, string resourceGroupName, string workspaceName) + { + return operations.ListByWorkspaceAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the private link resources that need to be created for a workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByWorkspaceAsync(this IWorkspacePrivateLinkResourcesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByWorkspaceWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a private link resource that need to be created for a workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private link resource group. + /// + public static PrivateLinkResourceDescription Get(this IWorkspacePrivateLinkResourcesOperations operations, string resourceGroupName, string workspaceName, string groupName) + { + return operations.GetAsync(resourceGroupName, workspaceName, groupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a private link resource that need to be created for a workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The name of the private link resource group. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IWorkspacePrivateLinkResourcesOperations operations, string resourceGroupName, string workspaceName, string groupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, groupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/WorkspacesOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/WorkspacesOperations.cs new file mode 100644 index 000000000000..bbde0e549f42 --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/WorkspacesOperations.cs @@ -0,0 +1,1761 @@ +// +// 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.HealthcareApis +{ + 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; + + /// + /// WorkspacesOperations operations. + /// + internal partial class WorkspacesOperations : IServiceOperations, IWorkspacesOperations + { + /// + /// Initializes a new instance of the WorkspacesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WorkspacesOperations(HealthcareApisManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the HealthcareApisManagementClient + /// + public HealthcareApisManagementClient Client { get; private set; } + + /// + /// Lists all the available workspaces under the specified subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/workspaces").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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 available workspaces under the specified resource group. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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 properties of the specified workspace. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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 or updates a workspace resource with the specified parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for creating or updating a healthcare workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace workspace, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, workspace, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Patch workspace details. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a specified workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, WorkspacePatchResource workspacePatchResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, workspacePatchResource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a specified workspace. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates a workspace resource with the specified parameters. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for creating or updating a healthcare workspace. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace workspace, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (workspace == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspace"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("workspace", workspace); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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(workspace != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workspace, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Patch workspace details. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a specified workspace. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, WorkspacePatchResource workspacePatchResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + if (workspacePatchResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspacePatchResource"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("workspacePatchResource", workspacePatchResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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(workspacePatchResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workspacePatchResource, 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 ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a specified workspace. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 24); + } + if (workspaceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 3); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the available workspaces under the specified subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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 available workspaces under the specified resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _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/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/WorkspacesOperationsExtensions.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/WorkspacesOperationsExtensions.cs new file mode 100644 index 000000000000..4f2b32c4894b --- /dev/null +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/WorkspacesOperationsExtensions.cs @@ -0,0 +1,453 @@ +// +// 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.HealthcareApis +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WorkspacesOperations. + /// + public static partial class WorkspacesOperationsExtensions + { + /// + /// Lists all the available workspaces under the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this IWorkspacesOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all the available workspaces under the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IWorkspacesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the available workspaces under the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + public static IPage ListByResourceGroup(this IWorkspacesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all the available workspaces under the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IWorkspacesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the properties of the specified workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + public static Workspace Get(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the properties of the specified workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a workspace resource with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for creating or updating a healthcare workspace. + /// + public static Workspace CreateOrUpdate(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, Workspace workspace) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, workspace).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a workspace resource with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for creating or updating a healthcare workspace. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, Workspace workspace, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, workspace, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Patch workspace details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a specified workspace. + /// + public static Workspace Update(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, WorkspacePatchResource workspacePatchResource) + { + return operations.UpdateAsync(resourceGroupName, workspaceName, workspacePatchResource).GetAwaiter().GetResult(); + } + + /// + /// Patch workspace details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a specified workspace. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, WorkspacePatchResource workspacePatchResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, workspacePatchResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a specified workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + public static void Delete(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + { + operations.DeleteAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a specified workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates a workspace resource with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for creating or updating a healthcare workspace. + /// + public static Workspace BeginCreateOrUpdate(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, Workspace workspace) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, workspaceName, workspace).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a workspace resource with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for creating or updating a healthcare workspace. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, Workspace workspace, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, workspace, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Patch workspace details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a specified workspace. + /// + public static Workspace BeginUpdate(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, WorkspacePatchResource workspacePatchResource) + { + return operations.BeginUpdateAsync(resourceGroupName, workspaceName, workspacePatchResource).GetAwaiter().GetResult(); + } + + /// + /// Patch workspace details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The parameters for updating a specified workspace. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, WorkspacePatchResource workspacePatchResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, workspacePatchResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a specified workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + public static void BeginDelete(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + { + operations.BeginDeleteAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a specified workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of workspace resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all the available workspaces under the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IWorkspacesOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the available workspaces under the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this IWorkspacesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the available workspaces under the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IWorkspacesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the available workspaces under the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IWorkspacesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}