diff --git a/src/SDKs/HealthcareApis/AzSdk.RP.props b/src/SDKs/HealthcareApis/AzSdk.RP.props new file mode 100644 index 0000000000000..b1d9a41b2f4bb --- /dev/null +++ b/src/SDKs/HealthcareApis/AzSdk.RP.props @@ -0,0 +1,7 @@ + + + + HealthcareApis_2018-08-20-preview; + $(PackageTags);$(CommonTags);$(AzureApiTag); + + \ No newline at end of file diff --git a/src/SDKs/HealthcareApis/HealthcareApis.Tests/HealthcareApis.Tests.csproj b/src/SDKs/HealthcareApis/HealthcareApis.Tests/HealthcareApis.Tests.csproj new file mode 100644 index 0000000000000..7a08cc9abd2c4 --- /dev/null +++ b/src/SDKs/HealthcareApis/HealthcareApis.Tests/HealthcareApis.Tests.csproj @@ -0,0 +1,64 @@ + + + + netstandard2.0 + + Library + + + + + HealthcareApis.Tests + HealthcareApis.Tests Class Library + HealthcareApis.Tests + 1.0.0-preview + + + + TRACE;netcoreapp20;DebugInVS + bin\Debug\ + obj\Debug\netcoreapp2.0\HealthcareApis.Tests.xml + + + + + + + + + + + + + + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + + diff --git a/src/SDKs/HealthcareApis/HealthcareApis.Tests/Helpers/HealthcareApisManagementTestUtilities.cs b/src/SDKs/HealthcareApis/HealthcareApis.Tests/Helpers/HealthcareApisManagementTestUtilities.cs new file mode 100644 index 0000000000000..ac0ec46ea6c94 --- /dev/null +++ b/src/SDKs/HealthcareApis/HealthcareApis.Tests/Helpers/HealthcareApisManagementTestUtilities.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using Microsoft.Azure.Management.HealthcareApis; +using Microsoft.Azure.Management.HealthcareApis.Models; +using Microsoft.Rest; +using Microsoft.Azure.Management.ResourceManager; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using System; +using System.Collections.Generic; +using System.Net.Http; +using Xunit; +using Microsoft.Azure.Management.ResourceManager.Models; + +namespace HealthcareApis.Tests.Helpers +{ + public static class HealthcareApisManagementTestUtilities + { + public static bool IsTestTenant = false; + private static HttpClientHandler Handler = null; + private static Uri testUri = null; + + // These are used to create default accounts + public static string DefaultLocation = IsTestTenant ? null : "westus"; + public const string DefaultKind = "Fhir"; + public static Dictionary DefaultTags = new Dictionary + { + {"key1","value1"}, + {"key2","value2"} + }; + + public static Dictionary UpdateTags = new Dictionary + { + {"key3","value3"}, + {"key4","value4"}, + {"key5", "value5"} + }; + + public static string objectId = "7df19f2f-6169-40f0-ac1e-9a9b4e65a898"; + public static string authority = "https://login.microsoftonline.com/common"; + public static string audience = "https://azurehealthcareapis.com"; + public static bool smartOnFhirEnabled = false; + public static int offerThroughput = 400; + + private static HttpClientHandler GetHandler() + { + return Handler; + } + + public static HealthcareApisManagementClient GetHealthcareApisManagementClient(MockContext context, RecordedDelegatingHandler handler) + { + HealthcareApisManagementClient healthcareApisManagementClient; + if (IsTestTenant) + { + healthcareApisManagementClient = new HealthcareApisManagementClient(new TokenCredentials("xyz"), GetHandler()); + healthcareApisManagementClient.SubscriptionId = "testSubscription"; + healthcareApisManagementClient.BaseUri = testUri; + } + else + { + handler.IsPassThrough = true; + healthcareApisManagementClient = context.GetServiceClient(handlers: handler); + } + return healthcareApisManagementClient; + } + + public static ServicesDescription GetServiceDescription() + { + var serviceDescription = new ServicesDescription(DefaultLocation); + return serviceDescription; + } + + public static ServicesPatchDescription GetServicePatchDescription() + { + var servicePatchDescription = new ServicesPatchDescription(UpdateTags); + return servicePatchDescription; + } + + public static ServicesDescription GetServiceDescriptionWithProperties() + { + var serviceProperties = GetServiceProperties(); + var serviceDescription = new ServicesDescription(DefaultLocation, default(string), default(string), default(string), DefaultTags, default(string), serviceProperties); + return serviceDescription; + } + + public static ServicesProperties GetServiceProperties() + { + IList accessPolicies = new List(); + accessPolicies.Add(new ServiceAccessPolicyEntry(objectId)); + + string provisioningState = "Succeeded"; + + ServiceCosmosDbConfigurationInfo cosmosDbConfigurationInfo = new ServiceCosmosDbConfigurationInfo(offerThroughput); + ServiceAuthenticationConfigurationInfo authenticationConfigurationInfo = new ServiceAuthenticationConfigurationInfo(authority, audience, smartOnFhirEnabled); + + var serviceProperties = new ServicesProperties(accessPolicies, provisioningState, cosmosDbConfigurationInfo, authenticationConfigurationInfo); + + return serviceProperties; + } + + public static string CreateHealthcareApisAccount(HealthcareApisManagementClient healthcareApisManagementClient, string rgname, string kind = null) + { + // Generate account name + string accountName = TestUtilities.GenerateName("hca"); + + // Create healthcareApis account + var createdAccount = healthcareApisManagementClient.Services.CreateOrUpdate(rgname, accountName, GetServiceDescriptionWithProperties()); + + return accountName; + } + + public static void VerifyAccountProperties(ServicesDescription account, bool useDefaults, string location = "westus") + { + // verifies that the account is actually created + Assert.NotNull(account); + Assert.NotNull(account.Id); + Assert.NotNull(account.Location); + Assert.NotNull(account.Name); + Assert.NotNull(account.Etag); + Assert.NotNull(account.Properties); + Assert.Equal(ProvisioningState.Succeeded, account.Properties.ProvisioningState); + + if (!useDefaults) + { + Assert.NotNull(account.Properties.AuthenticationConfiguration); + Assert.NotNull(account.Properties.CosmosDbConfiguration); + Assert.NotNull(account.Properties.AccessPolicies); + Assert.Equal("https://login.microsoftonline.com/common", account.Properties.AuthenticationConfiguration.Authority); + Assert.Equal("https://azurehealthcareapis.com", account.Properties.AuthenticationConfiguration.Audience); + Assert.False(account.Properties.AuthenticationConfiguration.SmartProxyEnabled); + Assert.Equal(400, account.Properties.CosmosDbConfiguration.OfferThroughput); + Assert.Equal(1, account.Properties.AccessPolicies.Count); + Assert.Equal(ProvisioningState.Succeeded, account.Properties.ProvisioningState); + } + } + + public static void ValidateExpectedException(Action action, string expectedErrorCode) + { + try + { + action(); + Assert.True(false, "Expected an Exception"); + } + catch (ErrorDetailsException e) + { + Assert.Equal(expectedErrorCode, e.Response.StatusCode.ToString()); + } + } + + public static ResourceManagementClient GetResourceManagementClient(MockContext context, RecordedDelegatingHandler handler) + { + if (IsTestTenant) + { + return null; + } + else + { + handler.IsPassThrough = true; + ResourceManagementClient resourcesClient = context.GetServiceClient(handlers: handler); + return resourcesClient; + } + } + + public static string CreateResourceGroup(ResourceManagementClient resourcesClient) + { + var rgname = "res7089"; + + if (!IsTestTenant) + { + var resourceGroup = resourcesClient.ResourceGroups.CreateOrUpdateAsync( + rgname, + new ResourceGroup + { + Location = DefaultLocation + }); + } + return rgname; + } + } +} diff --git a/src/SDKs/HealthcareApis/HealthcareApis.Tests/Helpers/RecordedDelegatingHandler.cs b/src/SDKs/HealthcareApis/HealthcareApis.Tests/Helpers/RecordedDelegatingHandler.cs new file mode 100644 index 0000000000000..dc8d149ed1fea --- /dev/null +++ b/src/SDKs/HealthcareApis/HealthcareApis.Tests/Helpers/RecordedDelegatingHandler.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Threading.Tasks; + +namespace HealthcareApis.Tests.Helpers +{ + public class RecordedDelegatingHandler : DelegatingHandler + { + + private HttpResponseMessage _response; + + public RecordedDelegatingHandler() + { + StatusCodeToReturn = HttpStatusCode.Created; + SubsequentStatusCodeToReturn = StatusCodeToReturn; + } + + public HttpStatusCode StatusCodeToReturn { get; set; } + + public HttpStatusCode SubsequentStatusCodeToReturn { get; set; } + + public string Request { get; private set; } + + public HttpRequestHeaders RequestHeaders { get; private set; } + + public HttpContentHeaders ContentHeaders { get; private set; } + + public HttpMethod Method { get; private set; } + + public Uri Uri { get; private set; } + + public bool IsPassThrough { get; set; } + + private int counter; + + protected override async Task SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) + { + counter++; + // Save request + if (request.Content == null) + { + Request = string.Empty; + } + else + { + Request = await request.Content.ReadAsStringAsync(); + } + RequestHeaders = request.Headers; + if (request.Content != null) + { + ContentHeaders = request.Content.Headers; + } + Method = request.Method; + Uri = request.RequestUri; + + // Prepare response + if (IsPassThrough) + { + return await base.SendAsync(request, cancellationToken); + } + else + { + if (_response != null && counter == 1) + { + return _response; + } + else + { + var statusCode = StatusCodeToReturn; + if (counter > 1) + statusCode = SubsequentStatusCodeToReturn; + HttpResponseMessage response = new HttpResponseMessage(statusCode); + response.Content = new StringContent(""); + return response; + } + } + } + } +} diff --git a/src/SDKs/HealthcareApis/HealthcareApis.Tests/Properties/AssemblyInfo.cs b/src/SDKs/HealthcareApis/HealthcareApis.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000..9bbfe4bf0acab --- /dev/null +++ b/src/SDKs/HealthcareApis/HealthcareApis.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("HealthcareApis.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("HP Inc.")] +[assembly: AssemblyProduct("HealthcareApis.Tests")] +[assembly: AssemblyCopyright("Copyright © HP Inc. 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("060a808a-4de1-4072-9def-9dc75a353c51")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisAccountUpdateWithCreateTest.json b/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisAccountUpdateWithCreateTest.json new file mode 100644 index 0000000000000..799a499be1159 --- /dev/null +++ b/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisAccountUpdateWithCreateTest.json @@ -0,0 +1,307 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourcegroups/res7089?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYzI0Mzc0NWQtNTBiYi00OGQxLTllNjItM2Y3MmVmYjMxNjZjL3Jlc291cmNlZ3JvdXBzL3JlczcwODk/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"westus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ], + "x-ms-client-request-id": [ + "89e61421-87a0-4d25-b6a1-946a8f9df00b" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089\",\r\n \"name\": \"hca1234\",\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "167" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 08:09:16 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1181" + ], + "x-ms-request-id": [ + "d55f54ca-0ad2-4798-9741-a96462bd1cb8" + ], + "x-ms-correlation-request-id": [ + "9e622289-028e-44a3-bbcd-904ae16adbd3" + ], + "x-ms-routing-request-id": [ + "WESTUS:20190618T153235Z:d55f54ca-0ad2-4798-9741-a96462bd1cb8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/services/hca1234?api-version=2018-08-20-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2MxNDhiZjItNDJmYi00OTEzLWEzZmItMmYyODRhNjllYjg5L3Jlc291cmNlR3JvdXBzL3JlczcwODkvcHJvdmlkZXJzL01pY3Jvc29mdC5IZWFsdGhjYXJlQXBpcy9zZXJ2aWNlcy9oY2ExMjM0P2FwaS12ZXJzaW9uPTIwMTgtMDgtMjAtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"name\": \"S1\"\r\n ,\r\n \"location\": \"westus\",\r\n \"properties\": {}\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "113" + ], + "x-ms-client-request-id": [ + "39bce3ac-f86e-490f-92d3-260643c3a770" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.HealthcareApis.HealthcareApisManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/accounts/hca1234\",\r\n \"name\": \"hca1234\",\r\n \"type\": \"Microsoft.HealthcareApis/accounts\",\r\n \"etag\": \"\\\"0a002ee3-0000-0000-0000-5aa238d80000\\\"\",\r\n \"location\": \"westus\",\r\n \"name\": \"S1\"\r\n ,\r\n \"kind\": \"Fhir\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "570" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 07:33:44 GMT" + ], + "Pragma": [ + "no-cache" + ], + "ETag": [ + "\"0a002ee3-0000-0000-0000-5aa238d80000\"" + ], + "Server": [ + "Microsoft-IIS/10.0" + ], + "x-ms-request-id": [ + "2263b931-e233-4217-bfba-448ee3ac8346" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "x-ms-correlation-request-id": [ + "977d2f5c-4af0-4c2e-8068-6de427d796c0" + ], + "x-ms-routing-request-id": [ + "WESTUS:20180309T073344Z:977d2f5c-4af0-4c2e-8068-6de427d796c0" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/services/hca1234?api-version=2018-08-20-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2MxNDhiZjItNDJmYi00OTEzLWEzZmItMmYyODRhNjllYjg5L3Jlc291cmNlR3JvdXBzL3JlczcwODkvcHJvdmlkZXJzL01pY3Jvc29mdC5IZWFsdGhjYXJlQXBpcy9zZXJ2aWNlcy9oY2ExMjM0P2FwaS12ZXJzaW9uPTIwMTgtMDgtMjAtcHJldmlldw==", + "RequestMethod": "PATCH", + "RequestBody": "{\r\n \"tags\": {\r\n \"key3\": \"value3\",\r\n \"key4\": \"value4\",\r\n \"key5\": \"value5\"\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "90" + ], + "x-ms-client-request-id": [ + "89a2cb9c-7fe3-46ea-9379-4c74c189c3a2" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.HealthcareApis.HealthcareApisManagementClient/1.0.0.0\"" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/services/account1234\",\r\n \"name\": \"account1234\",\r\n \"type\": \"Microsoft.HealthcareApis/accounts\",\r\n \"location\": \"westus\",\r\n \"name\": \"S1\"\r\n ,\r\n \"kind\": \"Fhir\",\r\n \"tags\": {\r\n \"key3\": \"value3\",\r\n \"key4\": \"value4\",\r\n \"key5\": \"value5\"\r\n },\"properties\": {\"provisioningState\": \"Succeeded\"}}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 07:49:32 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "ETag": [ + "\"0a00d3f7-0000-0000-0000-5aa23c8c0000\"" + ], + "Server": [ + "Microsoft-IIS/10.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "7fd27fd6-93bf-44e3-8cd1-bcda43236a37" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1187" + ], + "x-ms-correlation-request-id": [ + "3c0db97e-ee18-4c7d-a994-0ca1195cec0c" + ], + "x-ms-routing-request-id": [ + "JAPANWEST:20180309T074933Z:3c0db97e-ee18-4c7d-a994-0ca1195cec0c" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/services/hca1234?api-version=2018-08-20-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2MxNDhiZjItNDJmYi00OTEzLWEzZmItMmYyODRhNjllYjg5L3Jlc291cmNlR3JvdXBzL3JlczcwODkvcHJvdmlkZXJzL01pY3Jvc29mdC5IZWFsdGhjYXJlQXBpcy9zZXJ2aWNlcy9oY2ExMjM0P2FwaS12ZXJzaW9uPTIwMTgtMDgtMjAtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "65c39c9c-dcfd-47d3-a5ea-a98bfd4989bb" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.HealthcareApis.HealthcareApisManagementClient/3.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/services/hca1234\",\r\n \"name\": \"hca1234\",\r\n \"type\": \"Microsoft.HealthcareApis/accounts\",\r\n \"location\": \"westus\",\r\n \"name\": \"S1\"\r\n ,\r\n \"kind\": \"Fhir\",\r\n \"tags\": {\r\n \"key3\": \"value3\",\r\n \"key4\": \"value4\",\r\n \"key5\": \"value5\"\r\n },\"properties\": {\"provisioningState\": \"Succeeded\"}}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 07:49:29 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "ETag": [ + "\"0a00bcf7-0000-0000-0000-5aa23c880000\"" + ], + "Server": [ + "Microsoft-IIS/10.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "4697a59a-84eb-4e5c-967e-085b2a555af8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14953" + ], + "x-ms-correlation-request-id": [ + "122819a6-98f9-4c61-b68c-c06a134c084f" + ], + "x-ms-routing-request-id": [ + "JAPANWEST:20180309T074930Z:122819a6-98f9-4c61-b68c-c06a134c084f" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "CreateResourceGroup": [ + "res7089" + ], + "HealthcareApisAccountUpdateWithCreateTest": [ + "hca1234" + ] + }, + "Variables": { + "SubscriptionId": "cc148bf2-42fb-4913-a3fb-2f284a69eb89" + } +} diff --git a/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisCheckNameAvailabilityTest.json b/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisCheckNameAvailabilityTest.json new file mode 100644 index 0000000000000..8a24d600e2837 --- /dev/null +++ b/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisCheckNameAvailabilityTest.json @@ -0,0 +1,80 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/providers/Microsoft.HealthcareApis/checkNameAvailability?api-version=2018-08-20-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2MxNDhiZjItNDJmYi00OTEzLWEzZmItMmYyODRhNjllYjg5L3Byb3ZpZGVycy9NaWNyb3NvZnQuSGVhbHRoY2FyZUFwaXMvY2hlY2tOYW1lQXZhaWxhYmlsaXR5P2FwaS12ZXJzaW9uPTIwMTgtMDgtMjAtcHJldmlldw==", + "RequestMethod": "POST", + "RequestBody": "{\"name\":\"account1234\",\"type\":\"Microsoft.HealthcareApis/services\"}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "57" + ], + "x-ms-client-request-id": [ + "ac7f273b-1df8-4c11-ab39-56f409c338c4" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01" + ] + }, + "ResponseBody": "{\"nameAvailable\": true,\"reason\": null,\"message\": null}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Tue, 16 May 2017 07:09:31 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-IIS/8.5" + ], + "Vary": [ + "Accept-Encoding" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1190" + ], + "x-ms-request-id": [ + "f2b7789d-64df-415a-b750-21f95c2e9a43" + ], + "x-ms-correlation-request-id": [ + "f2b7789d-64df-415a-b750-21f95c2e9a43" + ], + "x-ms-routing-request-id": [ + "JAPANEAST:20170516T070931Z:f2b7789d-64df-415a-b750-21f95c2e9a43" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "cc148bf2-42fb-4913-a3fb-2f284a69eb89" + } +} \ No newline at end of file diff --git a/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisCreateAccountErrorTest.json b/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisCreateAccountErrorTest.json new file mode 100644 index 0000000000000..fe25e66f46695 --- /dev/null +++ b/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisCreateAccountErrorTest.json @@ -0,0 +1,155 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourcegroups/res7089?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYzI0Mzc0NWQtNTBiYi00OGQxLTllNjItM2Y3MmVmYjMxNjZjL3Jlc291cmNlZ3JvdXBzL3JlczcwODk/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"westus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ], + "x-ms-client-request-id": [ + "89e61421-87a0-4d25-b6a1-946a8f9df00b" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089\",\r\n \"name\": \"hca1234\",\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "167" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 08:09:16 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1181" + ], + "x-ms-request-id": [ + "d55f54ca-0ad2-4798-9741-a96462bd1cb8" + ], + "x-ms-correlation-request-id": [ + "9e622289-028e-44a3-bbcd-904ae16adbd3" + ], + "x-ms-routing-request-id": [ + "WESTUS:20190618T153235Z:d55f54ca-0ad2-4798-9741-a96462bd1cb8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/NotExistedRG/providers/Microsoft.HealthcareApis/services/hca1234?api-version=2018-08-20-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2MxNDhiZjItNDJmYi00OTEzLWEzZmItMmYyODRhNjllYjg5L3Jlc291cmNlR3JvdXBzL05vdEV4aXN0ZWRSRy9wcm92aWRlcnMvTWljcm9zb2Z0LkhlYWx0aGNhcmVBcGlzL3NlcnZpY2VzL2hjYTEyMzQ/YXBpLXZlcnNpb249MjAxOC0wOC0yMC1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"name\": \"S1\"\r\n ,\r\n \"location\": \"westus\",\r\n \"properties\": {}\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "113" + ], + "x-ms-client-request-id": [ + "39bce3ac-f86e-490f-92d3-260643c3a770" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.HealthcareApis.HealthcareApisManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"ResourceGroupNotFound\",\r\n \"message\": \"Resource group 'NotExistedRG' could not be found.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "104" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 07:33:44 GMT" + ], + "Pragma": [ + "no-cache" + ], + "ETag": [ + "\"0a002ee3-0000-0000-0000-5aa238d80000\"" + ], + "Server": [ + "Microsoft-IIS/10.0" + ], + "x-ms-request-id": [ + "2263b931-e233-4217-bfba-448ee3ac8346" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "x-ms-correlation-request-id": [ + "977d2f5c-4af0-4c2e-8068-6de427d796c0" + ], + "x-ms-routing-request-id": [ + "WESTUS:20180309T073344Z:977d2f5c-4af0-4c2e-8068-6de427d796c0" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 404 + } + ], + "Names": { + "CreateResourceGroup": [ + "res7089" + ], + "HealthcareApisCreateAccountErrorTest": [ + "hca1234" + ] + }, + "Variables": { + "SubscriptionId": "cc148bf2-42fb-4913-a3fb-2f284a69eb89" + } +} diff --git a/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisCreateTest.json b/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisCreateTest.json new file mode 100644 index 0000000000000..47cac5653604f --- /dev/null +++ b/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisCreateTest.json @@ -0,0 +1,155 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourcegroups/res7089?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYzI0Mzc0NWQtNTBiYi00OGQxLTllNjItM2Y3MmVmYjMxNjZjL3Jlc291cmNlZ3JvdXBzL3JlczcwODk/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"westus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ], + "x-ms-client-request-id": [ + "89e61421-87a0-4d25-b6a1-946a8f9df00b" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089\",\r\n \"name\": \"account1234\",\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "167" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 08:09:16 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1181" + ], + "x-ms-request-id": [ + "d55f54ca-0ad2-4798-9741-a96462bd1cb8" + ], + "x-ms-correlation-request-id": [ + "9e622289-028e-44a3-bbcd-904ae16adbd3" + ], + "x-ms-routing-request-id": [ + "WESTUS:20190618T153235Z:d55f54ca-0ad2-4798-9741-a96462bd1cb8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/services/hca1234?api-version=2018-08-20-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2MxNDhiZjItNDJmYi00OTEzLWEzZmItMmYyODRhNjllYjg5L3Jlc291cmNlR3JvdXBzL3JlczcwODkvcHJvdmlkZXJzL01pY3Jvc29mdC5IZWFsdGhjYXJlQXBpcy9zZXJ2aWNlcy9oY2ExMjM0P2FwaS12ZXJzaW9uPTIwMTgtMDgtMjAtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"name\": \"S1\"\r\n,\r\n \"location\": \"westus\",\r\n \"properties\": {}\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "113" + ], + "x-ms-client-request-id": [ + "39bce3ac-f86e-490f-92d3-260643c3a770" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.HealthcareApis.HealthcareApisManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/accounts/hca1234\",\r\n \"name\": \"hca1234\",\r\n \"type\": \"Microsoft.HealthcareApis/accounts\",\r\n \"etag\": \"\\\"0a002ee3-0000-0000-0000-5aa238d80000\\\"\",\r\n \"location\": \"westus\",\r\n \"name\": \"S1\"\r\n ,\r\n \"kind\": \"Fhir\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "570" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 07:33:44 GMT" + ], + "Pragma": [ + "no-cache" + ], + "ETag": [ + "\"0a002ee3-0000-0000-0000-5aa238d80000\"" + ], + "Server": [ + "Microsoft-IIS/10.0" + ], + "x-ms-request-id": [ + "2263b931-e233-4217-bfba-448ee3ac8346" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "x-ms-correlation-request-id": [ + "977d2f5c-4af0-4c2e-8068-6de427d796c0" + ], + "x-ms-routing-request-id": [ + "WESTUS:20180309T073344Z:977d2f5c-4af0-4c2e-8068-6de427d796c0" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 201 + } + ], + "Names": { + "CreateResourceGroup": [ + "res7089" + ], + "HealthcareApisCreateTest": [ + "hca1234" + ] + }, + "Variables": { + "SubscriptionId": "cc148bf2-42fb-4913-a3fb-2f284a69eb89" + } +} diff --git a/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisCreateWithParametersTest.json b/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisCreateWithParametersTest.json new file mode 100644 index 0000000000000..8879c710f9725 --- /dev/null +++ b/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisCreateWithParametersTest.json @@ -0,0 +1,155 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourcegroups/res7089?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYzI0Mzc0NWQtNTBiYi00OGQxLTllNjItM2Y3MmVmYjMxNjZjL3Jlc291cmNlZ3JvdXBzL3JlczcwODk/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"westus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ], + "x-ms-client-request-id": [ + "89e61421-87a0-4d25-b6a1-946a8f9df00b" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089\",\r\n \"name\": \"hca1234\",\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "167" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 08:09:16 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1181" + ], + "x-ms-request-id": [ + "d55f54ca-0ad2-4798-9741-a96462bd1cb8" + ], + "x-ms-correlation-request-id": [ + "9e622289-028e-44a3-bbcd-904ae16adbd3" + ], + "x-ms-routing-request-id": [ + "WESTUS:20190618T153235Z:d55f54ca-0ad2-4798-9741-a96462bd1cb8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/services/hca1234?api-version=2018-08-20-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2MxNDhiZjItNDJmYi00OTEzLWEzZmItMmYyODRhNjllYjg5L3Jlc291cmNlR3JvdXBzL3JlczcwODkvcHJvdmlkZXJzL01pY3Jvc29mdC5IZWFsdGhjYXJlQXBpcy9zZXJ2aWNlcy9oY2ExMjM0P2FwaS12ZXJzaW9uPTIwMTgtMDgtMjAtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{ \"name\": \"S1\" ,\"location\":\"westus\", \"properties\": { \"authenticationConfiguration\": { \"authority\": \"https://login.microsoftonline.com/common\",\"audience\": \"https://azurehealthcareapis.com\",\"smartProxyEnabled\": \"false\" },\"cosmosDbConfiguration\": {\"offerThroughput\": \"400\"},\"accessPolicies\": [ {\"objectId\": \"7df19f2f-6169-40f0-ac1e-9a9b4e65a898\"}]}}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "113" + ], + "x-ms-client-request-id": [ + "39bce3ac-f86e-490f-92d3-260643c3a770" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.HealthcareApis.HealthcareApisManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/accounts/hca1234\",\r\n \"name\": \"hca1234\",\r\n \"type\": \"Microsoft.HealthcareApis/accounts\",\r\n \"etag\": \"\\\"0a002ee3-0000-0000-0000-5aa238d80000\\\"\",\r\n \"location\": \"westus\",\r\n \"name\": \"S1\"\r\n ,\r\n \"kind\": \"Fhir\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n , \"authenticationConfiguration\": { \"authority\": \"https://login.microsoftonline.com/common\",\"audience\": \"https://azurehealthcareapis.com\",\"smartProxyEnabled\": \"false\" },\"cosmosDbConfiguration\": {\"offerThroughput\": \"400\"},\"accessPolicies\": [ {\"objectId\": \"7df19f2f-6169-40f0-ac1e-9a9b4e65a898\"}]}}\r\n", + "ResponseHeaders": { + "Content-Length": [ + "570" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 07:33:44 GMT" + ], + "Pragma": [ + "no-cache" + ], + "ETag": [ + "\"0a002ee3-0000-0000-0000-5aa238d80000\"" + ], + "Server": [ + "Microsoft-IIS/10.0" + ], + "x-ms-request-id": [ + "2263b931-e233-4217-bfba-448ee3ac8346" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "x-ms-correlation-request-id": [ + "977d2f5c-4af0-4c2e-8068-6de427d796c0" + ], + "x-ms-routing-request-id": [ + "WESTUS:20180309T073344Z:977d2f5c-4af0-4c2e-8068-6de427d796c0" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 201 + } + ], + "Names": { + "CreateResourceGroup": [ + "res7089" + ], + "HealthcareApisCreateWithParametersTest": [ + "hca1234" + ] + }, + "Variables": { + "SubscriptionId": "cc148bf2-42fb-4913-a3fb-2f284a69eb89" + } +} diff --git a/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisDeleteAccountErrorTest.json b/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisDeleteAccountErrorTest.json new file mode 100644 index 0000000000000..0a3ba6b454dff --- /dev/null +++ b/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisDeleteAccountErrorTest.json @@ -0,0 +1,139 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourcegroups/res7089?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYzI0Mzc0NWQtNTBiYi00OGQxLTllNjItM2Y3MmVmYjMxNjZjL3Jlc291cmNlZ3JvdXBzL3JlczcwODk/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"westus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ], + "x-ms-client-request-id": [ + "89e61421-87a0-4d25-b6a1-946a8f9df00b" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089\",\r\n \"name\": \"hca1234\",\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "167" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 08:09:16 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1181" + ], + "x-ms-request-id": [ + "d55f54ca-0ad2-4798-9741-a96462bd1cb8" + ], + "x-ms-correlation-request-id": [ + "9e622289-028e-44a3-bbcd-904ae16adbd3" + ], + "x-ms-routing-request-id": [ + "WESTUS:20190618T153235Z:d55f54ca-0ad2-4798-9741-a96462bd1cb8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/NotExistedRG/providers/Microsoft.HealthcareApis/services/nonExistedAccountName?api-version=2018-08-20-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2MxNDhiZjItNDJmYi00OTEzLWEzZmItMmYyODRhNjllYjg5L3Jlc291cmNlR3JvdXBzL05vdEV4aXN0ZWRSRy9wcm92aWRlcnMvTWljcm9zb2Z0LkhlYWx0aGNhcmVBcGlzL3NlcnZpY2VzL25vbkV4aXN0ZWRBY2NvdW50TmFtZT9hcGktdmVyc2lvbj0yMDE4LTA4LTIwLXByZXZpZXc=", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ], + "x-ms-client-request-id": [ + "ccfc3a51-0fa5-4fbf-be57-638efc84c3e2" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.HealthcareApis.HealthcareApisManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"ResourceGroupNotFound\",\r\n \"message\": \"Resource group 'NotExistedRG' could not be found.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "104" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 26 May 2017 11:20:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-IIS/8.5" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1194" + ], + "x-ms-request-id": [ + "7824fc5b-dcea-46b4-91b8-2992ec8a8bf6" + ], + "x-ms-correlation-request-id": [ + "7824fc5b-dcea-46b4-91b8-2992ec8a8bf6" + ], + "x-ms-routing-request-id": [ + "WESTUS:20170526T112000Z:7824fc5b-dcea-46b4-91b8-2992ec8a8bf6" + ] + }, + "StatusCode": 404 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "cc148bf2-42fb-4913-a3fb-2f284a69eb89" + } +} diff --git a/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisDeleteTest.json b/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisDeleteTest.json new file mode 100644 index 0000000000000..77a59397d82f1 --- /dev/null +++ b/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisDeleteTest.json @@ -0,0 +1,277 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourcegroups/res7089?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYzI0Mzc0NWQtNTBiYi00OGQxLTllNjItM2Y3MmVmYjMxNjZjL3Jlc291cmNlZ3JvdXBzL3JlczcwODk/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"westus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ], + "x-ms-client-request-id": [ + "89e61421-87a0-4d25-b6a1-946a8f9df00b" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089\",\r\n \"name\": \"account1235\",\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "167" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 08:09:16 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1181" + ], + "x-ms-request-id": [ + "d55f54ca-0ad2-4798-9741-a96462bd1cb8" + ], + "x-ms-correlation-request-id": [ + "9e622289-028e-44a3-bbcd-904ae16adbd3" + ], + "x-ms-routing-request-id": [ + "WESTUS:20190618T153235Z:d55f54ca-0ad2-4798-9741-a96462bd1cb8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/services/hca1234?api-version=2018-08-20-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2MxNDhiZjItNDJmYi00OTEzLWEzZmItMmYyODRhNjllYjg5L3Jlc291cmNlR3JvdXBzL3JlczcwODkvcHJvdmlkZXJzL01pY3Jvc29mdC5IZWFsdGhjYXJlQXBpcy9zZXJ2aWNlcy9oY2ExMjM0P2FwaS12ZXJzaW9uPTIwMTgtMDgtMjAtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"name\": \"S1\"\r\n ,\r\n \"location\": \"westus\",\r\n \"properties\": {}\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "113" + ], + "x-ms-client-request-id": [ + "39bce3ac-f86e-490f-92d3-260643c3a770" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.HealthcareApis.HealthcareApisManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/accounts/hca1234\",\r\n \"name\": \"hca1234\",\r\n \"type\": \"Microsoft.HealthcareApis/accounts\",\r\n \"etag\": \"\\\"0a002ee3-0000-0000-0000-5aa238d80000\\\"\",\r\n \"location\": \"westus\",\r\n \"name\": \"S1\"\r\n ,\r\n \"kind\": \"Fhir\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "570" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 07:33:44 GMT" + ], + "Pragma": [ + "no-cache" + ], + "ETag": [ + "\"0a002ee3-0000-0000-0000-5aa238d80000\"" + ], + "Server": [ + "Microsoft-IIS/10.0" + ], + "x-ms-request-id": [ + "2263b931-e233-4217-bfba-448ee3ac8346" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "x-ms-correlation-request-id": [ + "977d2f5c-4af0-4c2e-8068-6de427d796c0" + ], + "x-ms-routing-request-id": [ + "WESTUS:20180309T073344Z:977d2f5c-4af0-4c2e-8068-6de427d796c0" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/services/hca1234?api-version=2018-08-20-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2MxNDhiZjItNDJmYi00OTEzLWEzZmItMmYyODRhNjllYjg5L3Jlc291cmNlR3JvdXBzL3JlczcwODkvcHJvdmlkZXJzL01pY3Jvc29mdC5IZWFsdGhjYXJlQXBpcy9zZXJ2aWNlcy9oY2ExMjM0P2FwaS12ZXJzaW9uPTIwMTgtMDgtMjAtcHJldmlldw==", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "ccfc3a51-0fa5-4fbf-be57-638efc84c3e2" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.HealthcareApis.HealthcareApisManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 26 May 2017 11:20:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-IIS/8.5" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1194" + ], + "x-ms-request-id": [ + "7824fc5b-dcea-46b4-91b8-2992ec8a8bf6" + ], + "x-ms-correlation-request-id": [ + "7824fc5b-dcea-46b4-91b8-2992ec8a8bf6" + ], + "x-ms-routing-request-id": [ + "WESTUS:20170526T112000Z:7824fc5b-dcea-46b4-91b8-2992ec8a8bf6" + ] + }, + "StatusCode": 204 + }, + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/services/missingaccount?api-version=2018-08-20-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2MxNDhiZjItNDJmYi00OTEzLWEzZmItMmYyODRhNjllYjg5L3Jlc291cmNlR3JvdXBzL3JlczcwODkvcHJvdmlkZXJzL01pY3Jvc29mdC5IZWFsdGhjYXJlQXBpcy9zZXJ2aWNlcy9taXNzaW5nYWNjb3VudD9hcGktdmVyc2lvbj0yMDE4LTA4LTIwLXByZXZpZXc=", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "ccfc3a51-0fa5-4fbf-be57-638efc84c3e2" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.HealthcareApis.HealthcareApisManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 26 May 2017 11:20:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-IIS/8.5" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1194" + ], + "x-ms-request-id": [ + "7824fc5b-dcea-46b4-91b8-2992ec8a8bf6" + ], + "x-ms-correlation-request-id": [ + "7824fc5b-dcea-46b4-91b8-2992ec8a8bf6" + ], + "x-ms-routing-request-id": [ + "WESTUS:20170526T112000Z:7824fc5b-dcea-46b4-91b8-2992ec8a8bf6" + ] + }, + "StatusCode": 204 + } + ], + "Names": { + "CreateResourceGroup": [ + "res7089" + ], + "HealthcareApisDeleteTest": [ + "hca1234" + ] + }, + "Variables": { + "SubscriptionId": "cc148bf2-42fb-4913-a3fb-2f284a69eb89" + } +} diff --git a/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisGetAccountTest.json b/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisGetAccountTest.json new file mode 100644 index 0000000000000..0952c2e4671f8 --- /dev/null +++ b/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisGetAccountTest.json @@ -0,0 +1,228 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourcegroups/res7089?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYzI0Mzc0NWQtNTBiYi00OGQxLTllNjItM2Y3MmVmYjMxNjZjL3Jlc291cmNlZ3JvdXBzL3JlczcwODk/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"westus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ], + "x-ms-client-request-id": [ + "89e61421-87a0-4d25-b6a1-946a8f9df00b" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089\",\r\n \"name\": \"hca1234\",\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "167" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 08:09:16 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1181" + ], + "x-ms-request-id": [ + "d55f54ca-0ad2-4798-9741-a96462bd1cb8" + ], + "x-ms-correlation-request-id": [ + "9e622289-028e-44a3-bbcd-904ae16adbd3" + ], + "x-ms-routing-request-id": [ + "WESTUS:20190618T153235Z:d55f54ca-0ad2-4798-9741-a96462bd1cb8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/services/hca1234?api-version=2018-08-20-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2MxNDhiZjItNDJmYi00OTEzLWEzZmItMmYyODRhNjllYjg5L3Jlc291cmNlR3JvdXBzL3JlczcwODkvcHJvdmlkZXJzL01pY3Jvc29mdC5IZWFsdGhjYXJlQXBpcy9zZXJ2aWNlcy9oY2ExMjM0P2FwaS12ZXJzaW9uPTIwMTgtMDgtMjAtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"name\": \"S1\"\r\n ,\r\n \"location\": \"westus\",\r\n \"properties\": {}\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "113" + ], + "x-ms-client-request-id": [ + "39bce3ac-f86e-490f-92d3-260643c3a770" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.HealthcareApis.HealthcareApisManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/accounts/hca1234\",\r\n \"name\": \"hca1234\",\r\n \"type\": \"Microsoft.HealthcareApis/accounts\",\r\n \"etag\": \"\\\"0a002ee3-0000-0000-0000-5aa238d80000\\\"\",\r\n \"location\": \"westus\",\r\n \"sku\": {\r\n \"name\": \"S1\"\r\n },\r\n \"kind\": \"Fhir\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "570" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 07:33:44 GMT" + ], + "Pragma": [ + "no-cache" + ], + "ETag": [ + "\"0a002ee3-0000-0000-0000-5aa238d80000\"" + ], + "Server": [ + "Microsoft-IIS/10.0" + ], + "x-ms-request-id": [ + "2263b931-e233-4217-bfba-448ee3ac8346" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "x-ms-correlation-request-id": [ + "977d2f5c-4af0-4c2e-8068-6de427d796c0" + ], + "x-ms-routing-request-id": [ + "WESTUS:20180309T073344Z:977d2f5c-4af0-4c2e-8068-6de427d796c0" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/services/hca1234?api-version=2018-08-20-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2MxNDhiZjItNDJmYi00OTEzLWEzZmItMmYyODRhNjllYjg5L3Jlc291cmNlR3JvdXBzL3JlczcwODkvcHJvdmlkZXJzL01pY3Jvc29mdC5IZWFsdGhjYXJlQXBpcy9zZXJ2aWNlcy9oY2ExMjM0P2FwaS12ZXJzaW9uPTIwMTgtMDgtMjAtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "65c39c9c-dcfd-47d3-a5ea-a98bfd4989bb" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.HealthcareApis.HealthcareApisManagementClient/3.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/services/hca1234\",\r\n \"name\": \"hca1234\",\r\n \"type\": \"Microsoft.HealthcareApis/accounts\",\r\n \"location\": \"westus\",\r\n \"sku\": {\r\n \"name\": \"S1\"\r\n },\r\n \"kind\": \"Fhir\",\r\n \"tags\": {\r\n \"key3\": \"value3\",\r\n \"key4\": \"value4\",\r\n \"key5\": \"value5\"\r\n },\"properties\": {\"provisioningState\": \"Succeeded\"}}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 07:49:29 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "ETag": [ + "\"0a00bcf7-0000-0000-0000-5aa23c880000\"" + ], + "Server": [ + "Microsoft-IIS/10.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "4697a59a-84eb-4e5c-967e-085b2a555af8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14953" + ], + "x-ms-correlation-request-id": [ + "122819a6-98f9-4c61-b68c-c06a134c084f" + ], + "x-ms-routing-request-id": [ + "JAPANWEST:20180309T074930Z:122819a6-98f9-4c61-b68c-c06a134c084f" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "CreateResourceGroup": [ + "res7089" + ], + "HealthcareApisGetAccountTest": [ + "hca1234" + ] + }, + "Variables": { + "SubscriptionId": "cc148bf2-42fb-4913-a3fb-2f284a69eb89" + } +} diff --git a/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisListAccountByResourceGroupTest.json b/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisListAccountByResourceGroupTest.json new file mode 100644 index 0000000000000..b769c077447d1 --- /dev/null +++ b/src/SDKs/HealthcareApis/HealthcareApis.Tests/SessionRecords/HealthcareApisTests/HealthcareApisListAccountByResourceGroupTest.json @@ -0,0 +1,378 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourcegroups/res7089?api-version=2018-08-20-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2MxNDhiZjItNDJmYi00OTEzLWEzZmItMmYyODRhNjllYjg5L3Jlc291cmNlZ3JvdXBzL3JlczcwODk/YXBpLXZlcnNpb249MjAxOC0wOC0yMC1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"westus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ], + "x-ms-client-request-id": [ + "89e61421-87a0-4d25-b6a1-946a8f9df00b" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089\",\r\n \"name\": \"hca1234\",\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "167" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 08:09:16 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1181" + ], + "x-ms-request-id": [ + "d55f54ca-0ad2-4798-9741-a96462bd1cb8" + ], + "x-ms-correlation-request-id": [ + "9e622289-028e-44a3-bbcd-904ae16adbd3" + ], + "x-ms-routing-request-id": [ + "WESTUS:20190618T153235Z:d55f54ca-0ad2-4798-9741-a96462bd1cb8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/services?api-version=2018-08-20-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2MxNDhiZjItNDJmYi00OTEzLWEzZmItMmYyODRhNjllYjg5L3Jlc291cmNlR3JvdXBzL3JlczcwODkvcHJvdmlkZXJzL01pY3Jvc29mdC5IZWFsdGhjYXJlQXBpcy9zZXJ2aWNlcz9hcGktdmVyc2lvbj0yMDE4LTA4LTIwLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "65c39c9c-dcfd-47d3-a5ea-a98bfd4989bb" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.HealthcareApis.HealthcareApisManagementClient/3.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": []\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 07:49:29 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "ETag": [ + "\"0a00bcf7-0000-0000-0000-5aa23c880000\"" + ], + "Server": [ + "Microsoft-IIS/10.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "4697a59a-84eb-4e5c-967e-085b2a555af8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14953" + ], + "x-ms-correlation-request-id": [ + "122819a6-98f9-4c61-b68c-c06a134c084f" + ], + "x-ms-routing-request-id": [ + "JAPANWEST:20180309T074930Z:122819a6-98f9-4c61-b68c-c06a134c084f" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/services/hca1235?api-version=2018-08-20-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2MxNDhiZjItNDJmYi00OTEzLWEzZmItMmYyODRhNjllYjg5L3Jlc291cmNlR3JvdXBzL3JlczcwODkvcHJvdmlkZXJzL01pY3Jvc29mdC5IZWFsdGhjYXJlQXBpcy9zZXJ2aWNlcy9oY2ExMjM1P2FwaS12ZXJzaW9uPTIwMTgtMDgtMjAtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"name\": \"S1\"\r\n ,\r\n \"location\": \"westus\",\r\n \"properties\": {}\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "113" + ], + "x-ms-client-request-id": [ + "39bce3ac-f86e-490f-92d3-260643c3a770" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.HealthcareApis.HealthcareApisManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/accounts/hca1235\",\r\n \"name\": \"hca1234\",\r\n \"type\": \"Microsoft.HealthcareApis/accounts\",\r\n \"etag\": \"\\\"0a002ee3-0000-0000-0000-5aa238d80000\\\"\",\r\n \"location\": \"westus\",\r\n \"name\": \"S1\"\r\n ,\r\n \"kind\": \"Fhir\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "570" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 07:33:44 GMT" + ], + "Pragma": [ + "no-cache" + ], + "ETag": [ + "\"0a002ee3-0000-0000-0000-5aa238d80000\"" + ], + "Server": [ + "Microsoft-IIS/10.0" + ], + "x-ms-request-id": [ + "2263b931-e233-4217-bfba-448ee3ac8346" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "x-ms-correlation-request-id": [ + "977d2f5c-4af0-4c2e-8068-6de427d796c0" + ], + "x-ms-routing-request-id": [ + "WESTUS:20180309T073344Z:977d2f5c-4af0-4c2e-8068-6de427d796c0" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/services/hca1235?api-version=2018-08-20-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2MxNDhiZjItNDJmYi00OTEzLWEzZmItMmYyODRhNjllYjg5L3Jlc291cmNlR3JvdXBzL3JlczcwODkvcHJvdmlkZXJzL01pY3Jvc29mdC5IZWFsdGhjYXJlQXBpcy9zZXJ2aWNlcy9oY2ExMjM0P2FwaS12ZXJzaW9uPTIwMTgtMDgtMjAtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"name\": \"S1\"\r\n ,\r\n \"location\": \"westus\",\r\n \"properties\": {}\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "113" + ], + "x-ms-client-request-id": [ + "39bce3ac-f86e-490f-92d3-260643c3a770" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.HealthcareApis.HealthcareApisManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/accounts/hca1235\",\r\n \"name\": \"hca1234\",\r\n \"type\": \"Microsoft.HealthcareApis/accounts\",\r\n \"etag\": \"\\\"0a002ee3-0000-0000-0000-5aa238d80000\\\"\",\r\n \"location\": \"westus\",\r\n \"name\": \"S1\"\r\n ,\r\n \"kind\": \"Fhir\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "570" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 07:33:44 GMT" + ], + "Pragma": [ + "no-cache" + ], + "ETag": [ + "\"0a002ee3-0000-0000-0000-5aa238d80000\"" + ], + "Server": [ + "Microsoft-IIS/10.0" + ], + "x-ms-request-id": [ + "2263b931-e233-4217-bfba-448ee3ac8346" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "x-ms-correlation-request-id": [ + "977d2f5c-4af0-4c2e-8068-6de427d796c0" + ], + "x-ms-routing-request-id": [ + "WESTUS:20180309T073344Z:977d2f5c-4af0-4c2e-8068-6de427d796c0" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/services?api-version=2018-08-20-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2MxNDhiZjItNDJmYi00OTEzLWEzZmItMmYyODRhNjllYjg5L3Jlc291cmNlR3JvdXBzL3JlczcwODkvcHJvdmlkZXJzL01pY3Jvc29mdC5IZWFsdGhjYXJlQXBpcy9zZXJ2aWNlcz9hcGktdmVyc2lvbj0yMDE4LTA4LTIwLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "65c39c9c-dcfd-47d3-a5ea-a98bfd4989bb" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.HealthcareApis.HealthcareApisManagementClient/3.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApus/services/hcs1234\",\r\n \"name\": \"hca1234\",\"etag\": \"0a002ee3-0000-0000-0000-5aa238d80000\",\r\n \"type\": \"Microsoft.HealthcareApis/services\",\r\n \"location\": \"westus\",\r\n \"sku\": {\r\n \"name\": \"S1\"\r\n },\r\n \"kind\": \"Fhir\",\r\n \"tags\": {\r\n \"key1\": \"value1\",\r\n \"key2\": \"value2\"\r\n },\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"}\r\n },\r\n {\r\n \"id\": \"/subscriptions/cc148bf2-42fb-4913-a3fb-2f284a69eb89/resourceGroups/res7089/providers/Microsoft.HealthcareApis/services/hca1235\",\r\n \"name\": \"hca1235\",\r\n \"type\": \"Microsoft.HealthcareApis/services\",\r\n \"location\": \"westus\",\r\n \"name\": \"S1\"\r\n ,\r\n \"kind\": \"Fhir\",\"etag\": \"0a002ee3-0000-0000-0000-5aa238d800\",\r\n \"tags\": {\r\n \"key1\": \"value1\",\r\n \"key2\": \"value2\"\r\n },\r\n \"etag\": \"W/\\\"datetime'2017-05-26T11%3A20%3A39.9949008Z'\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"}\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 09 Mar 2018 07:49:29 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "ETag": [ + "\"0a00bcf7-0000-0000-0000-5aa23c880000\"" + ], + "Server": [ + "Microsoft-IIS/10.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "4697a59a-84eb-4e5c-967e-085b2a555af8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14953" + ], + "x-ms-correlation-request-id": [ + "122819a6-98f9-4c61-b68c-c06a134c084f" + ], + "x-ms-routing-request-id": [ + "JAPANWEST:20180309T074930Z:122819a6-98f9-4c61-b68c-c06a134c084f" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "CreateResourceGroup": [ + "res7089" + ], + "CreateHealthcareApisAccount": [ + "hca1234", + "hca1235" + ] + }, + "Variables": { + "SubscriptionId": "cc148bf2-42fb-4913-a3fb-2f284a69eb89" + } +} diff --git a/src/SDKs/HealthcareApis/HealthcareApis.Tests/Tests/HealthcareApisAccountTests.cs b/src/SDKs/HealthcareApis/HealthcareApis.Tests/Tests/HealthcareApisAccountTests.cs new file mode 100644 index 0000000000000..ca84bbf5d3fb3 --- /dev/null +++ b/src/SDKs/HealthcareApis/HealthcareApis.Tests/Tests/HealthcareApisAccountTests.cs @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using HealthcareApis.Tests.Helpers; +using Microsoft.Azure.Management.HealthcareApis; +using Microsoft.Azure.Management.HealthcareApis.Models; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using System.Linq; +using System.Net; +using Xunit; + +namespace HealthcareApis.Tests +{ + public class HealthcareApisTests + { + + [Fact] + public void HealthcareApisCreateTest() + { + var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; + + using (MockContext context = MockContext.Start(this.GetType().Name)) + { + var resourcesClient = HealthcareApisManagementTestUtilities.GetResourceManagementClient(context, handler); + var healthCareApisMgmtClient = HealthcareApisManagementTestUtilities.GetHealthcareApisManagementClient(context, handler); + + // Create resource group + var rgname = HealthcareApisManagementTestUtilities.CreateResourceGroup(resourcesClient); + + // Generate account name + string accountName = TestUtilities.GenerateName("hca"); + + var serviceDescription = HealthcareApisManagementTestUtilities.GetServiceDescription(); + + // Create healthcare apis account + var account = healthCareApisMgmtClient.Services.CreateOrUpdate(rgname, accountName, serviceDescription); + HealthcareApisManagementTestUtilities.VerifyAccountProperties(account, true); + } + } + + [Fact] + public void HealthcareApisCreateWithParametersTest() + { + var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; + + using (MockContext context = MockContext.Start(this.GetType().Name)) + { + var resourcesClient = HealthcareApisManagementTestUtilities.GetResourceManagementClient(context, handler); + var healthCareApisMgmtClient = HealthcareApisManagementTestUtilities.GetHealthcareApisManagementClient(context, handler); + + // Create resource group + var rgname = HealthcareApisManagementTestUtilities.CreateResourceGroup(resourcesClient); + + // Generate account name + string accountName = TestUtilities.GenerateName("hca"); + + var serviceDescription = HealthcareApisManagementTestUtilities.GetServiceDescriptionWithProperties(); + + // Create healthcareApis account + var account = healthCareApisMgmtClient.Services.CreateOrUpdate(rgname, accountName, serviceDescription); + HealthcareApisManagementTestUtilities.VerifyAccountProperties(account, false); + } + } + + [Fact] + public void HealthcareApisCreateAccountErrorTest() + { + var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; + + using (MockContext context = MockContext.Start(this.GetType().Name)) + { + var resourcesClient = HealthcareApisManagementTestUtilities.GetResourceManagementClient(context, handler); + var healthCareApisMgmtClient = HealthcareApisManagementTestUtilities.GetHealthcareApisManagementClient(context, handler); + + // Create resource group + var rgname = HealthcareApisManagementTestUtilities.CreateResourceGroup(resourcesClient); + + // Generate account name + string accountName = TestUtilities.GenerateName("hca"); + + var serviceDescription = HealthcareApisManagementTestUtilities.GetServiceDescription(); + + // try to create account in non-existent RG + HealthcareApisManagementTestUtilities.ValidateExpectedException(() => + healthCareApisMgmtClient.Services.CreateOrUpdate("NotExistedRG", accountName, serviceDescription), + HttpStatusCode.NotFound.ToString()); + } + } + + [Fact] + public void HealthcareApisAccountUpdateWithCreateTest() + { + var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; + + using (MockContext context = MockContext.Start(this.GetType().Name)) + { + var resourcesClient = HealthcareApisManagementTestUtilities.GetResourceManagementClient(context, handler); + var healthCareApisMgmtClient = HealthcareApisManagementTestUtilities.GetHealthcareApisManagementClient(context, handler); + + // Create resource group + var rgname = HealthcareApisManagementTestUtilities.CreateResourceGroup(resourcesClient); + + // Generate account name + string accountName = TestUtilities.GenerateName("hca"); + + var serviceDescription = HealthcareApisManagementTestUtilities.GetServiceDescription(); + + // Create healthcareApis account + var createdAccount = healthCareApisMgmtClient.Services.CreateOrUpdate(rgname, accountName, serviceDescription); + + var servicePatchDescription = HealthcareApisManagementTestUtilities.GetServicePatchDescription(); + + // Update Tags + var account = healthCareApisMgmtClient.Services.Update(rgname, accountName, servicePatchDescription); + Assert.True(account.Tags.Values.Contains("value3")); + Assert.True(account.Tags.Values.Contains("value4")); + Assert.False(account.Tags.Values.Contains("value1")); + Assert.False(account.Tags.Values.Contains("value2")); + + // Validate + var fetchedAccount = healthCareApisMgmtClient.Services.Get(rgname, accountName); + Assert.Equal(servicePatchDescription.Tags.Count, fetchedAccount.Tags.Count); + Assert.Collection(fetchedAccount.Tags, + (keyValue) => { Assert.Equal("key3", keyValue.Key); Assert.Equal("value3", keyValue.Value); }, + (keyValue) => { Assert.Equal("key4", keyValue.Key); Assert.Equal("value4", keyValue.Value); }, + (keyValue) => { Assert.Equal("key5", keyValue.Key); Assert.Equal("value5", keyValue.Value); } + ); + } + } + + [Fact] + public void HealthcareApisListAccountByResourceGroupTest() + { + var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; + + using (MockContext context = MockContext.Start(this.GetType().Name)) + { + var resourcesClient = HealthcareApisManagementTestUtilities.GetResourceManagementClient(context, handler); + var healthCareApisMgmtClient = HealthcareApisManagementTestUtilities.GetHealthcareApisManagementClient(context, handler); + + // Create resource group + var rgname = HealthcareApisManagementTestUtilities.CreateResourceGroup(resourcesClient); + + var accounts = healthCareApisMgmtClient.Services.ListByResourceGroup(rgname); + + Assert.Empty(accounts); + + string accountName1 = HealthcareApisManagementTestUtilities.CreateHealthcareApisAccount(healthCareApisMgmtClient, rgname); + string accountName2 = HealthcareApisManagementTestUtilities.CreateHealthcareApisAccount(healthCareApisMgmtClient, rgname); + + accounts = healthCareApisMgmtClient.Services.ListByResourceGroup(rgname); + + Assert.Equal(2, accounts.Count()); + + HealthcareApisManagementTestUtilities.VerifyAccountProperties(accounts.First(), true); + HealthcareApisManagementTestUtilities.VerifyAccountProperties(accounts.Skip(1).First(), true); + } + } + + [Fact] + public void HealthcareApisGetAccountTest() + { + var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; + + using (MockContext context = MockContext.Start(this.GetType().Name)) + { + var resourcesClient = HealthcareApisManagementTestUtilities.GetResourceManagementClient(context, handler); + var healthCareApisMgmtClient = HealthcareApisManagementTestUtilities.GetHealthcareApisManagementClient(context, handler); + + // Create resource group + var rgname = HealthcareApisManagementTestUtilities.CreateResourceGroup(resourcesClient); + + //generate account name + string accountName = TestUtilities.GenerateName("hca"); + + var serviceDescription = HealthcareApisManagementTestUtilities.GetServiceDescription(); + + // Create healthcareApis account + var createdAccount = healthCareApisMgmtClient.Services.CreateOrUpdate(rgname, accountName, serviceDescription); + + // Validate + var fetchedAccount = healthCareApisMgmtClient.Services.Get(rgname, accountName); + Assert.Equal(accountName, fetchedAccount.Name); + Assert.Equal("westus", fetchedAccount.Location); + } + } + + [Fact] + public void HealthcareApisDeleteTest() + { + var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; + + using (MockContext context = MockContext.Start(this.GetType().Name)) + { + var resourcesClient = HealthcareApisManagementTestUtilities.GetResourceManagementClient(context, handler); + var healthCareApisMgmtClient = HealthcareApisManagementTestUtilities.GetHealthcareApisManagementClient(context, handler); + + // Create resource group + var rgname = HealthcareApisManagementTestUtilities.CreateResourceGroup(resourcesClient); + + // Generate account name + string accountName = TestUtilities.GenerateName("hca"); + + var serviceDescription = HealthcareApisManagementTestUtilities.GetServiceDescription(); + + // Create healthcareApis account + var account = healthCareApisMgmtClient.Services.CreateOrUpdate(rgname, accountName, serviceDescription); + + // Delete an account + healthCareApisMgmtClient.Services.Delete(rgname, accountName); + + // Delete an account which does not exist + healthCareApisMgmtClient.Services.Delete(rgname, "missingaccount"); + } + } + + + [Fact] + public void HealthcareApisDeleteAccountErrorTest() + { + var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; + + using (MockContext context = MockContext.Start(this.GetType().Name)) + { + var resourcesClient = HealthcareApisManagementTestUtilities.GetResourceManagementClient(context, handler); + var healthCareApisMgmtClient = HealthcareApisManagementTestUtilities.GetHealthcareApisManagementClient(context, handler); + + // Create resource group + var rgname = HealthcareApisManagementTestUtilities.CreateResourceGroup(resourcesClient); + + // try to delete non-existent account + HealthcareApisManagementTestUtilities.ValidateExpectedException( + () => healthCareApisMgmtClient.Services.Delete("NotExistedRG", "nonExistedAccountName"), + HttpStatusCode.NotFound.ToString()); + } + } + + [Fact] + public void HealthcareApisCheckNameAvailabilityTest() + { + var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; + + using (MockContext context = MockContext.Start(this.GetType().Name)) + { + var resourcesClient = HealthcareApisManagementTestUtilities.GetResourceManagementClient(context, handler); + var healthCareApisMgmtClient = HealthcareApisManagementTestUtilities.GetHealthcareApisManagementClient(context, handler); + CheckNameAvailabilityParameters checkNameAvailabilityParameters = new CheckNameAvailabilityParameters + { + Name = "hca1234", + Type = "Microsoft.HealthcareApis/services" + }; + var servicesNameAvailabilityInfo = healthCareApisMgmtClient.Services.CheckNameAvailability(checkNameAvailabilityParameters); + Assert.True(servicesNameAvailabilityInfo.NameAvailable); + } + } + } +} diff --git a/src/SDKs/HealthcareApis/HealthcareApis.sln b/src/SDKs/HealthcareApis/HealthcareApis.sln new file mode 100644 index 0000000000000..271217f3a3ff1 --- /dev/null +++ b/src/SDKs/HealthcareApis/HealthcareApis.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.438 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Management.HealthcareApis", "Management.HealthcareApis\Microsoft.Azure.Management.HealthcareApis.csproj", "{6F4E6681-FA47-4FFC-8E02-32212FDEDDC9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HealthcareApis.Tests", "HealthcareApis.Tests\HealthcareApis.Tests.csproj", "{FC36BDC8-F7B8-474D-BC49-15C11CA3C46A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6F4E6681-FA47-4FFC-8E02-32212FDEDDC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6F4E6681-FA47-4FFC-8E02-32212FDEDDC9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6F4E6681-FA47-4FFC-8E02-32212FDEDDC9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6F4E6681-FA47-4FFC-8E02-32212FDEDDC9}.Release|Any CPU.Build.0 = Release|Any CPU + {FC36BDC8-F7B8-474D-BC49-15C11CA3C46A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FC36BDC8-F7B8-474D-BC49-15C11CA3C46A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FC36BDC8-F7B8-474D-BC49-15C11CA3C46A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FC36BDC8-F7B8-474D-BC49-15C11CA3C46A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1BFC1207-8DBF-48D2-834F-C7E26B272818} + EndGlobalSection +EndGlobal diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/HealthcareApisManagementClient.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/HealthcareApisManagementClient.cs new file mode 100644 index 0000000000000..e66ca801eb685 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/HealthcareApisManagementClient.cs @@ -0,0 +1,366 @@ +// +// 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 Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + + /// + /// Azure Healthcare APIs Client + /// + public partial class HealthcareApisManagementClient : ServiceClient, IHealthcareApisManagementClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// The subscription identifier. + /// + public string SubscriptionId { get; set; } + + /// + /// The version of the API. + /// + public string ApiVersion { get; private set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IServicesOperations. + /// + public virtual IServicesOperations Services { 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. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling HealthcareApisManagementClient.Dispose(). False: will not dispose provided httpClient + protected HealthcareApisManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the HealthcareApisManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected HealthcareApisManagementClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the HealthcareApisManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected HealthcareApisManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the HealthcareApisManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected HealthcareApisManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the HealthcareApisManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected HealthcareApisManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the HealthcareApisManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public HealthcareApisManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the HealthcareApisManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling HealthcareApisManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public HealthcareApisManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the HealthcareApisManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public HealthcareApisManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the HealthcareApisManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public HealthcareApisManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the HealthcareApisManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public HealthcareApisManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + Services = new ServicesOperations(this); + Operations = new Operations(this); + OperationResults = new OperationResultsOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2018-08-20-preview"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/IHealthcareApisManagementClient.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/IHealthcareApisManagementClient.cs new file mode 100644 index 0000000000000..96c1836d922cd --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/IHealthcareApisManagementClient.cs @@ -0,0 +1,84 @@ +// +// 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; + + /// + /// Azure Healthcare APIs Client + /// + public partial interface IHealthcareApisManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// The subscription identifier. + /// + string SubscriptionId { get; set; } + + /// + /// The version of the API. + /// + string ApiVersion { get; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IServicesOperations. + /// + IServicesOperations Services { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the IOperationResultsOperations. + /// + IOperationResultsOperations OperationResults { get; } + + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/IMoveResourcesStatusOperations.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/IMoveResourcesStatusOperations.cs new file mode 100644 index 0000000000000..51922ed73101e --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/IMoveResourcesStatusOperations.cs @@ -0,0 +1,48 @@ +// +// 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; + + /// + /// MoveResourcesStatusOperations operations. + /// + public partial interface IMoveResourcesStatusOperations + { + /// + /// Get the operation result for a long running move operation. + /// + /// + /// The location of the operation. + /// + /// + /// The ID of the operation result to get. + /// + /// + /// 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 locationName, string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/IOperationResultsOperations.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/IOperationResultsOperations.cs new file mode 100644 index 0000000000000..5c4ece3789fc0 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/IOperationResultsOperations.cs @@ -0,0 +1,48 @@ +// +// 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; + + /// + /// OperationResultsOperations operations. + /// + public partial interface IOperationResultsOperations + { + /// + /// Get the operation result for a long running operation. + /// + /// + /// The location of the operation. + /// + /// + /// The ID of the operation result to get. + /// + /// + /// 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 locationName, string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/IOperations.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/IOperations.cs new file mode 100644 index 0000000000000..5d85ad3e8bcbb --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/IOperations.cs @@ -0,0 +1,64 @@ +// +// 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; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Lists all of the available Healthcare service REST API operations. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the available Healthcare service REST API operations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/IServicesOperations.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/IServicesOperations.cs new file mode 100644 index 0000000000000..4a37a14cc641e --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/IServicesOperations.cs @@ -0,0 +1,312 @@ +// +// 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; + + /// + /// ServicesOperations operations. + /// + public partial interface IServicesOperations + { + /// + /// Get the metadata of a service instance. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update the metadata of a service instance. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The service instance metadata. + /// + /// + /// 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 resourceName, ServicesDescription serviceDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the metadata of a service instance. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The service instance metadata and security metadata. + /// + /// + /// 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 resourceName, ServicesPatchDescription servicePatchDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a service instance. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of 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 a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all the service instances in a subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all the service instances in a 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)); + /// + /// Check if a service instance name is available. + /// + /// + /// Set the name parameter in the CheckNameAvailabilityParameters + /// structure to the name of the service instance to check. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CheckNameAvailabilityWithHttpMessagesAsync(CheckNameAvailabilityParameters checkNameAvailabilityInputs, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update the metadata of a service instance. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The service instance metadata. + /// + /// + /// 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 resourceName, ServicesDescription serviceDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the metadata of a service instance. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The service instance metadata and security metadata. + /// + /// + /// 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 resourceName, ServicesPatchDescription servicePatchDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a service instance. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of 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 a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all the service instances in a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all the service instances in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/CheckNameAvailabilityParameters.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/CheckNameAvailabilityParameters.cs new file mode 100644 index 0000000000000..d7b921929f729 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/CheckNameAvailabilityParameters.cs @@ -0,0 +1,78 @@ +// +// 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; + + /// + /// Input values. + /// + public partial class CheckNameAvailabilityParameters + { + /// + /// Initializes a new instance of the CheckNameAvailabilityParameters + /// class. + /// + public CheckNameAvailabilityParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckNameAvailabilityParameters + /// class. + /// + /// The name of the service instance to + /// check. + /// The fully qualified resource type which includes + /// provider namespace. + public CheckNameAvailabilityParameters(string name, string type) + { + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the service instance to check. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the fully qualified resource type which includes + /// provider namespace. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + } + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ErrorDetails.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ErrorDetails.cs new file mode 100644 index 0000000000000..7efd99ca80069 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ErrorDetails.cs @@ -0,0 +1,47 @@ +// +// 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 ErrorDetails + { + /// + /// Initializes a new instance of the ErrorDetails class. + /// + public ErrorDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetails class. + /// + /// Object containing error details. + public ErrorDetails(ErrorDetailsInternal error = default(ErrorDetailsInternal)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets object containing error details. + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetailsInternal Error { get; set; } + + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ErrorDetailsException.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ErrorDetailsException.cs new file mode 100644 index 0000000000000..df005f0d4337d --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ErrorDetailsException.cs @@ -0,0 +1,57 @@ +// +// 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 ErrorDetails information. + /// + public partial class ErrorDetailsException : 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 ErrorDetails Body { get; set; } + + /// + /// Initializes a new instance of the ErrorDetailsException class. + /// + public ErrorDetailsException() + { + } + + /// + /// Initializes a new instance of the ErrorDetailsException class. + /// + /// The exception message. + public ErrorDetailsException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorDetailsException class. + /// + /// The exception message. + /// Inner exception. + public ErrorDetailsException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ErrorDetailsInternal.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ErrorDetailsInternal.cs new file mode 100644 index 0000000000000..8e45af4cffdfc --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ErrorDetailsInternal.cs @@ -0,0 +1,63 @@ +// +// 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 ErrorDetailsInternal + { + /// + /// Initializes a new instance of the ErrorDetailsInternal class. + /// + public ErrorDetailsInternal() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetailsInternal class. + /// + /// The error code. + /// The error message. + /// The target of the particular error. + public ErrorDetailsInternal(string code = default(string), string message = default(string), string target = default(string)) + { + Code = code; + Message = message; + Target = target; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the target of the particular error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/MoveResourcesParameters.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/MoveResourcesParameters.cs new file mode 100644 index 0000000000000..ba45d3bb6023a --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/MoveResourcesParameters.cs @@ -0,0 +1,101 @@ +// +// 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; + + /// + /// Input values. + /// + public partial class MoveResourcesParameters + { + /// + /// Initializes a new instance of the MoveResourcesParameters class. + /// + public MoveResourcesParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MoveResourcesParameters class. + /// + /// The target subscription to move + /// resources to. + /// The target resource group to + /// move resources to. + /// The list of resources to + /// move. + public MoveResourcesParameters(string targetSubscriptionId, string targetResourceGroupName, IList resourceIdsToMove) + { + TargetSubscriptionId = targetSubscriptionId; + TargetResourceGroupName = targetResourceGroupName; + ResourceIdsToMove = resourceIdsToMove; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the target subscription to move resources to. + /// + [JsonProperty(PropertyName = "targetSubscriptionId")] + public string TargetSubscriptionId { get; set; } + + /// + /// Gets or sets the target resource group to move resources to. + /// + [JsonProperty(PropertyName = "targetResourceGroupName")] + public string TargetResourceGroupName { get; set; } + + /// + /// Gets or sets the list of resources to move. + /// + [JsonProperty(PropertyName = "resourceIdsToMove")] + public IList ResourceIdsToMove { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TargetSubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TargetSubscriptionId"); + } + if (TargetResourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TargetResourceGroupName"); + } + if (ResourceIdsToMove == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ResourceIdsToMove"); + } + if (ResourceIdsToMove != null) + { + if (ResourceIdsToMove.Count > 250) + { + throw new ValidationException(ValidationRules.MaxItems, "ResourceIdsToMove", 250); + } + if (ResourceIdsToMove.Count < 1) + { + throw new ValidationException(ValidationRules.MinItems, "ResourceIdsToMove", 1); + } + } + } + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/Operation.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/Operation.cs new file mode 100644 index 0000000000000..bce4b4571756d --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/Operation.cs @@ -0,0 +1,66 @@ +// +// 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/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/OperationDisplay.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/OperationDisplay.cs new file mode 100644 index 0000000000000..7901e4c54a78f --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/OperationDisplay.cs @@ -0,0 +1,73 @@ +// +// 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 object that represents the operation. + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + /// Service provider: + /// Microsoft.HealthcareApis + /// Resource Type: Services + /// Name of the operation + /// Friendly description for the + /// operation, + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets service provider: Microsoft.HealthcareApis + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; private set; } + + /// + /// Gets resource Type: Services + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; private set; } + + /// + /// Gets name of the operation + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; private set; } + + /// + /// Gets friendly description for the operation, + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/OperationResultStatus.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/OperationResultStatus.cs new file mode 100644 index 0000000000000..0e20a2da54038 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/OperationResultStatus.cs @@ -0,0 +1,21 @@ +// +// 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 OperationResultStatus. + /// + public static class OperationResultStatus + { + public const string Canceled = "Canceled"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Requested = "Requested"; + public const string Running = "Running"; + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/OperationResultsDescription.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/OperationResultsDescription.cs new file mode 100644 index 0000000000000..c35100b6a4fa0 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/OperationResultsDescription.cs @@ -0,0 +1,87 @@ +// +// 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 properties indicating the operation result of an operation on a + /// service. + /// + public partial class OperationResultsDescription + { + /// + /// Initializes a new instance of the OperationResultsDescription + /// class. + /// + public OperationResultsDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationResultsDescription + /// class. + /// + /// The ID of the operation returned. + /// The name of the operation result. + /// The status of the operation being performed. + /// Possible values include: 'Canceled', 'Succeeded', 'Failed', + /// 'Requested', 'Running' + /// The time that the operation was + /// started. + /// 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)) + { + Id = id; + Name = name; + Status = status; + StartTime = startTime; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the ID of the operation returned. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the operation result. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the status of the operation being performed. Possible values + /// include: 'Canceled', 'Succeeded', 'Failed', 'Requested', 'Running' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets the time that the operation was started. + /// + [JsonProperty(PropertyName = "startTime")] + public string StartTime { get; private set; } + + /// + /// Gets or sets additional properties of the operation result. + /// + [JsonProperty(PropertyName = "properties")] + public object Properties { get; set; } + + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/Page.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/Page.cs new file mode 100644 index 0000000000000..2fb3bee656df8 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/Page.cs @@ -0,0 +1,49 @@ +// +// 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; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ProvisioningState.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ProvisioningState.cs new file mode 100644 index 0000000000000..8b600cd153003 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ProvisioningState.cs @@ -0,0 +1,25 @@ +// +// 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 ProvisioningState. + /// + public static class ProvisioningState + { + public const string Deleting = "Deleting"; + public const string Succeeded = "Succeeded"; + public const string Creating = "Creating"; + public const string Accepted = "Accepted"; + public const string Verifying = "Verifying"; + public const string Updating = "Updating"; + public const string Failed = "Failed"; + public const string Canceled = "Canceled"; + public const string Deprovisioned = "Deprovisioned"; + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/Resource.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/Resource.cs new file mode 100644 index 0000000000000..275c4e153f006 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/Resource.cs @@ -0,0 +1,126 @@ +// +// 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 a service. + /// + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// The resource location. + /// The resource identifier. + /// The resource name. + /// The resource type. + /// The resource tags. + /// An etag associated with the resource, used for + /// optimistic concurrency when editing it. + public Resource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string etag = default(string)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + Etag = etag; + CustomInit(); + } + /// + /// Static constructor for Resource class. + /// + static Resource() + { + Kind = "fhir"; + } + + /// + /// 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 the resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets the resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; 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; } + + /// + /// The kind of the service. Valid values are: fhir. + /// + [JsonProperty(PropertyName = "kind")] + public static string Kind { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + 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/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServiceAccessPolicyEntry.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServiceAccessPolicyEntry.cs new file mode 100644 index 0000000000000..0997692ab85dd --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServiceAccessPolicyEntry.cs @@ -0,0 +1,70 @@ +// +// 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 ServiceAccessPolicyEntry + { + /// + /// Initializes a new instance of the ServiceAccessPolicyEntry class. + /// + public ServiceAccessPolicyEntry() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceAccessPolicyEntry class. + /// + /// An object ID that is allowed access to the + /// FHIR service. + public ServiceAccessPolicyEntry(string objectId) + { + ObjectId = objectId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets an object ID 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/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServiceAuthenticationConfigurationInfo.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServiceAuthenticationConfigurationInfo.cs new file mode 100644 index 0000000000000..c1208c8761003 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServiceAuthenticationConfigurationInfo.cs @@ -0,0 +1,66 @@ +// +// 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 ServiceAuthenticationConfigurationInfo + { + /// + /// Initializes a new instance of the + /// ServiceAuthenticationConfigurationInfo class. + /// + public ServiceAuthenticationConfigurationInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ServiceAuthenticationConfigurationInfo class. + /// + /// The authority url for the service + /// The audience url for the service + /// If the SMART on FHIR proxy is + /// enabled + public ServiceAuthenticationConfigurationInfo(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/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServiceCorsConfigurationInfo.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServiceCorsConfigurationInfo.cs new file mode 100644 index 0000000000000..dd039cb279e38 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServiceCorsConfigurationInfo.cs @@ -0,0 +1,102 @@ +// +// 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 ServiceCorsConfigurationInfo + { + /// + /// Initializes a new instance of the ServiceCorsConfigurationInfo + /// class. + /// + public ServiceCorsConfigurationInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceCorsConfigurationInfo + /// 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 ServiceCorsConfigurationInfo(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/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServiceCosmosDbConfigurationInfo.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServiceCosmosDbConfigurationInfo.cs new file mode 100644 index 0000000000000..4909725ae9103 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServiceCosmosDbConfigurationInfo.cs @@ -0,0 +1,68 @@ +// +// 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; + + /// + /// The settings for the Cosmos DB database backing the service. + /// + public partial class ServiceCosmosDbConfigurationInfo + { + /// + /// Initializes a new instance of the ServiceCosmosDbConfigurationInfo + /// class. + /// + public ServiceCosmosDbConfigurationInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceCosmosDbConfigurationInfo + /// class. + /// + /// The provisioned throughput for the + /// backing database. + public ServiceCosmosDbConfigurationInfo(int? offerThroughput = default(int?)) + { + OfferThroughput = offerThroughput; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the provisioned throughput for the backing database. + /// + [JsonProperty(PropertyName = "offerThroughput")] + public int? OfferThroughput { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OfferThroughput > 10000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "OfferThroughput", 10000); + } + if (OfferThroughput < 400) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "OfferThroughput", 400); + } + } + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServiceNameUnavailabilityReason.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServiceNameUnavailabilityReason.cs new file mode 100644 index 0000000000000..9b172105c171d --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServiceNameUnavailabilityReason.cs @@ -0,0 +1,56 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ServiceNameUnavailabilityReason. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ServiceNameUnavailabilityReason + { + [EnumMember(Value = "Invalid")] + Invalid, + [EnumMember(Value = "AlreadyExists")] + AlreadyExists + } + internal static class ServiceNameUnavailabilityReasonEnumExtension + { + internal static string ToSerializedValue(this ServiceNameUnavailabilityReason? value) + { + return value == null ? null : ((ServiceNameUnavailabilityReason)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ServiceNameUnavailabilityReason value) + { + switch( value ) + { + case ServiceNameUnavailabilityReason.Invalid: + return "Invalid"; + case ServiceNameUnavailabilityReason.AlreadyExists: + return "AlreadyExists"; + } + return null; + } + + internal static ServiceNameUnavailabilityReason? ParseServiceNameUnavailabilityReason(this string value) + { + switch( value ) + { + case "Invalid": + return ServiceNameUnavailabilityReason.Invalid; + case "AlreadyExists": + return ServiceNameUnavailabilityReason.AlreadyExists; + } + return null; + } + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServicesDescription.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServicesDescription.cs new file mode 100644 index 0000000000000..b914e0eaf07da --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServicesDescription.cs @@ -0,0 +1,72 @@ +// +// 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 description of the service. + /// + public partial class ServicesDescription : Resource + { + /// + /// Initializes a new instance of the ServicesDescription class. + /// + public ServicesDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServicesDescription class. + /// + /// The resource location. + /// The resource identifier. + /// The resource name. + /// The resource type. + /// The resource tags. + /// An etag associated with the resource, used for + /// optimistic concurrency when editing it. + /// The common properties of a + /// service. + public ServicesDescription(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string etag = default(string), ServicesProperties properties = default(ServicesProperties)) + : base(location, id, name, type, tags, etag) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the common properties of a service. + /// + [JsonProperty(PropertyName = "properties")] + public ServicesProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServicesNameAvailabilityInfo.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServicesNameAvailabilityInfo.cs new file mode 100644 index 0000000000000..08c5cb50f5ce4 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServicesNameAvailabilityInfo.cs @@ -0,0 +1,69 @@ +// +// 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 properties indicating whether a given service name is available. + /// + public partial class ServicesNameAvailabilityInfo + { + /// + /// Initializes a new instance of the ServicesNameAvailabilityInfo + /// class. + /// + public ServicesNameAvailabilityInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServicesNameAvailabilityInfo + /// class. + /// + /// The value which indicates whether the + /// provided name is available. + /// The reason for unavailability. Possible values + /// include: 'Invalid', 'AlreadyExists' + /// The detailed reason message. + public ServicesNameAvailabilityInfo(bool? nameAvailable = default(bool?), ServiceNameUnavailabilityReason? reason = default(ServiceNameUnavailabilityReason?), string message = default(string)) + { + NameAvailable = nameAvailable; + Reason = reason; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the value which indicates whether the provided name is + /// available. + /// + [JsonProperty(PropertyName = "nameAvailable")] + public bool? NameAvailable { get; private set; } + + /// + /// Gets the reason for unavailability. Possible values include: + /// 'Invalid', 'AlreadyExists' + /// + [JsonProperty(PropertyName = "reason")] + public ServiceNameUnavailabilityReason? Reason { get; private set; } + + /// + /// Gets or sets the detailed reason message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServicesPatchDescription.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServicesPatchDescription.cs new file mode 100644 index 0000000000000..4f506d6a3e059 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServicesPatchDescription.cs @@ -0,0 +1,49 @@ +// +// 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 description of the service. + /// + public partial class ServicesPatchDescription + { + /// + /// Initializes a new instance of the ServicesPatchDescription class. + /// + public ServicesPatchDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServicesPatchDescription class. + /// + /// Instance tags + public ServicesPatchDescription(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets instance tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServicesProperties.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServicesProperties.cs new file mode 100644 index 0000000000000..4db764f6d2990 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Models/ServicesProperties.cs @@ -0,0 +1,125 @@ +// +// 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 properties of a service instance. + /// + public partial class ServicesProperties + { + /// + /// Initializes a new instance of the ServicesProperties class. + /// + public ServicesProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServicesProperties class. + /// + /// The access policies of the service + /// instance. + /// The provisioning state. Possible + /// values include: 'Deleting', 'Succeeded', 'Creating', 'Accepted', + /// 'Verifying', 'Updating', 'Failed', 'Canceled', + /// 'Deprovisioned' + /// The settings for the Cosmos DB + /// database backing the service. + /// The authentication + /// configuration for the service instance. + /// The settings for the CORS + /// configuration of the service instance. + public ServicesProperties(IList accessPolicies, string provisioningState = default(string), ServiceCosmosDbConfigurationInfo cosmosDbConfiguration = default(ServiceCosmosDbConfigurationInfo), ServiceAuthenticationConfigurationInfo authenticationConfiguration = default(ServiceAuthenticationConfigurationInfo), ServiceCorsConfigurationInfo corsConfiguration = default(ServiceCorsConfigurationInfo)) + { + ProvisioningState = provisioningState; + AccessPolicies = accessPolicies; + CosmosDbConfiguration = cosmosDbConfiguration; + AuthenticationConfiguration = authenticationConfiguration; + CorsConfiguration = corsConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the provisioning state. Possible values include: 'Deleting', + /// 'Succeeded', 'Creating', 'Accepted', 'Verifying', 'Updating', + /// 'Failed', 'Canceled', 'Deprovisioned' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the access policies of the service instance. + /// + [JsonProperty(PropertyName = "accessPolicies")] + public IList AccessPolicies { get; set; } + + /// + /// Gets or sets the settings for the Cosmos DB database backing the + /// service. + /// + [JsonProperty(PropertyName = "cosmosDbConfiguration")] + public ServiceCosmosDbConfigurationInfo CosmosDbConfiguration { get; set; } + + /// + /// Gets or sets the authentication configuration for the service + /// instance. + /// + [JsonProperty(PropertyName = "authenticationConfiguration")] + public ServiceAuthenticationConfigurationInfo AuthenticationConfiguration { get; set; } + + /// + /// Gets or sets the settings for the CORS configuration of the service + /// instance. + /// + [JsonProperty(PropertyName = "corsConfiguration")] + public ServiceCorsConfigurationInfo CorsConfiguration { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AccessPolicies == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AccessPolicies"); + } + if (AccessPolicies != null) + { + foreach (var element in AccessPolicies) + { + if (element != null) + { + element.Validate(); + } + } + } + if (CosmosDbConfiguration != null) + { + CosmosDbConfiguration.Validate(); + } + if (CorsConfiguration != null) + { + CorsConfiguration.Validate(); + } + } + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/MoveResourcesStatusOperations.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/MoveResourcesStatusOperations.cs new file mode 100644 index 0000000000000..b85ca0adcb1c7 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/MoveResourcesStatusOperations.cs @@ -0,0 +1,255 @@ +// +// 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; + + /// + /// MoveResourcesStatusOperations operations. + /// + internal partial class MoveResourcesStatusOperations : IServiceOperations, IMoveResourcesStatusOperations + { + /// + /// Initializes a new instance of the MoveResourcesStatusOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal MoveResourcesStatusOperations(HealthcareApisManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the HealthcareApisManagementClient + /// + public HealthcareApisManagementClient Client { get; private set; } + + /// + /// Get the operation result for a long running move operation. + /// + /// + /// The location of the operation. + /// + /// + /// The ID of the operation result to get. + /// + /// + /// 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 locationName, string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (operationResultId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationResultId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("operationResultId", operationResultId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/locations/{locationName}/moveResourcesStatus/{operationResultId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{operationResultId}", System.Uri.EscapeDataString(operationResultId)); + 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 && (int)_statusCode != 404) + { + 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 == 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); + } + return _result; + } + + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/MoveResourcesStatusOperationsExtensions.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/MoveResourcesStatusOperationsExtensions.cs new file mode 100644 index 0000000000000..65e0edcd24985 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/MoveResourcesStatusOperationsExtensions.cs @@ -0,0 +1,61 @@ +// +// 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 MoveResourcesStatusOperations. + /// + public static partial class MoveResourcesStatusOperationsExtensions + { + /// + /// Get the operation result for a long running move operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the operation. + /// + /// + /// The ID of the operation result to get. + /// + public static object Get(this IMoveResourcesStatusOperations operations, string locationName, string operationResultId) + { + return operations.GetAsync(locationName, operationResultId).GetAwaiter().GetResult(); + } + + /// + /// Get the operation result for a long running move operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the operation. + /// + /// + /// The ID of the operation result to get. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IMoveResourcesStatusOperations operations, string locationName, string operationResultId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(locationName, operationResultId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/OperationResultsOperations.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/OperationResultsOperations.cs new file mode 100644 index 0000000000000..d2f0ca9bbc912 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/OperationResultsOperations.cs @@ -0,0 +1,255 @@ +// +// 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; + + /// + /// OperationResultsOperations operations. + /// + internal partial class OperationResultsOperations : IServiceOperations, IOperationResultsOperations + { + /// + /// Initializes a new instance of the OperationResultsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal OperationResultsOperations(HealthcareApisManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the HealthcareApisManagementClient + /// + public HealthcareApisManagementClient Client { get; private set; } + + /// + /// Get the operation result for a long running operation. + /// + /// + /// The location of the operation. + /// + /// + /// The ID of the operation result to get. + /// + /// + /// 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 locationName, string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (operationResultId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationResultId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("operationResultId", operationResultId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/locations/{locationName}/operationresults/{operationResultId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{operationResultId}", System.Uri.EscapeDataString(operationResultId)); + 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 && (int)_statusCode != 404) + { + 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 == 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); + } + return _result; + } + + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/OperationResultsOperationsExtensions.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/OperationResultsOperationsExtensions.cs new file mode 100644 index 0000000000000..8747f2272d60a --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/OperationResultsOperationsExtensions.cs @@ -0,0 +1,61 @@ +// +// 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 OperationResultsOperations. + /// + public static partial class OperationResultsOperationsExtensions + { + /// + /// Get the operation result for a long running operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the operation. + /// + /// + /// The ID of the operation result to get. + /// + public static object Get(this IOperationResultsOperations operations, string locationName, string operationResultId) + { + return operations.GetAsync(locationName, operationResultId).GetAwaiter().GetResult(); + } + + /// + /// Get the operation result for a long running operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the operation. + /// + /// + /// The ID of the operation result to get. + /// + /// + /// The cancellation token. + /// + 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)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Operations.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Operations.cs new file mode 100644 index 0000000000000..7b35b15c4ca37 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/Operations.cs @@ -0,0 +1,376 @@ +// +// 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; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(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 of the available Healthcare service REST API operations. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.HealthcareApis/operations").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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 of the available Healthcare service REST API operations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/OperationsExtensions.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/OperationsExtensions.cs new file mode 100644 index 0000000000000..b3b2648ba42d0 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/OperationsExtensions.cs @@ -0,0 +1,83 @@ +// +// 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 Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Lists all of the available Healthcare service REST API operations. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available Healthcare service REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the available Healthcare service REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available Healthcare service REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/SdkInfo_HealthcareApisManagementClient.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/SdkInfo_HealthcareApisManagementClient.cs new file mode 100644 index 0000000000000..1b7156ad89624 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/SdkInfo_HealthcareApisManagementClient.cs @@ -0,0 +1,29 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HealthcareApis +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_HealthcareApisManagementClient + { + get + { + return new Tuple[] + { + new Tuple("HealthcareApis", "OperationResults", "2018-08-20-preview"), + new Tuple("HealthcareApis", "Operations", "2018-08-20-preview"), + new Tuple("HealthcareApis", "Services", "2018-08-20-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/ServicesOperations.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/ServicesOperations.cs new file mode 100644 index 0000000000000..37a96b445bfe7 --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/ServicesOperations.cs @@ -0,0 +1,1889 @@ +// +// 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; + + /// + /// ServicesOperations operations. + /// + internal partial class ServicesOperations : IServiceOperations, IServicesOperations + { + /// + /// Initializes a new instance of the ServicesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ServicesOperations(HealthcareApisManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the HealthcareApisManagementClient + /// + public HealthcareApisManagementClient Client { get; private set; } + + /// + /// Get the metadata of a service instance. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 24); + } + if (resourceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 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("resourceName", resourceName); + 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/services/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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; + } + + /// + /// Create or update the metadata of a service instance. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The service instance metadata. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ServicesDescription serviceDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, serviceDescription, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update the metadata of a service instance. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The service instance metadata and security metadata. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ServicesPatchDescription servicePatchDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, servicePatchDescription, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete a service instance. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get all the service instances in a subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/services").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; + } + + /// + /// Get all the service instances in a 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.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/services").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; + } + + /// + /// Check if a service instance name is available. + /// + /// + /// Set the name parameter in the CheckNameAvailabilityParameters structure to + /// the name of the service instance to check. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CheckNameAvailabilityWithHttpMessagesAsync(CheckNameAvailabilityParameters checkNameAvailabilityInputs, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (checkNameAvailabilityInputs == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "checkNameAvailabilityInputs"); + } + if (checkNameAvailabilityInputs != null) + { + checkNameAvailabilityInputs.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("checkNameAvailabilityInputs", checkNameAvailabilityInputs); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/checkNameAvailability").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(checkNameAvailabilityInputs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(checkNameAvailabilityInputs, 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; + } + + /// + /// Create or update the metadata of a service instance. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The service instance metadata. + /// + /// + /// 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 resourceName, ServicesDescription serviceDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 24); + } + if (resourceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 3); + } + } + if (serviceDescription == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceDescription"); + } + if (serviceDescription != null) + { + serviceDescription.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("resourceName", resourceName); + tracingParameters.Add("serviceDescription", serviceDescription); + 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/services/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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(serviceDescription != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(serviceDescription, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update the metadata of a service instance. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The service instance metadata and security metadata. + /// + /// + /// 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 resourceName, ServicesPatchDescription servicePatchDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 24); + } + if (resourceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 3); + } + } + if (servicePatchDescription == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "servicePatchDescription"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("servicePatchDescription", servicePatchDescription); + 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/services/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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(servicePatchDescription != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(servicePatchDescription, 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; + } + + /// + /// Delete a service instance. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 24); + } + if (resourceName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 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("resourceName", resourceName); + 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/services/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 != 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; + } + + /// + /// Get all the service instances in a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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; + } + + /// + /// Get all the service instances in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/ServicesOperationsExtensions.cs b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/ServicesOperationsExtensions.cs new file mode 100644 index 0000000000000..1124beee24edb --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Generated/ServicesOperationsExtensions.cs @@ -0,0 +1,485 @@ +// +// 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 ServicesOperations. + /// + public static partial class ServicesOperationsExtensions + { + /// + /// Get the metadata of a service instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + public static ServicesDescription Get(this IServicesOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Get the metadata of a service instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IServicesOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update the metadata of a service instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The service instance metadata. + /// + public static ServicesDescription CreateOrUpdate(this IServicesOperations operations, string resourceGroupName, string resourceName, ServicesDescription serviceDescription) + { + return operations.CreateOrUpdateAsync(resourceGroupName, resourceName, serviceDescription).GetAwaiter().GetResult(); + } + + /// + /// Create or update the metadata of a service instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The service instance metadata. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IServicesOperations operations, string resourceGroupName, string resourceName, ServicesDescription serviceDescription, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, serviceDescription, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the metadata of a service instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The service instance metadata and security metadata. + /// + public static ServicesDescription Update(this IServicesOperations operations, string resourceGroupName, string resourceName, ServicesPatchDescription servicePatchDescription) + { + return operations.UpdateAsync(resourceGroupName, resourceName, servicePatchDescription).GetAwaiter().GetResult(); + } + + /// + /// Update the metadata of a service instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The service instance metadata and security metadata. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IServicesOperations operations, string resourceGroupName, string resourceName, ServicesPatchDescription servicePatchDescription, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, servicePatchDescription, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a service instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + public static void Delete(this IServicesOperations operations, string resourceGroupName, string resourceName) + { + operations.DeleteAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Delete a service instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IServicesOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get all the service instances in a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IServicesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Get all the service instances in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IServicesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all the service instances in a 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 IServicesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Get all the service instances in a 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 IServicesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Check if a service instance name is available. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Set the name parameter in the CheckNameAvailabilityParameters structure to + /// the name of the service instance to check. + /// + public static ServicesNameAvailabilityInfo CheckNameAvailability(this IServicesOperations operations, CheckNameAvailabilityParameters checkNameAvailabilityInputs) + { + return operations.CheckNameAvailabilityAsync(checkNameAvailabilityInputs).GetAwaiter().GetResult(); + } + + /// + /// Check if a service instance name is available. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Set the name parameter in the CheckNameAvailabilityParameters structure to + /// the name of the service instance to check. + /// + /// + /// The cancellation token. + /// + public static async Task CheckNameAvailabilityAsync(this IServicesOperations operations, CheckNameAvailabilityParameters checkNameAvailabilityInputs, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(checkNameAvailabilityInputs, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update the metadata of a service instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The service instance metadata. + /// + public static ServicesDescription BeginCreateOrUpdate(this IServicesOperations operations, string resourceGroupName, string resourceName, ServicesDescription serviceDescription) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, resourceName, serviceDescription).GetAwaiter().GetResult(); + } + + /// + /// Create or update the metadata of a service instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The service instance metadata. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IServicesOperations operations, string resourceGroupName, string resourceName, ServicesDescription serviceDescription, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, serviceDescription, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the metadata of a service instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The service instance metadata and security metadata. + /// + public static ServicesDescription BeginUpdate(this IServicesOperations operations, string resourceGroupName, string resourceName, ServicesPatchDescription servicePatchDescription) + { + return operations.BeginUpdateAsync(resourceGroupName, resourceName, servicePatchDescription).GetAwaiter().GetResult(); + } + + /// + /// Update the metadata of a service instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The service instance metadata and security metadata. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IServicesOperations operations, string resourceGroupName, string resourceName, ServicesPatchDescription servicePatchDescription, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, servicePatchDescription, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a service instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + public static void BeginDelete(this IServicesOperations operations, string resourceGroupName, string resourceName) + { + operations.BeginDeleteAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Delete a service instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the service instance. + /// + /// + /// The name of the service instance. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IServicesOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get all the service instances in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IServicesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all the service instances in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IServicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all the service instances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IServicesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all the service instances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IServicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Microsoft.Azure.Management.HealthcareApis.csproj b/src/SDKs/HealthcareApis/Management.HealthcareApis/Microsoft.Azure.Management.HealthcareApis.csproj new file mode 100644 index 0000000000000..13167cea2d25c --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Microsoft.Azure.Management.HealthcareApis.csproj @@ -0,0 +1,25 @@ + + + + + + + Microsoft.Azure.Management.HealthcareApis + Provides management capabilities for Microsoft Azure Healthcare Apis. + Microsoft Azure Healthcare Apis Management + Microsoft.Azure.Management.HealthcareApis + 1.0.5-preview + Microsoft.Azure.Management.HealthcareApis + Microsoft Azure Healthcare Apis;HealthcareApis management;HealthcareApis; + Management SDK for Healthcare APIs. + + + + $(SdkTargetFx) + false + + + + + + diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/Properties/launchSettings.json b/src/SDKs/HealthcareApis/Management.HealthcareApis/Properties/launchSettings.json new file mode 100644 index 0000000000000..43e0c99c7595f --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/Properties/launchSettings.json @@ -0,0 +1,3 @@ +{ + "profiles": {} +} \ No newline at end of file diff --git a/src/SDKs/HealthcareApis/Management.HealthcareApis/generate.ps1 b/src/SDKs/HealthcareApis/Management.HealthcareApis/generate.ps1 new file mode 100644 index 0000000000000..abf24028ce46a --- /dev/null +++ b/src/SDKs/HealthcareApis/Management.HealthcareApis/generate.ps1 @@ -0,0 +1 @@ +Start-AutoRestCodeGeneration -ResourceProvider "healthcareapis/resource-manager" -AutoRestVersion "latest" diff --git a/src/SDKs/_metadata/healthcareapis_.txt b/src/SDKs/_metadata/healthcareapis_.txt new file mode 100644 index 0000000000000..e776541d5e458 --- /dev/null +++ b/src/SDKs/_metadata/healthcareapis_.txt @@ -0,0 +1,11 @@ +2019-05-15 01:03:18 UTC + +1) azure-rest-api-specs repository information +GitHub user: Azure +Branch: master +Commit: 267046e28e213c89f0f070fa7e6fc15e425f5d4d + +2) AutoRest information +Requested version: latest +Bootstrapper version: C:\Users\yazanal\AppData\Roaming\npm `-- autorest@2.0.4283 +Latest installed version: