diff --git a/src/SDKs/DeviceProvisioningServices/AzSdk.RP.props b/src/SDKs/DeviceProvisioningServices/AzSdk.RP.props new file mode 100644 index 000000000000..70f95c61f97a --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/AzSdk.RP.props @@ -0,0 +1,7 @@ + + + + Devices_2017-11-15; + $(PackageTags);$(CommonTags);$(AzureApiTag); + + \ No newline at end of file diff --git a/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/DeviceProvisioningServices.Tests.csproj b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/DeviceProvisioningServices.Tests.csproj new file mode 100644 index 000000000000..7667f9a6817b --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/DeviceProvisioningServices.Tests.csproj @@ -0,0 +1,34 @@ + + + + DeviceProvisioningServices.Tests + DeviceProvisioningServices.Tests Class Library + DeviceProvisioningServices.Tests + 1.0.1-preview + + + + netcoreapp1.1 + + + + + + + + + + + + + + + PreserveNewest + + + + + + + + \ No newline at end of file diff --git a/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/Helpers/Constants.cs b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/Helpers/Constants.cs new file mode 100644 index 000000000000..24078950d94e --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/Helpers/Constants.cs @@ -0,0 +1,41 @@ +namespace DeviceProvisioningServices.Tests.Helpers +{ + public static class Constants + { + public const string AccessKeyName = "provisioningserviceowner"; + + public static class Certificate + { + public const string Content = + "MIIBvjCCAWOgAwIBAgIQG6PoBFT6GLJGNKn/EaxltTAKBggqhkjOPQQDAjAcMRow" + + "GAYDVQQDDBFBenVyZSBJb1QgUm9vdCBDQTAeFw0xNzExMDMyMDUyNDZaFw0xNzEy" + + "MDMyMTAyNDdaMBwxGjAYBgNVBAMMEUF6dXJlIElvVCBSb290IENBMFkwEwYHKoZI" + + "zj0CAQYIKoZIzj0DAQcDQgAE+CgpnW3K+KRNIi/U6Zqe/Al9m8PExHX2KgakmGTf" + + "E04nNBwnSoygWb0ekqpT+Lm+OP56LMMe9ynVNryDEr9OSKOBhjCBgzAOBgNVHQ8B" + + "Af8EBAMCAgQwHQYDVR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMBMB8GA1UdEQQY" + + "MBaCFENOPUF6dXJlIElvVCBSb290IENBMBIGA1UdEwEB/wQIMAYBAf8CAQwwHQYD" + + "VR0OBBYEFDjiklfHQzw1G0A33BcmRQTjAivTMAoGCCqGSM49BAMCA0kAMEYCIQCt" + + "jJ4bAvoYuDhwr92Kk+OkvpPF+qBFiRfrA/EC4YGtzQIhAO79WPtbUnBQ5fsQnW2a" + + "UAT4yJGWL+7l4/qfmqblb96n"; + + public const string Name = "DPStestCert"; + public const string Subject = "CN=Azure IoT Root CA"; + public const string Thumbprint = "9F0983E8F2DB2DB3582997FEF331247D872DEE32"; + } + + public const string DefaultLocation = "eastus"; + + public static class DefaultSku + { + public const string Name = "S1"; + public const int Capacity = 1; + public const string Tier = "S1"; + } + + public static readonly string[] AllocationPolicies = {"Hashed", "GeoLatency", "Static"}; + + public const int ArmAttemptWaitMS = 500; + public const int RandomAllocationWeight = 870084357; + public const int ArmAttemptLimit = 5; + } +} diff --git a/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/Helpers/RecordedDelegatingHandler.cs b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/Helpers/RecordedDelegatingHandler.cs new file mode 100644 index 000000000000..931c719d6468 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/Helpers/RecordedDelegatingHandler.cs @@ -0,0 +1,87 @@ +using System; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Threading.Tasks; + +namespace DeviceProvisioningServices.Tests.Helpers +{ + public class RecordedDelegatingHandler : DelegatingHandler + { + private HttpResponseMessage _response; + + public RecordedDelegatingHandler() + { + StatusCodeToReturn = HttpStatusCode.Created; + SubsequentStatusCodeToReturn = StatusCodeToReturn; + } + + public RecordedDelegatingHandler(HttpResponseMessage response) + { + StatusCodeToReturn = HttpStatusCode.Created; + SubsequentStatusCodeToReturn = StatusCodeToReturn; + _response = response; + } + + 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/DeviceProvisioningServices/DeviceProvisioningServices.Tests/ScenarioTests/DeviceProvisioningClientAllocationPolicyTests.cs b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/ScenarioTests/DeviceProvisioningClientAllocationPolicyTests.cs new file mode 100644 index 000000000000..b389c855d2b9 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/ScenarioTests/DeviceProvisioningClientAllocationPolicyTests.cs @@ -0,0 +1,64 @@ +using System.Linq; +using DeviceProvisioningServices.Tests.Helpers; +using Microsoft.Azure.Management.DeviceProvisioningServices; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using Xunit; + +namespace DeviceProvisioningServices.Tests.ScenarioTests +{ + public class DeviceProvisioningClientAllocationPolicyTests : DeviceProvisioningTestBase + { + [Fact] + public void Get() + { + using (var context = MockContext.Start(this.GetType().FullName)) + { + var testName = "unitTestingUpdateAllocationPolicyGet"; + this.Initialize(context); + var resourceGroup = this.GetResourceGroup(testName); + var testedService = GetService(testName, resourceGroup.Name); + + + Assert.Contains(Constants.AllocationPolicies, x => x.Equals(testedService.Properties.AllocationPolicy)); + } + } + [Fact] + public void Update() + { + using (var context = MockContext.Start(this.GetType().FullName)) + { + var testName = "unitTestingDPSAllocationPolicyUpdate"; + this.Initialize(context); + var resourceGroup = this.GetResourceGroup(testName); + var testedService = GetService(testName, testName); + + //get a different Allocation policy + var newAllocationPolicy = Constants.AllocationPolicies + .Except(new[] { testedService.Properties.AllocationPolicy }).First(); + + var attempts = Constants.ArmAttemptLimit; + while (attempts > 0 && testedService.Properties.AllocationPolicy != newAllocationPolicy) + { + testedService.Properties.AllocationPolicy = newAllocationPolicy; + try + { + var updatedInstance = + this.provisioningClient.IotDpsResource.CreateOrUpdate(resourceGroup.Name, testName, + testedService); + Assert.Equal(newAllocationPolicy, updatedInstance.Properties.AllocationPolicy); + + testedService.Properties.AllocationPolicy = updatedInstance.Properties.AllocationPolicy; + } + catch + { + //Let ARM finish + System.Threading.Thread.Sleep(Constants.ArmAttemptWaitMS); + + attempts--; + } + } + } + } + + } +} \ No newline at end of file diff --git a/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/ScenarioTests/DeviceProvisioningClientCertificates.cs b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/ScenarioTests/DeviceProvisioningClientCertificates.cs new file mode 100644 index 000000000000..f1f31ea88e5d --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/ScenarioTests/DeviceProvisioningClientCertificates.cs @@ -0,0 +1,55 @@ +using System.Linq; +using Microsoft.Azure.Management.DeviceProvisioningServices; +using Microsoft.Azure.Management.DeviceProvisioningServices.Models; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using DeviceProvisioningServices.Tests.Helpers; +using Xunit; + +namespace DeviceProvisioningServices.Tests.ScenarioTests +{ + public class DeviceProvisioningClientCertificates : DeviceProvisioningTestBase + { + + [Fact] + public void CreateAndDelete() + { + using (var context = MockContext.Start(this.GetType().FullName)) + { + this.Initialize(context); + var testName = "unitTestingDPSCertificatesCreateAndDelete"; + var resourceGroup = this.GetResourceGroup(testName); + var service = this.GetService(resourceGroup.Name, testName); + + //add a cert + this.provisioningClient.DpsCertificate.CreateOrUpdate(testName, + testName, Constants.Certificate.Name, + new CertificateBodyDescription(Constants.Certificate.Content)); + + var certificateList = this.provisioningClient.DpsCertificates.List(testName, + testName); + + Assert.Contains(certificateList.Value, x => x.Name == Constants.Certificate.Name); + + //verify certificate details + var certificateDetails = + certificateList.Value.FirstOrDefault(x => x.Name == Constants.Certificate.Name); + Assert.NotNull(certificateDetails); + Assert.Equal(certificateDetails.Properties.Subject, Constants.Certificate.Subject); + Assert.Equal(certificateDetails.Properties.Thumbprint, Constants.Certificate.Thumbprint); + + //can get a verification code + var verificationCodeResponse = + this.provisioningClient.DpsCertificate.GenerateVerificationCode(certificateDetails.Name, + certificateDetails.Etag, resourceGroup.Name, service.Name); + Assert.NotNull(verificationCodeResponse.Properties); + Assert.False(string.IsNullOrEmpty(verificationCodeResponse.Properties.VerificationCode)); + + //delete certificate + this.provisioningClient.DpsCertificate.Delete(resourceGroup.Name, verificationCodeResponse.Etag, service.Name, Constants.Certificate.Name); + certificateList = this.provisioningClient.DpsCertificates.List(testName, + testName); + Assert.DoesNotContain(certificateList.Value, x => x.Name == Constants.Certificate.Name); + } + } + } +} \ No newline at end of file diff --git a/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/ScenarioTests/DeviceProvisioningClientLinkedHubsTests.cs b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/ScenarioTests/DeviceProvisioningClientLinkedHubsTests.cs new file mode 100644 index 000000000000..d15db340af1f --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/ScenarioTests/DeviceProvisioningClientLinkedHubsTests.cs @@ -0,0 +1,93 @@ +using System.Collections.Generic; +using System.Linq; +using Microsoft.Azure.Management.IotHub; +using Microsoft.Azure.Management.IotHub.Models; +using Microsoft.Azure.Management.DeviceProvisioningServices; +using Microsoft.Azure.Management.DeviceProvisioningServices.Models; +using Microsoft.Azure.Management.Resources.Models; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using Xunit; + +namespace DeviceProvisioningServices.Tests.ScenarioTests +{ + public class DeviceProvisioningClientLinkedHubsTests : DeviceProvisioningTestBase + { + [Fact] + public void CreateAndDelete() + { + using (var context = MockContext.Start(this.GetType().FullName)) + { + var testName = "unitTestingDPSLinkedHubCreateUpdateDelete"; + this.Initialize(context); + var iotHubClient = this.GetClient(context); + var resourceGroup = this.GetResourceGroup(testName); + var testedService = GetService(testName, resourceGroup.Name); + + var iotHub = GetIoTHub(iotHubClient, resourceGroup, testName); + var keys = iotHubClient.IotHubResource.ListKeys( + resourceGroup.Name, + iotHub.Name); + var key = keys.FirstOrDefault(x => x.Rights.HasFlag(AccessRights.ServiceConnect)); + var connectionString = $"HostName={iotHub.Name}.azure-devices.net;SharedAccessKeyName={key.KeyName};SharedAccessKey={key.PrimaryKey}"; + testedService.Properties.IotHubs = + testedService.Properties.IotHubs ?? new List(1); + + testedService.Properties.IotHubs.Add(new IotHubDefinitionDescription(connectionString, resourceGroup.Location, name: testName)); + var updatedInstance = + this.provisioningClient.IotDpsResource.CreateOrUpdate(resourceGroup.Name, testName, + testedService); + + var returnedHub = updatedInstance.Properties.IotHubs.FirstOrDefault(x => x.ConnectionString.StartsWith($"HostName={iotHub.Name}.azure-devices.net;")); + Assert.NotNull(returnedHub); + connectionString = returnedHub.ConnectionString; + + var updatedApplyPolicy = !(returnedHub.ApplyAllocationPolicy ?? false); + returnedHub.ApplyAllocationPolicy = updatedApplyPolicy; + + var updatedPolicyWeight = Helpers.Constants.RandomAllocationWeight; + returnedHub.AllocationWeight = updatedPolicyWeight; + + updatedInstance = + this.provisioningClient.IotDpsResource.CreateOrUpdate(resourceGroup.Name, testName, + updatedInstance); + var updatedHub = updatedInstance.Properties.IotHubs.FirstOrDefault(x => x.ConnectionString == connectionString); + Assert.NotNull(updatedHub); + + Assert.Equal(updatedApplyPolicy, updatedHub.ApplyAllocationPolicy); + Assert.Equal(updatedPolicyWeight, updatedHub.AllocationWeight); + + + //Delete the linked hub + testedService.Properties.IotHubs = testedService.Properties.IotHubs.Except( + testedService.Properties.IotHubs.Where(x => x.Name == testName)).ToList(); + updatedInstance = this.provisioningClient.IotDpsResource.CreateOrUpdate(resourceGroup.Name, testName, + testedService); + Assert.DoesNotContain(updatedInstance.Properties.IotHubs, x=> x.ConnectionString == connectionString); + + } + } + + + private IotHubDescription GetIoTHub(IotHubClient iotHubClient, ResourceGroup resourceGroup, string hubName) + { + return iotHubClient.IotHubResource.CreateOrUpdate( + resourceGroup.Name, + hubName, + new IotHubDescription + { + Location = resourceGroup.Location, + Subscriptionid = testEnv.SubscriptionId, + Resourcegroup = resourceGroup.Name, + Sku = new IotHubSkuInfo + { + Name = "S1", + Capacity = 1 + }, + Properties = new IotHubProperties + { + Routing = new RoutingProperties() + } + }); + } + } +} \ No newline at end of file diff --git a/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/ScenarioTests/DeviceProvisioningClientSharedAccessPolicyTests.cs b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/ScenarioTests/DeviceProvisioningClientSharedAccessPolicyTests.cs new file mode 100644 index 000000000000..c5ec0bb13d45 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/ScenarioTests/DeviceProvisioningClientSharedAccessPolicyTests.cs @@ -0,0 +1,111 @@ +using System.Collections.Generic; +using System.Net; +using Microsoft.Azure.Management.DeviceProvisioningServices; +using Microsoft.Azure.Management.DeviceProvisioningServices.Models; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using DeviceProvisioningServices.Tests.Helpers; +using Xunit; + +namespace DeviceProvisioningServices.Tests.ScenarioTests +{ + public class DeviceProvisioningClientSharedAccessPolicyTests : DeviceProvisioningTestBase + { + [Fact] + public void ListCreateDelete() + { + using (var context = MockContext.Start(this.GetType().FullName)) + { + this.Initialize(context); + var testName = "unitTestingDPSSharedAccessPoliciesListCreateDelete"; + var resourceGroup = this.GetResourceGroup(testName); + var testedService = GetService(testName, testName); + + //verify owner has been created + var ownerKey = this.provisioningClient.IotDpsResource.ListKeysForKeyName( + testedService.Name, + Constants.AccessKeyName, + resourceGroup.Name); + Assert.Equal(Constants.AccessKeyName, ownerKey.KeyName); + + //this access policy should not exist + Assert.False(TryGetKeyByName(testName, out var accessPolicy)); + Assert.Null(accessPolicy); + + + //new key + testedService.Properties.AuthorizationPolicies = + new List( + new[] + { + ownerKey, + new SharedAccessSignatureAuthorizationRuleAccessRightsDescription(testName, + rights: "RegistrationStatusWrite"), + }); + + var attempts = Constants.ArmAttemptLimit; + var success = false; + while (attempts > 0 && !success) + { + try + { + this.provisioningClient.IotDpsResource.CreateOrUpdate(testName, testedService.Name, + testedService); + success = true; + } + catch + { + //Let ARM finish + System.Threading.Thread.Sleep(Constants.ArmAttemptWaitMS); + attempts--; + } + } + //this access policy exists now + Assert.True(TryGetKeyByName(testName, out accessPolicy)); + Assert.NotNull(accessPolicy); + + testedService.Properties.AuthorizationPolicies = + new List( + new[] + { + ownerKey + }); + attempts = Constants.ArmAttemptLimit; + success = false; + while (attempts > 0 && !success) + { + try + { + this.provisioningClient.IotDpsResource.CreateOrUpdate(testName, testedService.Name, testedService); + success = true; + } + catch + { + //Let ARM finish + System.Threading.Thread.Sleep(Constants.ArmAttemptWaitMS); + + attempts--; + } + } + + //the policy has been removed + Assert.False(TryGetKeyByName(testName, out accessPolicy)); + Assert.Null(accessPolicy); + } + } + + private bool TryGetKeyByName(string testName, out SharedAccessSignatureAuthorizationRuleAccessRightsDescription accessPolicy) + { + try + { + accessPolicy = this.provisioningClient.IotDpsResource.ListKeysForKeyName(testName, testName, testName); + return true; + } + catch (ErrorDetailsException ex) + { + accessPolicy = null; + Assert.Equal(HttpStatusCode.NotFound, ex.Response.StatusCode); + return false; + } + } + } +} \ No newline at end of file diff --git a/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/ScenarioTests/DeviceProvisioningClientTest.cs b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/ScenarioTests/DeviceProvisioningClientTest.cs new file mode 100644 index 000000000000..178acd522d1b --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/ScenarioTests/DeviceProvisioningClientTest.cs @@ -0,0 +1,152 @@ +using System; +using System.Linq; +using Microsoft.Azure.Management.DeviceProvisioningServices; +using Microsoft.Azure.Management.DeviceProvisioningServices.Models; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using DeviceProvisioningServices.Tests.Helpers; +using Xunit; + +namespace DeviceProvisioningServices.Tests.ScenarioTests +{ + public class DeviceProvisioningClientTest : DeviceProvisioningTestBase + { + [Fact] + public void CreateAndDelete() + { + using (var context = MockContext.Start(this.GetType().FullName)) + { + + this.Initialize(context); + var testName = "unitTestingDPSCreateUpdate"; + this.GetResourceGroup(testName); + + + var availabilityInfo = + this.provisioningClient.IotDpsResource.CheckProvisioningServiceNameAvailability(new OperationInputs(testName)); + + if (!availabilityInfo.NameAvailable ?? false) + { + //it exists, so test the delete + this.provisioningClient.IotDpsResource.Delete(testName, testName); + + //check the name is now available + availabilityInfo = + this.provisioningClient.IotDpsResource.CheckProvisioningServiceNameAvailability(new OperationInputs(testName)); + Assert.True(availabilityInfo.NameAvailable); + } + + //try to create a DPS service + var createServiceDescription = new ProvisioningServiceDescription(Constants.DefaultLocation, + new IotDpsPropertiesDescription(), + new IotDpsSkuInfo(Constants.DefaultSku.Name, + Constants.DefaultSku.Tier, + Constants.DefaultSku.Capacity + )); + + var dpsInstance = this.provisioningClient.IotDpsResource.CreateOrUpdate( + testName, + testName, + createServiceDescription); + + Assert.NotNull(dpsInstance); + Assert.Equal(Constants.DefaultSku.Name, dpsInstance.Sku.Name); + Assert.Equal(testName, dpsInstance.Name); + + //verify item exists in list by resource group + var existingServices = + this.provisioningClient.IotDpsResource.ListByResourceGroup(testName); + Assert.Contains(existingServices, x => x.Name == testName); + + //verify can find + var foundInstance = this.provisioningClient.IotDpsResource.Get(testName, testName); + Assert.NotNull(foundInstance); + Assert.Equal(testName, foundInstance.Name); + + var attempts = Constants.ArmAttemptLimit; + var success = false; + while (attempts > 0 && !success) + { + try + { + + this.provisioningClient.IotDpsResource.Delete(testName, testName); + success = true; + } + catch + { + attempts--; + System.Threading.Thread.Sleep(Constants.ArmAttemptWaitMS); + } + } + existingServices = + this.provisioningClient.IotDpsResource.ListByResourceGroup(testName); + + //As long as it is gone or deleting, we're good + Assert.DoesNotContain(existingServices, x => x.Name == testName && x.Properties.State != "Deleting"); + } + } + + [Fact] + public void UpdateSku() + { + using (var context = MockContext.Start(this.GetType().FullName)) + { + this.Initialize(context); + string testName = "unitTestingDPSUpdateSku"; + var resourceGroup = this.GetResourceGroup(testName); + var service = this.GetService(testName, testName); + //update capacity + service.Sku.Capacity += 1; + var attempts = Constants.ArmAttemptLimit; + var success = false; + while (attempts > 0 && !success) + { + try + { + var updatedInstance = + this.provisioningClient.IotDpsResource.CreateOrUpdate(resourceGroup.Name, service.Name, + service); + Assert.Equal(service.Sku.Capacity, updatedInstance.Sku.Capacity); + success = true; + } + catch + { + //Let ARM finish + System.Threading.Thread.Sleep(Constants.ArmAttemptWaitMS); + attempts--; + } + } + + + + } + } + [Fact] + public void CreateFailure() + { + using (var context = MockContext.Start(this.GetType().FullName)) + { + + this.Initialize(context); + var testName = "unitTestingDPSCreateUpdateInvalidName"; + this.GetResourceGroup(testName); + + + //try to create a DPS service + var createServiceDescription = new ProvisioningServiceDescription(Constants.DefaultLocation, + new IotDpsPropertiesDescription(), + new IotDpsSkuInfo(Constants.DefaultSku.Name, + Constants.DefaultSku.Tier, + Constants.DefaultSku.Capacity + )); + + var badCall = new Func(() => this.provisioningClient.IotDpsResource.CreateOrUpdate( + testName, + $"1ñ1{testName}!!!", //We dont't allow most punctuation, leading numbers, etc + createServiceDescription)); + + Assert.Throws(badCall); + } + } + } +} \ No newline at end of file diff --git a/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/ScenarioTests/DeviceProvisioningTestBase.cs b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/ScenarioTests/DeviceProvisioningTestBase.cs new file mode 100644 index 000000000000..fcf15561c3c0 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/ScenarioTests/DeviceProvisioningTestBase.cs @@ -0,0 +1,86 @@ +using System.Net; +using Microsoft.Azure.Management.DeviceProvisioningServices; +using Microsoft.Azure.Management.DeviceProvisioningServices.Models; +using Microsoft.Azure.Management.Resources; +using Microsoft.Azure.Management.Resources.Models; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using DeviceProvisioningServices.Tests.Helpers; + +namespace DeviceProvisioningServices.Tests.ScenarioTests +{ + public class DeviceProvisioningTestBase : TestBase + { + protected IotDpsClient provisioningClient; + protected ResourceManagementClient resourcesClient; + protected TestEnvironment testEnv; + + protected bool initialized = false; + protected object locker = new object(); + + + + protected void Initialize(MockContext context) + { + if (!initialized) + { + lock (locker) + { + if (!initialized) + { + testEnv = TestEnvironmentFactory.GetTestEnvironment(); + resourcesClient = GetClient(context); + provisioningClient = GetClient(context); + } + initialized = true; + } + } + } + + protected ProvisioningServiceDescription GetService(string serviceName, string resourceGroupName) + { + var availabilityInfo = + this.provisioningClient.IotDpsResource.CheckProvisioningServiceNameAvailability(new OperationInputs(serviceName)); + if (!availabilityInfo.NameAvailable ?? true) + { + this.provisioningClient.IotDpsResource.Get(serviceName, + resourceGroupName); + } + var createServiceDescription = new ProvisioningServiceDescription(Constants.DefaultLocation, + new IotDpsPropertiesDescription(), + new IotDpsSkuInfo(Constants.DefaultSku.Name, + Constants.DefaultSku.Tier, + Constants.DefaultSku.Capacity + )); + + return this.provisioningClient.IotDpsResource.CreateOrUpdate( + resourceGroupName, + serviceName, createServiceDescription); + } + + protected T GetClient(MockContext context, RecordedDelegatingHandler handler = null) where T : class + { + if (handler == null) + { + handler = new RecordedDelegatingHandler + { + StatusCodeToReturn = HttpStatusCode.OK, + IsPassThrough = true + }; + } + var client = context.GetServiceClient(handlers: handler); + return client; + } + + protected ResourceGroup GetResourceGroup(string resourceGroupName, string resourceGroupLocation = null) + { + + if (string.IsNullOrEmpty(resourceGroupLocation)) + { + resourceGroupLocation = Constants.DefaultLocation; + } + + return this.resourcesClient.ResourceGroups.CreateOrUpdate(resourceGroupName, + new ResourceGroup { Location = resourceGroupLocation }); + } + } +} diff --git a/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientAllocationPolicyTests/Get.json b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientAllocationPolicyTests/Get.json new file mode 100644 index 000000000000..d20d11fa4f46 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientAllocationPolicyTests/Get.json @@ -0,0 +1,313 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourcegroups/unitTestingUpdateAllocationPolicyGet?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlZ3JvdXBzL3VuaXRUZXN0aW5nVXBkYXRlQWxsb2NhdGlvblBvbGljeUdldD9hcGktdmVyc2lvbj0yMDE1LTExLTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"eastus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ], + "x-ms-client-request-id": [ + "7c0bf603-3204-4898-b315-a7cacb81a87b" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingUpdateAllocationPolicyGet\",\r\n \"name\": \"unitTestingUpdateAllocationPolicyGet\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "225" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:52:04 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "33a8a7db-e059-41b3-aebf-fbc5ee119805" + ], + "x-ms-correlation-request-id": [ + "33a8a7db-e059-41b3-aebf-fbc5ee119805" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195205Z:33a8a7db-e059-41b3-aebf-fbc5ee119805" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9jaGVja1Byb3Zpc2lvbmluZ1NlcnZpY2VOYW1lQXZhaWxhYmlsaXR5P2FwaS12ZXJzaW9uPTIwMTctMTEtMTU=", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"name\": \"unitTestingUpdateAllocationPolicyGet\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "54" + ], + "x-ms-client-request-id": [ + "69934c28-7be2-4444-9947-bb5af78663eb" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"nameAvailable\": true,\r\n \"reason\": \"Invalid\",\r\n \"message\": null\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:52:09 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "6271635c-dcff-4c41-8c24-47391cad2320" + ], + "x-ms-correlation-request-id": [ + "6271635c-dcff-4c41-8c24-47391cad2320" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195210Z:6271635c-dcff-4c41-8c24-47391cad2320" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingUpdateAllocationPolicyGet/providers/Microsoft.Devices/provisioningServices/unitTestingUpdateAllocationPolicyGet?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nVXBkYXRlQWxsb2NhdGlvblBvbGljeUdldC9wcm92aWRlcnMvTWljcm9zb2Z0LkRldmljZXMvcHJvdmlzaW9uaW5nU2VydmljZXMvdW5pdFRlc3RpbmdVcGRhdGVBbGxvY2F0aW9uUG9saWN5R2V0P2FwaS12ZXJzaW9uPTIwMTctMTEtMTU=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"capacity\": 1\r\n },\r\n \"location\": \"eastus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "105" + ], + "x-ms-client-request-id": [ + "82d1581f-5d70-4be1-8edd-a18e4a302daf" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"name\": \"unitTestingUpdateAllocationPolicyGet\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Activating\",\r\n \"provisioningState\": \"Accepted\",\r\n \"allocationPolicy\": \"Hashed\",\r\n \"idScope\": null\r\n },\r\n \"resourcegroup\": \"unitTestingUpdateAllocationPolicyGet\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingUpdateAllocationPolicyGet/providers/Microsoft.Devices/provisioningServices/unitTestingUpdateAllocationPolicyGet\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "594" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:52:11 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingUpdateAllocationPolicyGet/providers/Microsoft.Devices/provisioningServices/unitTestingUpdateAllocationPolicyGet/operationResults/b3NfaWRfZTJjZWU1NGMtYzVmOC00YjViLWE5ZGEtZGFmMGIxMTJhOTI2?api-version=2017-11-15&asyncinfo" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "4999" + ], + "x-ms-request-id": [ + "3684564a-4e76-4671-b86c-37d594e1a568" + ], + "x-ms-correlation-request-id": [ + "3684564a-4e76-4671-b86c-37d594e1a568" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195212Z:3684564a-4e76-4671-b86c-37d594e1a568" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingUpdateAllocationPolicyGet/providers/Microsoft.Devices/provisioningServices/unitTestingUpdateAllocationPolicyGet/operationResults/b3NfaWRfZTJjZWU1NGMtYzVmOC00YjViLWE5ZGEtZGFmMGIxMTJhOTI2?api-version=2017-11-15&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nVXBkYXRlQWxsb2NhdGlvblBvbGljeUdldC9wcm92aWRlcnMvTWljcm9zb2Z0LkRldmljZXMvcHJvdmlzaW9uaW5nU2VydmljZXMvdW5pdFRlc3RpbmdVcGRhdGVBbGxvY2F0aW9uUG9saWN5R2V0L29wZXJhdGlvblJlc3VsdHMvYjNOZmFXUmZaVEpqWldVMU5HTXRZelZtT0MwMFlqVmlMV0U1WkdFdFpHRm1NR0l4TVRKaE9USTI/YXBpLXZlcnNpb249MjAxNy0xMS0xNSZhc3luY2luZm8=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:52:42 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14999" + ], + "x-ms-request-id": [ + "67a9750d-b2e9-417e-8283-e95f0a0ab69e" + ], + "x-ms-correlation-request-id": [ + "67a9750d-b2e9-417e-8283-e95f0a0ab69e" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195242Z:67a9750d-b2e9-417e-8283-e95f0a0ab69e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingUpdateAllocationPolicyGet/providers/Microsoft.Devices/provisioningServices/unitTestingUpdateAllocationPolicyGet?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nVXBkYXRlQWxsb2NhdGlvblBvbGljeUdldC9wcm92aWRlcnMvTWljcm9zb2Z0LkRldmljZXMvcHJvdmlzaW9uaW5nU2VydmljZXMvdW5pdFRlc3RpbmdVcGRhdGVBbGxvY2F0aW9uUG9saWN5R2V0P2FwaS12ZXJzaW9uPTIwMTctMTEtMTU=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKLeU=\",\r\n \"name\": \"unitTestingUpdateAllocationPolicyGet\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"serviceOperationsHostName\": \"unitTestingUpdateAllocationPolicyGet.azure-devices-provisioning.net\",\r\n \"deviceProvisioningHostName\": \"global.azure-devices-provisioning.net\",\r\n \"idScope\": \"0ne00009283\"\r\n },\r\n \"resourcegroup\": \"unitTestingUpdateAllocationPolicyGet\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingUpdateAllocationPolicyGet/providers/Microsoft.Devices/provisioningServices/unitTestingUpdateAllocationPolicyGet\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:52:42 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14998" + ], + "x-ms-request-id": [ + "256889fa-1da4-4a19-810f-c86344fcced6" + ], + "x-ms-correlation-request-id": [ + "256889fa-1da4-4a19-810f-c86344fcced6" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195243Z:256889fa-1da4-4a19-810f-c86344fcced6" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b" + } +} \ No newline at end of file diff --git a/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientAllocationPolicyTests/Update.json b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientAllocationPolicyTests/Update.json new file mode 100644 index 000000000000..0f93fae280d5 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientAllocationPolicyTests/Update.json @@ -0,0 +1,490 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourcegroups/unitTestingDPSAllocationPolicyUpdate?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlZ3JvdXBzL3VuaXRUZXN0aW5nRFBTQWxsb2NhdGlvblBvbGljeVVwZGF0ZT9hcGktdmVyc2lvbj0yMDE1LTExLTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"eastus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ], + "x-ms-client-request-id": [ + "0889c36b-eba4-48c1-a2d0-da23fa90d70e" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSAllocationPolicyUpdate\",\r\n \"name\": \"unitTestingDPSAllocationPolicyUpdate\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "225" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:53:29 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "4e03fe79-43d1-4160-b738-f326da2b3e29" + ], + "x-ms-correlation-request-id": [ + "4e03fe79-43d1-4160-b738-f326da2b3e29" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195329Z:4e03fe79-43d1-4160-b738-f326da2b3e29" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9jaGVja1Byb3Zpc2lvbmluZ1NlcnZpY2VOYW1lQXZhaWxhYmlsaXR5P2FwaS12ZXJzaW9uPTIwMTctMTEtMTU=", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"name\": \"unitTestingDPSAllocationPolicyUpdate\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "54" + ], + "x-ms-client-request-id": [ + "42f96439-3ba5-446c-a8d7-3da130053646" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"nameAvailable\": true,\r\n \"reason\": \"Invalid\",\r\n \"message\": null\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:53:32 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "1d714062-0cdc-4ef3-8b1e-1e57a2ae7198" + ], + "x-ms-correlation-request-id": [ + "1d714062-0cdc-4ef3-8b1e-1e57a2ae7198" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195332Z:1d714062-0cdc-4ef3-8b1e-1e57a2ae7198" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSAllocationPolicyUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSAllocationPolicyUpdate?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQWxsb2NhdGlvblBvbGljeVVwZGF0ZS9wcm92aWRlcnMvTWljcm9zb2Z0LkRldmljZXMvcHJvdmlzaW9uaW5nU2VydmljZXMvdW5pdFRlc3RpbmdEUFNBbGxvY2F0aW9uUG9saWN5VXBkYXRlP2FwaS12ZXJzaW9uPTIwMTctMTEtMTU=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"capacity\": 1\r\n },\r\n \"location\": \"eastus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "105" + ], + "x-ms-client-request-id": [ + "e3465363-abf3-4241-a26c-49e563b75402" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"name\": \"unitTestingDPSAllocationPolicyUpdate\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Activating\",\r\n \"provisioningState\": \"Accepted\",\r\n \"allocationPolicy\": \"Hashed\",\r\n \"idScope\": null\r\n },\r\n \"resourcegroup\": \"unitTestingDPSAllocationPolicyUpdate\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSAllocationPolicyUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSAllocationPolicyUpdate\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "594" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:53:34 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSAllocationPolicyUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSAllocationPolicyUpdate/operationResults/b3NfaWRfMzMxMWNhMzAtMzQ0NC00MGVhLWJhZjUtODgzZjUxZGE5YTVl?api-version=2017-11-15&asyncinfo" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "4999" + ], + "x-ms-request-id": [ + "faad8c99-4fe9-4511-9cdb-d90e51ed79cf" + ], + "x-ms-correlation-request-id": [ + "faad8c99-4fe9-4511-9cdb-d90e51ed79cf" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195334Z:faad8c99-4fe9-4511-9cdb-d90e51ed79cf" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSAllocationPolicyUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSAllocationPolicyUpdate?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQWxsb2NhdGlvblBvbGljeVVwZGF0ZS9wcm92aWRlcnMvTWljcm9zb2Z0LkRldmljZXMvcHJvdmlzaW9uaW5nU2VydmljZXMvdW5pdFRlc3RpbmdEUFNBbGxvY2F0aW9uUG9saWN5VXBkYXRlP2FwaS12ZXJzaW9uPTIwMTctMTEtMTU=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"etag\": \"AAAAAAAKLgo=\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"GeoLatency\"\r\n },\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"capacity\": 1\r\n },\r\n \"location\": \"eastus\",\r\n \"tags\": {}\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "233" + ], + "x-ms-client-request-id": [ + "156b0fed-39d0-40b1-beb4-660bf92cca1e" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKLgo=\",\r\n \"name\": \"unitTestingDPSAllocationPolicyUpdate\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Transitioning\",\r\n \"provisioningState\": \"Accepted\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"GeoLatency\",\r\n \"idScope\": null\r\n },\r\n \"resourcegroup\": \"unitTestingDPSAllocationPolicyUpdate\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSAllocationPolicyUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSAllocationPolicyUpdate\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "636" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:54:14 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSAllocationPolicyUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSAllocationPolicyUpdate/operationResults/b3NfaWRfZTFlODIwZWQtYWEwNi00OTU1LWI1MzgtMzMyZjM1N2Q3OTQ2?api-version=2017-11-15&asyncinfo" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "4998" + ], + "x-ms-request-id": [ + "098bf95d-d2fb-471d-9591-a6cdf4af9966" + ], + "x-ms-correlation-request-id": [ + "098bf95d-d2fb-471d-9591-a6cdf4af9966" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195415Z:098bf95d-d2fb-471d-9591-a6cdf4af9966" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSAllocationPolicyUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSAllocationPolicyUpdate/operationResults/b3NfaWRfMzMxMWNhMzAtMzQ0NC00MGVhLWJhZjUtODgzZjUxZGE5YTVl?api-version=2017-11-15&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQWxsb2NhdGlvblBvbGljeVVwZGF0ZS9wcm92aWRlcnMvTWljcm9zb2Z0LkRldmljZXMvcHJvdmlzaW9uaW5nU2VydmljZXMvdW5pdFRlc3RpbmdEUFNBbGxvY2F0aW9uUG9saWN5VXBkYXRlL29wZXJhdGlvblJlc3VsdHMvYjNOZmFXUmZNek14TVdOaE16QXRNelEwTkMwME1HVmhMV0poWmpVdE9EZ3paalV4WkdFNVlUVmw/YXBpLXZlcnNpb249MjAxNy0xMS0xNSZhc3luY2luZm8=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:54:03 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14996" + ], + "x-ms-request-id": [ + "68189b7f-2421-4d41-9541-4b0eb6b677dd" + ], + "x-ms-correlation-request-id": [ + "68189b7f-2421-4d41-9541-4b0eb6b677dd" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195404Z:68189b7f-2421-4d41-9541-4b0eb6b677dd" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSAllocationPolicyUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSAllocationPolicyUpdate?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQWxsb2NhdGlvblBvbGljeVVwZGF0ZS9wcm92aWRlcnMvTWljcm9zb2Z0LkRldmljZXMvcHJvdmlzaW9uaW5nU2VydmljZXMvdW5pdFRlc3RpbmdEUFNBbGxvY2F0aW9uUG9saWN5VXBkYXRlP2FwaS12ZXJzaW9uPTIwMTctMTEtMTU=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKLgo=\",\r\n \"name\": \"unitTestingDPSAllocationPolicyUpdate\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"serviceOperationsHostName\": \"unitTestingDPSAllocationPolicyUpdate.azure-devices-provisioning.net\",\r\n \"deviceProvisioningHostName\": \"global.azure-devices-provisioning.net\",\r\n \"idScope\": \"0ne00009285\"\r\n },\r\n \"resourcegroup\": \"unitTestingDPSAllocationPolicyUpdate\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSAllocationPolicyUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSAllocationPolicyUpdate\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:54:04 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14995" + ], + "x-ms-request-id": [ + "cdce8803-d641-4233-8a85-fd86590c18b9" + ], + "x-ms-correlation-request-id": [ + "cdce8803-d641-4233-8a85-fd86590c18b9" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195405Z:cdce8803-d641-4233-8a85-fd86590c18b9" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSAllocationPolicyUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSAllocationPolicyUpdate?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQWxsb2NhdGlvblBvbGljeVVwZGF0ZS9wcm92aWRlcnMvTWljcm9zb2Z0LkRldmljZXMvcHJvdmlzaW9uaW5nU2VydmljZXMvdW5pdFRlc3RpbmdEUFNBbGxvY2F0aW9uUG9saWN5VXBkYXRlP2FwaS12ZXJzaW9uPTIwMTctMTEtMTU=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKLhQ=\",\r\n \"name\": \"unitTestingDPSAllocationPolicyUpdate\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"GeoLatency\",\r\n \"serviceOperationsHostName\": \"unitTestingDPSAllocationPolicyUpdate.azure-devices-provisioning.net\",\r\n \"deviceProvisioningHostName\": \"global.azure-devices-provisioning.net\",\r\n \"idScope\": \"0ne00009285\"\r\n },\r\n \"resourcegroup\": \"unitTestingDPSAllocationPolicyUpdate\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSAllocationPolicyUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSAllocationPolicyUpdate\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:54:45 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14993" + ], + "x-ms-request-id": [ + "0f81a5c4-797d-418c-9c3c-db833d929f9d" + ], + "x-ms-correlation-request-id": [ + "0f81a5c4-797d-418c-9c3c-db833d929f9d" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195446Z:0f81a5c4-797d-418c-9c3c-db833d929f9d" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSAllocationPolicyUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSAllocationPolicyUpdate/operationResults/b3NfaWRfZTFlODIwZWQtYWEwNi00OTU1LWI1MzgtMzMyZjM1N2Q3OTQ2?api-version=2017-11-15&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQWxsb2NhdGlvblBvbGljeVVwZGF0ZS9wcm92aWRlcnMvTWljcm9zb2Z0LkRldmljZXMvcHJvdmlzaW9uaW5nU2VydmljZXMvdW5pdFRlc3RpbmdEUFNBbGxvY2F0aW9uUG9saWN5VXBkYXRlL29wZXJhdGlvblJlc3VsdHMvYjNOZmFXUmZaVEZsT0RJd1pXUXRZV0V3TmkwME9UVTFMV0kxTXpndE16TXlaak0xTjJRM09UUTI/YXBpLXZlcnNpb249MjAxNy0xMS0xNSZhc3luY2luZm8=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:54:45 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14994" + ], + "x-ms-request-id": [ + "d3392e4e-2c86-459f-8b15-cc27c31c8cb4" + ], + "x-ms-correlation-request-id": [ + "d3392e4e-2c86-459f-8b15-cc27c31c8cb4" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195446Z:d3392e4e-2c86-459f-8b15-cc27c31c8cb4" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b" + } +} \ No newline at end of file diff --git a/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientCertificates/CreateAndDelete.json b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientCertificates/CreateAndDelete.json new file mode 100644 index 000000000000..820acbcd50e4 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientCertificates/CreateAndDelete.json @@ -0,0 +1,624 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourcegroups/unitTestingDPSCertificatesCreateAndDelete?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlZ3JvdXBzL3VuaXRUZXN0aW5nRFBTQ2VydGlmaWNhdGVzQ3JlYXRlQW5kRGVsZXRlP2FwaS12ZXJzaW9uPTIwMTUtMTEtMDE=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"eastus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ], + "x-ms-client-request-id": [ + "6f9d30e1-9a5a-4edc-aef6-8f5352b0ef43" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCertificatesCreateAndDelete\",\r\n \"name\": \"unitTestingDPSCertificatesCreateAndDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "235" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:55:27 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "5ac86159-de73-49d9-91e8-27d10e9136ef" + ], + "x-ms-correlation-request-id": [ + "5ac86159-de73-49d9-91e8-27d10e9136ef" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195527Z:5ac86159-de73-49d9-91e8-27d10e9136ef" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9jaGVja1Byb3Zpc2lvbmluZ1NlcnZpY2VOYW1lQXZhaWxhYmlsaXR5P2FwaS12ZXJzaW9uPTIwMTctMTEtMTU=", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"name\": \"unitTestingDPSCertificatesCreateAndDelete\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "59" + ], + "x-ms-client-request-id": [ + "255c96b3-05a0-42e1-9dc6-eb6bd538492b" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"nameAvailable\": true,\r\n \"reason\": \"Invalid\",\r\n \"message\": null\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:55:42 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "ae78a31d-c784-4b72-8cbe-26cc44445275" + ], + "x-ms-correlation-request-id": [ + "ae78a31d-c784-4b72-8cbe-26cc44445275" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195542Z:ae78a31d-c784-4b72-8cbe-26cc44445275" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCertificatesCreateAndDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCertificatesCreateAndDelete?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQ2VydGlmaWNhdGVzQ3JlYXRlQW5kRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0NlcnRpZmljYXRlc0NyZWF0ZUFuZERlbGV0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"capacity\": 1\r\n },\r\n \"location\": \"eastus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "105" + ], + "x-ms-client-request-id": [ + "23fb8d76-9d74-4bb4-a77d-f2ab8aeb60f1" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"name\": \"unitTestingDPSCertificatesCreateAndDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Activating\",\r\n \"provisioningState\": \"Accepted\",\r\n \"allocationPolicy\": \"Hashed\",\r\n \"idScope\": null\r\n },\r\n \"resourcegroup\": \"unitTestingDPSCertificatesCreateAndDelete\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCertificatesCreateAndDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCertificatesCreateAndDelete\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "614" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:55:44 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCertificatesCreateAndDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCertificatesCreateAndDelete/operationResults/b3NfaWRfMzFlOGU0OWUtMjIyYi00NjVlLThhNjEtZWFiY2Q1YzBlYmU1?api-version=2017-11-15&asyncinfo" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "4999" + ], + "x-ms-request-id": [ + "d6deeff5-b583-4281-8bd2-d84a45051151" + ], + "x-ms-correlation-request-id": [ + "d6deeff5-b583-4281-8bd2-d84a45051151" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195545Z:d6deeff5-b583-4281-8bd2-d84a45051151" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCertificatesCreateAndDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCertificatesCreateAndDelete/operationResults/b3NfaWRfMzFlOGU0OWUtMjIyYi00NjVlLThhNjEtZWFiY2Q1YzBlYmU1?api-version=2017-11-15&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQ2VydGlmaWNhdGVzQ3JlYXRlQW5kRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0NlcnRpZmljYXRlc0NyZWF0ZUFuZERlbGV0ZS9vcGVyYXRpb25SZXN1bHRzL2IzTmZhV1JmTXpGbE9HVTBPV1V0TWpJeVlpMDBOalZsTFRoaE5qRXRaV0ZpWTJRMVl6QmxZbVUxP2FwaS12ZXJzaW9uPTIwMTctMTEtMTUmYXN5bmNpbmZv", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:56:15 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14998" + ], + "x-ms-request-id": [ + "099d9a37-e6f3-469c-88ce-f825b6c8ed22" + ], + "x-ms-correlation-request-id": [ + "099d9a37-e6f3-469c-88ce-f825b6c8ed22" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195615Z:099d9a37-e6f3-469c-88ce-f825b6c8ed22" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCertificatesCreateAndDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCertificatesCreateAndDelete?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQ2VydGlmaWNhdGVzQ3JlYXRlQW5kRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0NlcnRpZmljYXRlc0NyZWF0ZUFuZERlbGV0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKLiU=\",\r\n \"name\": \"unitTestingDPSCertificatesCreateAndDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"serviceOperationsHostName\": \"unitTestingDPSCertificatesCreateAndDelete.azure-devices-provisioning.net\",\r\n \"deviceProvisioningHostName\": \"global.azure-devices-provisioning.net\",\r\n \"idScope\": \"0ne00009286\"\r\n },\r\n \"resourcegroup\": \"unitTestingDPSCertificatesCreateAndDelete\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCertificatesCreateAndDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCertificatesCreateAndDelete\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:56:15 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14997" + ], + "x-ms-request-id": [ + "2aab1c0f-f42e-430a-a417-012437a7dfb4" + ], + "x-ms-correlation-request-id": [ + "2aab1c0f-f42e-430a-a417-012437a7dfb4" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195615Z:2aab1c0f-f42e-430a-a417-012437a7dfb4" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCertificatesCreateAndDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCertificatesCreateAndDelete/certificates/DPStestCert?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQ2VydGlmaWNhdGVzQ3JlYXRlQW5kRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0NlcnRpZmljYXRlc0NyZWF0ZUFuZERlbGV0ZS9jZXJ0aWZpY2F0ZXMvRFBTdGVzdENlcnQ/YXBpLXZlcnNpb249MjAxNy0xMS0xNQ==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"certificate\": \"MIIBvjCCAWOgAwIBAgIQG6PoBFT6GLJGNKn/EaxltTAKBggqhkjOPQQDAjAcMRowGAYDVQQDDBFBenVyZSBJb1QgUm9vdCBDQTAeFw0xNzExMDMyMDUyNDZaFw0xNzEyMDMyMTAyNDdaMBwxGjAYBgNVBAMMEUF6dXJlIElvVCBSb290IENBMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE+CgpnW3K+KRNIi/U6Zqe/Al9m8PExHX2KgakmGTfE04nNBwnSoygWb0ekqpT+Lm+OP56LMMe9ynVNryDEr9OSKOBhjCBgzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMBMB8GA1UdEQQYMBaCFENOPUF6dXJlIElvVCBSb290IENBMBIGA1UdEwEB/wQIMAYBAf8CAQwwHQYDVR0OBBYEFDjiklfHQzw1G0A33BcmRQTjAivTMAoGCCqGSM49BAMCA0kAMEYCIQCtjJ4bAvoYuDhwr92Kk+OkvpPF+qBFiRfrA/EC4YGtzQIhAO79WPtbUnBQ5fsQnW2aUAT4yJGWL+7l4/qfmqblb96n\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "625" + ], + "x-ms-client-request-id": [ + "0cbc5481-47ed-4b67-9956-af5081fe8613" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"subject\": \"CN=Azure IoT Root CA\",\r\n \"expiry\": \"Sun, 03 Dec 2017 21:02:47 GMT\",\r\n \"thumbprint\": \"9F0983E8F2DB2DB3582997FEF331247D872DEE32\",\r\n \"isVerified\": false,\r\n \"created\": \"Wed, 10 Jan 2018 19:56:41 GMT\",\r\n \"updated\": \"Wed, 10 Jan 2018 19:56:41 GMT\"\r\n },\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCertificatesCreateAndDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCertificatesCreateAndDelete/certificates/DPStestCert\",\r\n \"name\": \"DPStestCert\",\r\n \"type\": \"Microsoft.Devices/IotHubs/Certificates\",\r\n \"etag\": \"AAAAAAAKLik=\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:56:41 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "x-ms-request-id": [ + "4657d2ce-42eb-4e0e-b2ac-fcc0c888d831" + ], + "x-ms-correlation-request-id": [ + "4657d2ce-42eb-4e0e-b2ac-fcc0c888d831" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195641Z:4657d2ce-42eb-4e0e-b2ac-fcc0c888d831" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCertificatesCreateAndDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCertificatesCreateAndDelete/certificates?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQ2VydGlmaWNhdGVzQ3JlYXRlQW5kRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0NlcnRpZmljYXRlc0NyZWF0ZUFuZERlbGV0ZS9jZXJ0aWZpY2F0ZXM/YXBpLXZlcnNpb249MjAxNy0xMS0xNQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "db80f119-1ec1-4d8a-a6fc-fb711dfe8819" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"subject\": \"CN=Azure IoT Root CA\",\r\n \"expiry\": \"Sun, 03 Dec 2017 21:02:47 GMT\",\r\n \"thumbprint\": \"9F0983E8F2DB2DB3582997FEF331247D872DEE32\",\r\n \"isVerified\": false,\r\n \"created\": \"Wed, 10 Jan 2018 19:56:41 GMT\",\r\n \"updated\": \"Wed, 10 Jan 2018 19:56:41 GMT\"\r\n },\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCertificatesCreateAndDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCertificatesCreateAndDelete/certificates/DPStestCert\",\r\n \"name\": \"DPStestCert\",\r\n \"type\": \"Microsoft.Devices/IotHubs/Certificates\",\r\n \"etag\": \"AAAAAAAKLik=\"\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:56:41 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14996" + ], + "x-ms-request-id": [ + "2ea77f36-9144-41d6-9975-832e9e1fd058" + ], + "x-ms-correlation-request-id": [ + "2ea77f36-9144-41d6-9975-832e9e1fd058" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195642Z:2ea77f36-9144-41d6-9975-832e9e1fd058" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCertificatesCreateAndDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCertificatesCreateAndDelete/certificates?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQ2VydGlmaWNhdGVzQ3JlYXRlQW5kRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0NlcnRpZmljYXRlc0NyZWF0ZUFuZERlbGV0ZS9jZXJ0aWZpY2F0ZXM/YXBpLXZlcnNpb249MjAxNy0xMS0xNQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "98144203-3c01-4a35-a46f-44268d0eec15" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": []\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:56:52 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14995" + ], + "x-ms-request-id": [ + "1ab546b9-a6c3-4795-819f-b1e8a419671c" + ], + "x-ms-correlation-request-id": [ + "1ab546b9-a6c3-4795-819f-b1e8a419671c" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195652Z:1ab546b9-a6c3-4795-819f-b1e8a419671c" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCertificatesCreateAndDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCertificatesCreateAndDelete/certificates/DPStestCert/generateVerificationCode?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQ2VydGlmaWNhdGVzQ3JlYXRlQW5kRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0NlcnRpZmljYXRlc0NyZWF0ZUFuZERlbGV0ZS9jZXJ0aWZpY2F0ZXMvRFBTdGVzdENlcnQvZ2VuZXJhdGVWZXJpZmljYXRpb25Db2RlP2FwaS12ZXJzaW9uPTIwMTctMTEtMTU=", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "d268ab0b-9f45-45ec-a001-3319ba927565" + ], + "If-Match": [ + "AAAAAAAKLik=" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"verificationCode\": \"19B6E3906CA4D9711D8CE4C92452EBC8BA5F0423075DF08B\",\r\n \"subject\": \"CN=Azure IoT Root CA\",\r\n \"expiry\": \"Sun, 03 Dec 2017 21:02:47 GMT\",\r\n \"thumbprint\": \"9F0983E8F2DB2DB3582997FEF331247D872DEE32\",\r\n \"isVerified\": false,\r\n \"created\": \"Wed, 10 Jan 2018 19:56:41 GMT\",\r\n \"updated\": \"Wed, 10 Jan 2018 19:56:46 GMT\"\r\n },\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCertificatesCreateAndDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCertificatesCreateAndDelete/certificates/DPStestCert\",\r\n \"name\": \"DPStestCert\",\r\n \"type\": \"Microsoft.Devices/IotHubs/Certificates\",\r\n \"etag\": \"AAAAAAAKLi4=\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:56:46 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1197" + ], + "x-ms-request-id": [ + "53574a71-610e-4cf5-b220-e628c786e78f" + ], + "x-ms-correlation-request-id": [ + "53574a71-610e-4cf5-b220-e628c786e78f" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195646Z:53574a71-610e-4cf5-b220-e628c786e78f" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCertificatesCreateAndDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCertificatesCreateAndDelete/certificates/DPStestCert?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQ2VydGlmaWNhdGVzQ3JlYXRlQW5kRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0NlcnRpZmljYXRlc0NyZWF0ZUFuZERlbGV0ZS9jZXJ0aWZpY2F0ZXMvRFBTdGVzdENlcnQ/YXBpLXZlcnNpb249MjAxNy0xMS0xNQ==", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "b66091b6-4c6c-4ab4-a4b9-a1e9f8eba7b5" + ], + "If-Match": [ + "AAAAAAAKLi4=" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 19:56:51 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "x-ms-request-id": [ + "efabed8a-94a4-4ebb-b145-a649f6d3aa79" + ], + "x-ms-correlation-request-id": [ + "efabed8a-94a4-4ebb-b145-a649f6d3aa79" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T195651Z:efabed8a-94a4-4ebb-b145-a649f6d3aa79" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b" + } +} \ No newline at end of file diff --git a/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientLinkedHubsTests/CreateAndDelete.json b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientLinkedHubsTests/CreateAndDelete.json new file mode 100644 index 000000000000..8ec6d2891c06 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientLinkedHubsTests/CreateAndDelete.json @@ -0,0 +1,1305 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourcegroups/unitTestingDPSLinkedHubCreateUpdateDelete?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlZ3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlP2FwaS12ZXJzaW9uPTIwMTUtMTEtMDE=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"eastus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ], + "x-ms-client-request-id": [ + "c703ace9-a8a1-4274-a54a-f9304130f752" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"name\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:20:38 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "f42f1df7-00fb-49c2-9a68-8c545e6a3023" + ], + "x-ms-correlation-request-id": [ + "f42f1df7-00fb-49c2-9a68-8c545e6a3023" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202038Z:f42f1df7-00fb-49c2-9a68-8c545e6a3023" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9jaGVja1Byb3Zpc2lvbmluZ1NlcnZpY2VOYW1lQXZhaWxhYmlsaXR5P2FwaS12ZXJzaW9uPTIwMTctMTEtMTU=", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"name\": \"unitTestingDPSLinkedHubCreateUpdateDelete\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "59" + ], + "x-ms-client-request-id": [ + "08ac5803-e637-47b8-a5a0-f5b5f2e007ec" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"nameAvailable\": true,\r\n \"reason\": \"Invalid\",\r\n \"message\": null\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:20:41 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "x-ms-request-id": [ + "cbcc637f-37da-422e-9b14-41eef4a04824" + ], + "x-ms-correlation-request-id": [ + "cbcc637f-37da-422e-9b14-41eef4a04824" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202041Z:cbcc637f-37da-422e-9b14-41eef4a04824" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0xpbmtlZEh1YkNyZWF0ZVVwZGF0ZURlbGV0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"capacity\": 1\r\n },\r\n \"location\": \"eastus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "105" + ], + "x-ms-client-request-id": [ + "272d0274-679a-4f4d-9918-dfe21e893d2d" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"name\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Activating\",\r\n \"provisioningState\": \"Accepted\",\r\n \"allocationPolicy\": \"Hashed\",\r\n \"idScope\": null\r\n },\r\n \"resourcegroup\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "614" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:20:43 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete/operationResults/b3NfaWRfNTdkNzA3MDktYzJiNi00M2ZkLWIwYTAtOTI5MTI4NjUwNTgy?api-version=2017-11-15&asyncinfo" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "4999" + ], + "x-ms-request-id": [ + "5e9e98b2-8115-487e-a78a-c21ea819e2df" + ], + "x-ms-correlation-request-id": [ + "5e9e98b2-8115-487e-a78a-c21ea819e2df" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202043Z:5e9e98b2-8115-487e-a78a-c21ea819e2df" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0xpbmtlZEh1YkNyZWF0ZVVwZGF0ZURlbGV0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"etag\": \"AAAAAAAKL0M=\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [\r\n {\r\n \"connectionString\": \"HostName=unitTestingDPSLinkedHubCreateUpdateDelete.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=uOMtgBq+O49FmtSqzLSjIX9JVWBzDtipIv2RvdP8eWI=\",\r\n \"location\": \"eastus\"\r\n }\r\n ],\r\n \"allocationPolicy\": \"Hashed\"\r\n },\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"capacity\": 1\r\n },\r\n \"location\": \"eastus\",\r\n \"tags\": {}\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "477" + ], + "x-ms-client-request-id": [ + "81829ed2-e782-4423-8911-c40ff9b11cc0" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKL0M=\",\r\n \"name\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Transitioning\",\r\n \"provisioningState\": \"Accepted\",\r\n \"iotHubs\": [\r\n {\r\n \"connectionString\": \"HostName=unitTestingDPSLinkedHubCreateUpdateDelete.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=uOMtgBq+O49FmtSqzLSjIX9JVWBzDtipIv2RvdP8eWI=\",\r\n \"location\": \"eastus\"\r\n }\r\n ],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"idScope\": null\r\n },\r\n \"resourcegroup\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "856" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:24:03 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete/operationResults/b3NfaWRfM2UwZTcyYWItZTEwNy00YTQyLTk4N2EtOGViOWQ5NzIwYWM4?api-version=2017-11-15&asyncinfo" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "4999" + ], + "x-ms-request-id": [ + "1b1deacd-6d60-4851-b566-d03b4609db7e" + ], + "x-ms-correlation-request-id": [ + "1b1deacd-6d60-4851-b566-d03b4609db7e" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202404Z:1b1deacd-6d60-4851-b566-d03b4609db7e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0xpbmtlZEh1YkNyZWF0ZVVwZGF0ZURlbGV0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"etag\": \"AAAAAAAKL1Y=\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [\r\n {\r\n \"applyAllocationPolicy\": true,\r\n \"allocationWeight\": 870084357,\r\n \"connectionString\": \"HostName=unitTestingDPSLinkedHubCreateUpdateDelete.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=****\",\r\n \"location\": \"eastus\"\r\n }\r\n ],\r\n \"allocationPolicy\": \"Hashed\"\r\n },\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"capacity\": 1\r\n },\r\n \"location\": \"eastus\",\r\n \"tags\": {}\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "517" + ], + "x-ms-client-request-id": [ + "fec391ae-7f64-48c6-926f-7b12b7b65229" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKL1Y=\",\r\n \"name\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Transitioning\",\r\n \"provisioningState\": \"Accepted\",\r\n \"iotHubs\": [\r\n {\r\n \"applyAllocationPolicy\": true,\r\n \"allocationWeight\": 870084357,\r\n \"connectionString\": \"HostName=unitTestingDPSLinkedHubCreateUpdateDelete.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=****\",\r\n \"location\": \"eastus\"\r\n }\r\n ],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"idScope\": null\r\n },\r\n \"resourcegroup\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "874" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:24:50 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete/operationResults/b3NfaWRfN2JjYjc2ZjEtYTY2ZC00YjkxLWE0NmMtZjk5YmVlNmE4NjRk?api-version=2017-11-15&asyncinfo" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "4998" + ], + "x-ms-request-id": [ + "6e400edb-0980-4690-9f77-ccc7eda175c2" + ], + "x-ms-correlation-request-id": [ + "6e400edb-0980-4690-9f77-ccc7eda175c2" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202451Z:6e400edb-0980-4690-9f77-ccc7eda175c2" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0xpbmtlZEh1YkNyZWF0ZVVwZGF0ZURlbGV0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"etag\": \"AAAAAAAKL0M=\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\"\r\n },\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"capacity\": 1\r\n },\r\n \"location\": \"eastus\",\r\n \"tags\": {}\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "229" + ], + "x-ms-client-request-id": [ + "ea55b2cc-6026-4449-94db-6368ff40fb77" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKL0M=\",\r\n \"name\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Transitioning\",\r\n \"provisioningState\": \"Accepted\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"idScope\": null\r\n },\r\n \"resourcegroup\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "652" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:25:30 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete/operationResults/b3NfaWRfZWFjZWM2YzItNGMzYi00NzY3LWIwNDItODAyY2NmN2VlMjc5?api-version=2017-11-15&asyncinfo" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "4997" + ], + "x-ms-request-id": [ + "df82401a-deca-4176-858a-865e1d612432" + ], + "x-ms-correlation-request-id": [ + "df82401a-deca-4176-858a-865e1d612432" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202531Z:df82401a-deca-4176-858a-865e1d612432" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete/operationResults/b3NfaWRfNTdkNzA3MDktYzJiNi00M2ZkLWIwYTAtOTI5MTI4NjUwNTgy?api-version=2017-11-15&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0xpbmtlZEh1YkNyZWF0ZVVwZGF0ZURlbGV0ZS9vcGVyYXRpb25SZXN1bHRzL2IzTmZhV1JmTlRka056QTNNRGt0WXpKaU5pMDBNMlprTFdJd1lUQXRPVEk1TVRJNE5qVXdOVGd5P2FwaS12ZXJzaW9uPTIwMTctMTEtMTUmYXN5bmNpbmZv", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:21:13 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14998" + ], + "x-ms-request-id": [ + "7e4aa4cf-0fdd-4fff-95d6-aa36666de933" + ], + "x-ms-correlation-request-id": [ + "7e4aa4cf-0fdd-4fff-95d6-aa36666de933" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202114Z:7e4aa4cf-0fdd-4fff-95d6-aa36666de933" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0xpbmtlZEh1YkNyZWF0ZVVwZGF0ZURlbGV0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKL0M=\",\r\n \"name\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"serviceOperationsHostName\": \"unitTestingDPSLinkedHubCreateUpdateDelete.azure-devices-provisioning.net\",\r\n \"deviceProvisioningHostName\": \"global.azure-devices-provisioning.net\",\r\n \"idScope\": \"0ne00009295\"\r\n },\r\n \"resourcegroup\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:21:13 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14997" + ], + "x-ms-request-id": [ + "786dba94-1369-4563-945f-a1876dd53e06" + ], + "x-ms-correlation-request-id": [ + "786dba94-1369-4563-945f-a1876dd53e06" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202114Z:786dba94-1369-4563-945f-a1876dd53e06" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0xpbmtlZEh1YkNyZWF0ZVVwZGF0ZURlbGV0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKL1Y=\",\r\n \"name\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [\r\n {\r\n \"name\": \"unitTestingDPSLinkedHubCreateUpdateDelete.azure-devices.net\",\r\n \"connectionString\": \"HostName=unitTestingDPSLinkedHubCreateUpdateDelete.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=****\",\r\n \"location\": \"eastus\"\r\n }\r\n ],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"serviceOperationsHostName\": \"unitTestingDPSLinkedHubCreateUpdateDelete.azure-devices-provisioning.net\",\r\n \"deviceProvisioningHostName\": \"global.azure-devices-provisioning.net\",\r\n \"idScope\": \"0ne00009295\"\r\n },\r\n \"resourcegroup\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:24:34 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14996" + ], + "x-ms-request-id": [ + "e54b2115-1aec-48a0-9498-8e2f8200d672" + ], + "x-ms-correlation-request-id": [ + "e54b2115-1aec-48a0-9498-8e2f8200d672" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202434Z:e54b2115-1aec-48a0-9498-8e2f8200d672" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0xpbmtlZEh1YkNyZWF0ZVVwZGF0ZURlbGV0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKL2A=\",\r\n \"name\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [\r\n {\r\n \"applyAllocationPolicy\": true,\r\n \"allocationWeight\": 870084357,\r\n \"name\": \"unitTestingDPSLinkedHubCreateUpdateDelete.azure-devices.net\",\r\n \"connectionString\": \"HostName=unitTestingDPSLinkedHubCreateUpdateDelete.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=****\",\r\n \"location\": \"eastus\"\r\n }\r\n ],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"serviceOperationsHostName\": \"unitTestingDPSLinkedHubCreateUpdateDelete.azure-devices-provisioning.net\",\r\n \"deviceProvisioningHostName\": \"global.azure-devices-provisioning.net\",\r\n \"idScope\": \"0ne00009295\"\r\n },\r\n \"resourcegroup\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:25:21 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14994" + ], + "x-ms-request-id": [ + "b826aecb-fdbe-4e21-bf52-7c1baaf12cbe" + ], + "x-ms-correlation-request-id": [ + "b826aecb-fdbe-4e21-bf52-7c1baaf12cbe" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202522Z:b826aecb-fdbe-4e21-bf52-7c1baaf12cbe" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0xpbmtlZEh1YkNyZWF0ZVVwZGF0ZURlbGV0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKL3w=\",\r\n \"name\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"serviceOperationsHostName\": \"unitTestingDPSLinkedHubCreateUpdateDelete.azure-devices-provisioning.net\",\r\n \"deviceProvisioningHostName\": \"global.azure-devices-provisioning.net\",\r\n \"idScope\": \"0ne00009295\"\r\n },\r\n \"resourcegroup\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:26:01 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14992" + ], + "x-ms-request-id": [ + "71dd1150-d530-42fc-8aa6-caa5048eeb57" + ], + "x-ms-correlation-request-id": [ + "71dd1150-d530-42fc-8aa6-caa5048eeb57" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202601Z:71dd1150-d530-42fc-8aa6-caa5048eeb57" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/IotHubs/unitTestingDPSLinkedHubCreateUpdateDelete?api-version=2017-07-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9Jb3RIdWJzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlP2FwaS12ZXJzaW9uPTIwMTctMDctMDE=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"resourcegroup\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"properties\": {\r\n \"routing\": {}\r\n },\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"capacity\": 1\r\n },\r\n \"location\": \"eastus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "254" + ], + "x-ms-client-request-id": [ + "d6c91d99-e00c-4b95-9816-c0d2d2f9d335" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.IotHub.IotHubClient/1.1.3.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/IotHubs/unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"name\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"type\": \"Microsoft.Devices/IotHubs\",\r\n \"location\": \"eastus\",\r\n \"tags\": {},\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"resourcegroup\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"properties\": {\r\n \"state\": \"Activating\",\r\n \"provisioningState\": \"Accepted\",\r\n \"routing\": {\r\n \"endpoints\": {\r\n \"serviceBusQueues\": [],\r\n \"serviceBusTopics\": [],\r\n \"eventHubs\": [],\r\n \"storageContainers\": []\r\n },\r\n \"routes\": [],\r\n \"fallbackRoute\": {\r\n \"name\": \"$fallback\",\r\n \"source\": \"DeviceMessages\",\r\n \"condition\": \"true\",\r\n \"endpointNames\": [\r\n \"events\"\r\n ],\r\n \"isEnabled\": false\r\n }\r\n },\r\n \"enableFileUploadNotifications\": false,\r\n \"cloudToDevice\": {\r\n \"maxDeliveryCount\": 10,\r\n \"defaultTtlAsIso8601\": \"PT1H\",\r\n \"feedback\": {\r\n \"lockDurationAsIso8601\": \"PT1M\",\r\n \"ttlAsIso8601\": \"PT1H\",\r\n \"maxDeliveryCount\": 10\r\n }\r\n },\r\n \"features\": \"None\"\r\n },\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "1005" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:21:20 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/IotHubs/unitTestingDPSLinkedHubCreateUpdateDelete/operationResults/b3NfaWhfNjA2MjAxMTMtYTY5Ni00MWQ2LTgyOTAtOGQyNGM4NTExMmNk?api-version=2017-07-01&asyncinfo" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "4999" + ], + "x-ms-request-id": [ + "ceb7f863-5954-48b6-95df-6add4661941f" + ], + "x-ms-correlation-request-id": [ + "ceb7f863-5954-48b6-95df-6add4661941f" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202121Z:ceb7f863-5954-48b6-95df-6add4661941f" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/IotHubs/unitTestingDPSLinkedHubCreateUpdateDelete/operationResults/b3NfaWhfNjA2MjAxMTMtYTY5Ni00MWQ2LTgyOTAtOGQyNGM4NTExMmNk?api-version=2017-07-01&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9Jb3RIdWJzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL29wZXJhdGlvblJlc3VsdHMvYjNOZmFXaGZOakEyTWpBeE1UTXRZVFk1TmkwME1XUTJMVGd5T1RBdE9HUXlOR000TlRFeE1tTms/YXBpLXZlcnNpb249MjAxNy0wNy0wMSZhc3luY2luZm8=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.IotHub.IotHubClient/1.1.3.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Running\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:21:51 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14993" + ], + "x-ms-request-id": [ + "84288a05-230c-422c-a070-5ea2ed9606fe" + ], + "x-ms-correlation-request-id": [ + "84288a05-230c-422c-a070-5ea2ed9606fe" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202151Z:84288a05-230c-422c-a070-5ea2ed9606fe" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/IotHubs/unitTestingDPSLinkedHubCreateUpdateDelete/operationResults/b3NfaWhfNjA2MjAxMTMtYTY5Ni00MWQ2LTgyOTAtOGQyNGM4NTExMmNk?api-version=2017-07-01&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9Jb3RIdWJzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL29wZXJhdGlvblJlc3VsdHMvYjNOZmFXaGZOakEyTWpBeE1UTXRZVFk1TmkwME1XUTJMVGd5T1RBdE9HUXlOR000TlRFeE1tTms/YXBpLXZlcnNpb249MjAxNy0wNy0wMSZhc3luY2luZm8=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.IotHub.IotHubClient/1.1.3.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Running\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:22:21 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14992" + ], + "x-ms-request-id": [ + "24570049-e4ec-4b33-9ee8-e8c3772c493a" + ], + "x-ms-correlation-request-id": [ + "24570049-e4ec-4b33-9ee8-e8c3772c493a" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202221Z:24570049-e4ec-4b33-9ee8-e8c3772c493a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/IotHubs/unitTestingDPSLinkedHubCreateUpdateDelete/operationResults/b3NfaWhfNjA2MjAxMTMtYTY5Ni00MWQ2LTgyOTAtOGQyNGM4NTExMmNk?api-version=2017-07-01&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9Jb3RIdWJzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL29wZXJhdGlvblJlc3VsdHMvYjNOZmFXaGZOakEyTWpBeE1UTXRZVFk1TmkwME1XUTJMVGd5T1RBdE9HUXlOR000TlRFeE1tTms/YXBpLXZlcnNpb249MjAxNy0wNy0wMSZhc3luY2luZm8=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.IotHub.IotHubClient/1.1.3.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Running\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:22:51 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14991" + ], + "x-ms-request-id": [ + "a85a5685-3ceb-41ca-89f5-a1cb892a555c" + ], + "x-ms-correlation-request-id": [ + "a85a5685-3ceb-41ca-89f5-a1cb892a555c" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202252Z:a85a5685-3ceb-41ca-89f5-a1cb892a555c" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/IotHubs/unitTestingDPSLinkedHubCreateUpdateDelete/operationResults/b3NfaWhfNjA2MjAxMTMtYTY5Ni00MWQ2LTgyOTAtOGQyNGM4NTExMmNk?api-version=2017-07-01&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9Jb3RIdWJzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL29wZXJhdGlvblJlc3VsdHMvYjNOZmFXaGZOakEyTWpBeE1UTXRZVFk1TmkwME1XUTJMVGd5T1RBdE9HUXlOR000TlRFeE1tTms/YXBpLXZlcnNpb249MjAxNy0wNy0wMSZhc3luY2luZm8=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.IotHub.IotHubClient/1.1.3.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Running\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:23:21 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14990" + ], + "x-ms-request-id": [ + "ccac08b3-7b81-403c-adfc-dd5ed8f6cb5b" + ], + "x-ms-correlation-request-id": [ + "ccac08b3-7b81-403c-adfc-dd5ed8f6cb5b" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202322Z:ccac08b3-7b81-403c-adfc-dd5ed8f6cb5b" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/IotHubs/unitTestingDPSLinkedHubCreateUpdateDelete/operationResults/b3NfaWhfNjA2MjAxMTMtYTY5Ni00MWQ2LTgyOTAtOGQyNGM4NTExMmNk?api-version=2017-07-01&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9Jb3RIdWJzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL29wZXJhdGlvblJlc3VsdHMvYjNOZmFXaGZOakEyTWpBeE1UTXRZVFk1TmkwME1XUTJMVGd5T1RBdE9HUXlOR000TlRFeE1tTms/YXBpLXZlcnNpb249MjAxNy0wNy0wMSZhc3luY2luZm8=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.IotHub.IotHubClient/1.1.3.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:23:51 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14989" + ], + "x-ms-request-id": [ + "5fb76789-15cc-4992-bba9-338ab4310038" + ], + "x-ms-correlation-request-id": [ + "5fb76789-15cc-4992-bba9-338ab4310038" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202352Z:5fb76789-15cc-4992-bba9-338ab4310038" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/IotHubs/unitTestingDPSLinkedHubCreateUpdateDelete?api-version=2017-07-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9Jb3RIdWJzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlP2FwaS12ZXJzaW9uPTIwMTctMDctMDE=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.IotHub.IotHubClient/1.1.3.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/IotHubs/unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"name\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"type\": \"Microsoft.Devices/IotHubs\",\r\n \"location\": \"eastus\",\r\n \"tags\": {},\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"resourcegroup\": \"unitTestingDPSLinkedHubCreateUpdateDelete\",\r\n \"etag\": \"AAAAAAFsgQE=\",\r\n \"properties\": {\r\n \"operationsMonitoringProperties\": {\r\n \"events\": {\r\n \"None\": \"None\",\r\n \"Connections\": \"None\",\r\n \"DeviceTelemetry\": \"None\",\r\n \"C2DCommands\": \"None\",\r\n \"DeviceIdentityOperations\": \"None\",\r\n \"FileUploadOperations\": \"None\",\r\n \"Routes\": \"None\"\r\n }\r\n },\r\n \"state\": \"Active\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"ipFilterRules\": [],\r\n \"hostName\": \"unitTestingDPSLinkedHubCreateUpdateDelete.azure-devices.net\",\r\n \"eventHubEndpoints\": {\r\n \"events\": {\r\n \"retentionTimeInDays\": 1,\r\n \"partitionCount\": 4,\r\n \"partitionIds\": [\r\n \"0\",\r\n \"1\",\r\n \"2\",\r\n \"3\"\r\n ],\r\n \"path\": \"unittestingdpslinkedhubcr\",\r\n \"endpoint\": \"sb://iothub-ns-unittestin-313630-e964877a0a.servicebus.windows.net/\"\r\n },\r\n \"operationsMonitoringEvents\": {\r\n \"retentionTimeInDays\": 1,\r\n \"partitionCount\": 4,\r\n \"partitionIds\": [\r\n \"0\",\r\n \"1\",\r\n \"2\",\r\n \"3\"\r\n ],\r\n \"path\": \"unittestingdpslinkedhubcr-operationmonitoring\",\r\n \"endpoint\": \"sb://iothub-ns-unittestin-313630-e964877a0a.servicebus.windows.net/\"\r\n }\r\n },\r\n \"routing\": {\r\n \"endpoints\": {\r\n \"serviceBusQueues\": [],\r\n \"serviceBusTopics\": [],\r\n \"eventHubs\": [],\r\n \"storageContainers\": []\r\n },\r\n \"routes\": [],\r\n \"fallbackRoute\": {\r\n \"name\": \"$fallback\",\r\n \"source\": \"DeviceMessages\",\r\n \"condition\": \"true\",\r\n \"endpointNames\": [\r\n \"events\"\r\n ],\r\n \"isEnabled\": false\r\n }\r\n },\r\n \"storageEndpoints\": {\r\n \"$default\": {\r\n \"sasTtlAsIso8601\": \"PT1H\",\r\n \"connectionString\": \"\",\r\n \"containerName\": \"\"\r\n }\r\n },\r\n \"messagingEndpoints\": {\r\n \"fileNotifications\": {\r\n \"lockDurationAsIso8601\": \"PT1M\",\r\n \"ttlAsIso8601\": \"PT1H\",\r\n \"maxDeliveryCount\": 10\r\n }\r\n },\r\n \"enableFileUploadNotifications\": false,\r\n \"cloudToDevice\": {\r\n \"maxDeliveryCount\": 10,\r\n \"defaultTtlAsIso8601\": \"PT1H\",\r\n \"feedback\": {\r\n \"lockDurationAsIso8601\": \"PT1M\",\r\n \"ttlAsIso8601\": \"PT1H\",\r\n \"maxDeliveryCount\": 10\r\n }\r\n },\r\n \"features\": \"None\"\r\n },\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:23:51 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14988" + ], + "x-ms-request-id": [ + "372ac736-c922-425a-a0f9-10d07bc25cfb" + ], + "x-ms-correlation-request-id": [ + "372ac736-c922-425a-a0f9-10d07bc25cfb" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202352Z:372ac736-c922-425a-a0f9-10d07bc25cfb" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/IotHubs/unitTestingDPSLinkedHubCreateUpdateDelete/listkeys?api-version=2017-07-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9Jb3RIdWJzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL2xpc3RrZXlzP2FwaS12ZXJzaW9uPTIwMTctMDctMDE=", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "0c28652d-5d86-423c-ba63-9bc3ef7892cc" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.IotHub.IotHubClient/1.1.3.0" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"keyName\": \"iothubowner\",\r\n \"primaryKey\": \"uOMtgBq+O49FmtSqzLSjIX9JVWBzDtipIv2RvdP8eWI=\",\r\n \"secondaryKey\": \"xDSe9zMe/F0tNPQMdIYg2lwE86sCz03mrbDl+7xNTE8=\",\r\n \"rights\": \"RegistryWrite, ServiceConnect, DeviceConnect\"\r\n },\r\n {\r\n \"keyName\": \"service\",\r\n \"primaryKey\": \"7iB0Div5ceNbFo5oS0KlUJHge8LCszsJbs8yzGVr4gI=\",\r\n \"secondaryKey\": \"0UR5eZNnvJBb94OoKxnXxowjfqqxHZaJfd7jUwn4rQo=\",\r\n \"rights\": \"ServiceConnect\"\r\n },\r\n {\r\n \"keyName\": \"device\",\r\n \"primaryKey\": \"WTC1QQN0dJnmEZPMC2+hySxxi0ZvXFRBfMGOylaiDVo=\",\r\n \"secondaryKey\": \"4zTYlwWTlsJ7RT1ufyxL7FFbKTpXrGBOLZzImHtEFLY=\",\r\n \"rights\": \"DeviceConnect\"\r\n },\r\n {\r\n \"keyName\": \"registryRead\",\r\n \"primaryKey\": \"5wvw+cwuPUBfq1dG9AxuVYXv2x2e2D+Inj63lJQUz5g=\",\r\n \"secondaryKey\": \"7QhXEQGY8x6HdxpYcMyYiOMH3521faoN2i6xOGbLG+s=\",\r\n \"rights\": \"RegistryRead\"\r\n },\r\n {\r\n \"keyName\": \"registryReadWrite\",\r\n \"primaryKey\": \"wR+84fhZ//rdzoAEfVEqwYLlHvtLpK1OrqaE+KaDB1g=\",\r\n \"secondaryKey\": \"t+UxMxtt8yUykJB+OTbpJl1qMPrSI2qnLORHA95Ek2Q=\",\r\n \"rights\": \"RegistryWrite\"\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:23:57 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1197" + ], + "x-ms-request-id": [ + "c5ce3880-b8a8-4828-845e-2483631d1b37" + ], + "x-ms-correlation-request-id": [ + "c5ce3880-b8a8-4828-845e-2483631d1b37" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202357Z:c5ce3880-b8a8-4828-845e-2483631d1b37" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete/operationResults/b3NfaWRfM2UwZTcyYWItZTEwNy00YTQyLTk4N2EtOGViOWQ5NzIwYWM4?api-version=2017-11-15&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0xpbmtlZEh1YkNyZWF0ZVVwZGF0ZURlbGV0ZS9vcGVyYXRpb25SZXN1bHRzL2IzTmZhV1JmTTJVd1pUY3lZV0l0WlRFd055MDBZVFF5TFRrNE4yRXRPR1ZpT1dRNU56SXdZV000P2FwaS12ZXJzaW9uPTIwMTctMTEtMTUmYXN5bmNpbmZv", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:24:34 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14997" + ], + "x-ms-request-id": [ + "8433d91e-92e0-4f34-9261-a67d81d4dc65" + ], + "x-ms-correlation-request-id": [ + "8433d91e-92e0-4f34-9261-a67d81d4dc65" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202434Z:8433d91e-92e0-4f34-9261-a67d81d4dc65" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete/operationResults/b3NfaWRfN2JjYjc2ZjEtYTY2ZC00YjkxLWE0NmMtZjk5YmVlNmE4NjRk?api-version=2017-11-15&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0xpbmtlZEh1YkNyZWF0ZVVwZGF0ZURlbGV0ZS9vcGVyYXRpb25SZXN1bHRzL2IzTmZhV1JmTjJKallqYzJaakV0WVRZMlpDMDBZamt4TFdFME5tTXRaams1WW1WbE5tRTROalJrP2FwaS12ZXJzaW9uPTIwMTctMTEtMTUmYXN5bmNpbmZv", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:25:21 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14995" + ], + "x-ms-request-id": [ + "e609683f-2e52-4489-b6a0-5e4c9edbc178" + ], + "x-ms-correlation-request-id": [ + "e609683f-2e52-4489-b6a0-5e4c9edbc178" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202521Z:e609683f-2e52-4489-b6a0-5e4c9edbc178" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSLinkedHubCreateUpdateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSLinkedHubCreateUpdateDelete/operationResults/b3NfaWRfZWFjZWM2YzItNGMzYi00NzY3LWIwNDItODAyY2NmN2VlMjc5?api-version=2017-11-15&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTTGlua2VkSHViQ3JlYXRlVXBkYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0xpbmtlZEh1YkNyZWF0ZVVwZGF0ZURlbGV0ZS9vcGVyYXRpb25SZXN1bHRzL2IzTmZhV1JmWldGalpXTTJZekl0TkdNellpMDBOelkzTFdJd05ESXRPREF5WTJObU4yVmxNamM1P2FwaS12ZXJzaW9uPTIwMTctMTEtMTUmYXN5bmNpbmZv", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:26:01 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14993" + ], + "x-ms-request-id": [ + "b4c24d10-4a1c-4da4-aab5-ac7f2b8d8372" + ], + "x-ms-correlation-request-id": [ + "b4c24d10-4a1c-4da4-aab5-ac7f2b8d8372" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T202601Z:b4c24d10-4a1c-4da4-aab5-ac7f2b8d8372" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b" + } +} \ No newline at end of file diff --git a/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientSharedAccessPolicyTests/ListCreateDelete.json b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientSharedAccessPolicyTests/ListCreateDelete.json new file mode 100644 index 000000000000..534ffd1fa7ea --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientSharedAccessPolicyTests/ListCreateDelete.json @@ -0,0 +1,905 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourcegroups/unitTestingDPSSharedAccessPoliciesListCreateDelete?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlZ3JvdXBzL3VuaXRUZXN0aW5nRFBTU2hhcmVkQWNjZXNzUG9saWNpZXNMaXN0Q3JlYXRlRGVsZXRlP2FwaS12ZXJzaW9uPTIwMTUtMTEtMDE=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"eastus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ], + "x-ms-client-request-id": [ + "b8fb624a-d0f2-44c9-b5c1-b84d78a5c755" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"name\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "253" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:03:37 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "a26fdc09-34f8-4abf-b20a-fff067dee379" + ], + "x-ms-correlation-request-id": [ + "a26fdc09-34f8-4abf-b20a-fff067dee379" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200337Z:a26fdc09-34f8-4abf-b20a-fff067dee379" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9jaGVja1Byb3Zpc2lvbmluZ1NlcnZpY2VOYW1lQXZhaWxhYmlsaXR5P2FwaS12ZXJzaW9uPTIwMTctMTEtMTU=", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"name\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "68" + ], + "x-ms-client-request-id": [ + "7591c8e6-7ae4-490f-ac48-6ac7d7e6a6bc" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"nameAvailable\": true,\r\n \"reason\": \"Invalid\",\r\n \"message\": null\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:03:40 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "a943c5bc-a4b7-4ad6-bf3e-3ecb280f998e" + ], + "x-ms-correlation-request-id": [ + "a943c5bc-a4b7-4ad6-bf3e-3ecb280f998e" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200340Z:a943c5bc-a4b7-4ad6-bf3e-3ecb280f998e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTU2hhcmVkQWNjZXNzUG9saWNpZXNMaXN0Q3JlYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1NoYXJlZEFjY2Vzc1BvbGljaWVzTGlzdENyZWF0ZURlbGV0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"capacity\": 1\r\n },\r\n \"location\": \"eastus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "105" + ], + "x-ms-client-request-id": [ + "f56734d2-eed0-4129-b0ac-15e9dc9944b4" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"name\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Activating\",\r\n \"provisioningState\": \"Accepted\",\r\n \"allocationPolicy\": \"Hashed\",\r\n \"idScope\": null\r\n },\r\n \"resourcegroup\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "650" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:03:42 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete/operationResults/b3NfaWRfN2QyN2E0Y2UtNjEzNS00MzA2LThiNDgtN2Q5MmEwZTZmYWY4?api-version=2017-11-15&asyncinfo" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "4999" + ], + "x-ms-request-id": [ + "76faf5a5-b361-46d2-8166-e37acded63ba" + ], + "x-ms-correlation-request-id": [ + "76faf5a5-b361-46d2-8166-e37acded63ba" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200342Z:76faf5a5-b361-46d2-8166-e37acded63ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTU2hhcmVkQWNjZXNzUG9saWNpZXNMaXN0Q3JlYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1NoYXJlZEFjY2Vzc1BvbGljaWVzTGlzdENyZWF0ZURlbGV0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"etag\": \"AAAAAAAKLoA=\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"authorizationPolicies\": [\r\n {\r\n \"keyName\": \"provisioningserviceowner\",\r\n \"primaryKey\": \"JzNDaC+SK0jjquLv2YzmO0rq82F5ofAFMJnDWbCBe28=\",\r\n \"secondaryKey\": \"OohTJX09SgMjZAyzVbJd1sILs/HWmDNiyoA54fxYl+0=\",\r\n \"rights\": \"ServiceConfig, DeviceConnect, EnrollmentWrite\"\r\n },\r\n {\r\n \"keyName\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"rights\": \"RegistrationStatusWrite\"\r\n }\r\n ]\r\n },\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"capacity\": 1\r\n },\r\n \"location\": \"eastus\",\r\n \"tags\": {}\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "684" + ], + "x-ms-client-request-id": [ + "f2735570-3650-4e0d-946d-a0a2c763b7c9" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKLoA=\",\r\n \"name\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Transitioning\",\r\n \"provisioningState\": \"Accepted\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"idScope\": null,\r\n \"authorizationPolicies\": [\r\n {\r\n \"keyName\": \"provisioningserviceowner\",\r\n \"primaryKey\": \"JzNDaC+SK0jjquLv2YzmO0rq82F5ofAFMJnDWbCBe28=\",\r\n \"secondaryKey\": \"OohTJX09SgMjZAyzVbJd1sILs/HWmDNiyoA54fxYl+0=\",\r\n \"rights\": \"ServiceConfig, DeviceConnect, EnrollmentWrite\"\r\n },\r\n {\r\n \"keyName\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"primaryKey\": \"/ElJwrXKs+tmyiU2oJhZao7+syMhqwgDgX9v6LvdWi4=\",\r\n \"secondaryKey\": \"c2vjhg3vgYQXN609X9L6r+9el5IPSBAgJcBMZ6XiJyg=\",\r\n \"rights\": \"RegistrationStatusWrite\"\r\n }\r\n ]\r\n },\r\n \"resourcegroup\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "1154" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:04:30 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete/operationResults/b3NfaWRfYmI3YWUyODItNjU2Ni00OTc5LWI5ZTUtMzI5Mzg5OTBhNWUz?api-version=2017-11-15&asyncinfo" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "4998" + ], + "x-ms-request-id": [ + "1e748736-f782-49ea-b276-1484b0c30336" + ], + "x-ms-correlation-request-id": [ + "1e748736-f782-49ea-b276-1484b0c30336" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200430Z:1e748736-f782-49ea-b276-1484b0c30336" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTU2hhcmVkQWNjZXNzUG9saWNpZXNMaXN0Q3JlYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1NoYXJlZEFjY2Vzc1BvbGljaWVzTGlzdENyZWF0ZURlbGV0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"etag\": \"AAAAAAAKLoA=\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"authorizationPolicies\": [\r\n {\r\n \"keyName\": \"provisioningserviceowner\",\r\n \"primaryKey\": \"JzNDaC+SK0jjquLv2YzmO0rq82F5ofAFMJnDWbCBe28=\",\r\n \"secondaryKey\": \"OohTJX09SgMjZAyzVbJd1sILs/HWmDNiyoA54fxYl+0=\",\r\n \"rights\": \"ServiceConfig, DeviceConnect, EnrollmentWrite\"\r\n }\r\n ]\r\n },\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"capacity\": 1\r\n },\r\n \"location\": \"eastus\",\r\n \"tags\": {}\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "546" + ], + "x-ms-client-request-id": [ + "968c9fb9-d6bb-4823-b91c-d934169c04ab" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKLoA=\",\r\n \"name\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Transitioning\",\r\n \"provisioningState\": \"Accepted\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"idScope\": null,\r\n \"authorizationPolicies\": [\r\n {\r\n \"keyName\": \"provisioningserviceowner\",\r\n \"primaryKey\": \"JzNDaC+SK0jjquLv2YzmO0rq82F5ofAFMJnDWbCBe28=\",\r\n \"secondaryKey\": \"OohTJX09SgMjZAyzVbJd1sILs/HWmDNiyoA54fxYl+0=\",\r\n \"rights\": \"ServiceConfig, DeviceConnect, EnrollmentWrite\"\r\n }\r\n ]\r\n },\r\n \"resourcegroup\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "932" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:05:15 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete/operationResults/b3NfaWRfYWMwODgwYTMtOTM2OC00ODMxLWFiNzMtMDNjMDhlYmQyYjUy?api-version=2017-11-15&asyncinfo" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "4997" + ], + "x-ms-request-id": [ + "72ea8520-3d88-471d-9633-5876884c4009" + ], + "x-ms-correlation-request-id": [ + "72ea8520-3d88-471d-9633-5876884c4009" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200516Z:72ea8520-3d88-471d-9633-5876884c4009" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete/operationResults/b3NfaWRfN2QyN2E0Y2UtNjEzNS00MzA2LThiNDgtN2Q5MmEwZTZmYWY4?api-version=2017-11-15&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTU2hhcmVkQWNjZXNzUG9saWNpZXNMaXN0Q3JlYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1NoYXJlZEFjY2Vzc1BvbGljaWVzTGlzdENyZWF0ZURlbGV0ZS9vcGVyYXRpb25SZXN1bHRzL2IzTmZhV1JmTjJReU4yRTBZMlV0TmpFek5TMDBNekEyTFRoaU5EZ3ROMlE1TW1Fd1pUWm1ZV1k0P2FwaS12ZXJzaW9uPTIwMTctMTEtMTUmYXN5bmNpbmZv", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:04:12 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14996" + ], + "x-ms-request-id": [ + "adeb09d3-da4e-4936-ba1d-f49942c5f6e7" + ], + "x-ms-correlation-request-id": [ + "adeb09d3-da4e-4936-ba1d-f49942c5f6e7" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200413Z:adeb09d3-da4e-4936-ba1d-f49942c5f6e7" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTU2hhcmVkQWNjZXNzUG9saWNpZXNMaXN0Q3JlYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1NoYXJlZEFjY2Vzc1BvbGljaWVzTGlzdENyZWF0ZURlbGV0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKLoA=\",\r\n \"name\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"serviceOperationsHostName\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete.azure-devices-provisioning.net\",\r\n \"deviceProvisioningHostName\": \"global.azure-devices-provisioning.net\",\r\n \"idScope\": \"0ne0000928B\"\r\n },\r\n \"resourcegroup\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:04:12 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14995" + ], + "x-ms-request-id": [ + "e23d3073-1874-427e-9298-8b09a161cdcb" + ], + "x-ms-correlation-request-id": [ + "e23d3073-1874-427e-9298-8b09a161cdcb" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200413Z:e23d3073-1874-427e-9298-8b09a161cdcb" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTU2hhcmVkQWNjZXNzUG9saWNpZXNMaXN0Q3JlYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1NoYXJlZEFjY2Vzc1BvbGljaWVzTGlzdENyZWF0ZURlbGV0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKLoY=\",\r\n \"name\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"serviceOperationsHostName\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete.azure-devices-provisioning.net\",\r\n \"deviceProvisioningHostName\": \"global.azure-devices-provisioning.net\",\r\n \"idScope\": \"0ne0000928B\"\r\n },\r\n \"resourcegroup\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:05:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14993" + ], + "x-ms-request-id": [ + "e354116c-436f-42ce-9a37-4730c24eb97d" + ], + "x-ms-correlation-request-id": [ + "e354116c-436f-42ce-9a37-4730c24eb97d" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200501Z:e354116c-436f-42ce-9a37-4730c24eb97d" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTU2hhcmVkQWNjZXNzUG9saWNpZXNMaXN0Q3JlYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1NoYXJlZEFjY2Vzc1BvbGljaWVzTGlzdENyZWF0ZURlbGV0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKLow=\",\r\n \"name\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"serviceOperationsHostName\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete.azure-devices-provisioning.net\",\r\n \"deviceProvisioningHostName\": \"global.azure-devices-provisioning.net\",\r\n \"idScope\": \"0ne0000928B\"\r\n },\r\n \"resourcegroup\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:05:46 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14991" + ], + "x-ms-request-id": [ + "6741a6dc-b34b-4238-862f-9a187bf841ec" + ], + "x-ms-correlation-request-id": [ + "6741a6dc-b34b-4238-862f-9a187bf841ec" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200546Z:6741a6dc-b34b-4238-862f-9a187bf841ec" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete/keys/provisioningserviceowner/listkeys?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTU2hhcmVkQWNjZXNzUG9saWNpZXNMaXN0Q3JlYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1NoYXJlZEFjY2Vzc1BvbGljaWVzTGlzdENyZWF0ZURlbGV0ZS9rZXlzL3Byb3Zpc2lvbmluZ3NlcnZpY2Vvd25lci9saXN0a2V5cz9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "06d4c499-ca2c-495b-921a-35ccd34fdde5" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"keyName\": \"provisioningserviceowner\",\r\n \"primaryKey\": \"JzNDaC+SK0jjquLv2YzmO0rq82F5ofAFMJnDWbCBe28=\",\r\n \"secondaryKey\": \"OohTJX09SgMjZAyzVbJd1sILs/HWmDNiyoA54fxYl+0=\",\r\n \"rights\": \"ServiceConfig, DeviceConnect, EnrollmentWrite\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:04:20 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "x-ms-request-id": [ + "181d791f-4c50-4ac5-ad98-6fee784cefe2" + ], + "x-ms-correlation-request-id": [ + "181d791f-4c50-4ac5-ad98-6fee784cefe2" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200421Z:181d791f-4c50-4ac5-ad98-6fee784cefe2" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete/keys/unitTestingDPSSharedAccessPoliciesListCreateDelete/listkeys?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTU2hhcmVkQWNjZXNzUG9saWNpZXNMaXN0Q3JlYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1NoYXJlZEFjY2Vzc1BvbGljaWVzTGlzdENyZWF0ZURlbGV0ZS9rZXlzL3VuaXRUZXN0aW5nRFBTU2hhcmVkQWNjZXNzUG9saWNpZXNMaXN0Q3JlYXRlRGVsZXRlL2xpc3RrZXlzP2FwaS12ZXJzaW9uPTIwMTctMTEtMTU=", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "fc2681c4-ec33-4cc2-8aa9-4b983fac2f2c" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"Code\": \"KeyNameNotFound\",\r\n \"HttpStatusCode\": \"NotFound\",\r\n \"Message\": \"Key name not found: unitTestingDPSSharedAccessPoliciesListCreateDelete. If you contact a support representative please include this correlation identifier: 908b57be-a66c-45e0-836d-1ed7528be272, timestamp: 2018-01-10 20:04:22Z, errorcode: IH404001.\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "314" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:04:21 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1197" + ], + "x-ms-request-id": [ + "a62d51ea-948c-4788-a82c-9f6b891e3708" + ], + "x-ms-correlation-request-id": [ + "a62d51ea-948c-4788-a82c-9f6b891e3708" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200422Z:a62d51ea-948c-4788-a82c-9f6b891e3708" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete/keys/unitTestingDPSSharedAccessPoliciesListCreateDelete/listkeys?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTU2hhcmVkQWNjZXNzUG9saWNpZXNMaXN0Q3JlYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1NoYXJlZEFjY2Vzc1BvbGljaWVzTGlzdENyZWF0ZURlbGV0ZS9rZXlzL3VuaXRUZXN0aW5nRFBTU2hhcmVkQWNjZXNzUG9saWNpZXNMaXN0Q3JlYXRlRGVsZXRlL2xpc3RrZXlzP2FwaS12ZXJzaW9uPTIwMTctMTEtMTU=", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "b3fa0893-430e-4c15-a006-5ef3529f0ff3" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"keyName\": \"unitTestingDPSSharedAccessPoliciesListCreateDelete\",\r\n \"primaryKey\": \"/ElJwrXKs+tmyiU2oJhZao7+syMhqwgDgX9v6LvdWi4=\",\r\n \"secondaryKey\": \"c2vjhg3vgYQXN609X9L6r+9el5IPSBAgJcBMZ6XiJyg=\",\r\n \"rights\": \"RegistrationStatusWrite\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:05:08 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "x-ms-request-id": [ + "4090453c-70fb-4ba8-becd-72c0f6618040" + ], + "x-ms-correlation-request-id": [ + "4090453c-70fb-4ba8-becd-72c0f6618040" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200509Z:4090453c-70fb-4ba8-becd-72c0f6618040" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete/keys/unitTestingDPSSharedAccessPoliciesListCreateDelete/listkeys?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTU2hhcmVkQWNjZXNzUG9saWNpZXNMaXN0Q3JlYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1NoYXJlZEFjY2Vzc1BvbGljaWVzTGlzdENyZWF0ZURlbGV0ZS9rZXlzL3VuaXRUZXN0aW5nRFBTU2hhcmVkQWNjZXNzUG9saWNpZXNMaXN0Q3JlYXRlRGVsZXRlL2xpc3RrZXlzP2FwaS12ZXJzaW9uPTIwMTctMTEtMTU=", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "8c6bd9c1-3e0f-42a4-ba1a-6489a4bb7ba8" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"Code\": \"KeyNameNotFound\",\r\n \"HttpStatusCode\": \"NotFound\",\r\n \"Message\": \"Key name not found: unitTestingDPSSharedAccessPoliciesListCreateDelete. If you contact a support representative please include this correlation identifier: 145b035b-4f34-4c92-a60b-7dd19be9dc14, timestamp: 2018-01-10 20:05:53Z, errorcode: IH404001.\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "314" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:05:51 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1195" + ], + "x-ms-request-id": [ + "3da33d68-36e4-493c-b2aa-da204e148136" + ], + "x-ms-correlation-request-id": [ + "3da33d68-36e4-493c-b2aa-da204e148136" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200552Z:3da33d68-36e4-493c-b2aa-da204e148136" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete/operationResults/b3NfaWRfYmI3YWUyODItNjU2Ni00OTc5LWI5ZTUtMzI5Mzg5OTBhNWUz?api-version=2017-11-15&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTU2hhcmVkQWNjZXNzUG9saWNpZXNMaXN0Q3JlYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1NoYXJlZEFjY2Vzc1BvbGljaWVzTGlzdENyZWF0ZURlbGV0ZS9vcGVyYXRpb25SZXN1bHRzL2IzTmZhV1JmWW1JM1lXVXlPREl0TmpVMk5pMDBPVGM1TFdJNVpUVXRNekk1TXpnNU9UQmhOV1V6P2FwaS12ZXJzaW9uPTIwMTctMTEtMTUmYXN5bmNpbmZv", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:05:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14994" + ], + "x-ms-request-id": [ + "ba5a3259-1ddb-4cad-b19a-f68af133c28e" + ], + "x-ms-correlation-request-id": [ + "ba5a3259-1ddb-4cad-b19a-f68af133c28e" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200500Z:ba5a3259-1ddb-4cad-b19a-f68af133c28e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSSharedAccessPoliciesListCreateDelete/providers/Microsoft.Devices/provisioningServices/unitTestingDPSSharedAccessPoliciesListCreateDelete/operationResults/b3NfaWRfYWMwODgwYTMtOTM2OC00ODMxLWFiNzMtMDNjMDhlYmQyYjUy?api-version=2017-11-15&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTU2hhcmVkQWNjZXNzUG9saWNpZXNMaXN0Q3JlYXRlRGVsZXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1NoYXJlZEFjY2Vzc1BvbGljaWVzTGlzdENyZWF0ZURlbGV0ZS9vcGVyYXRpb25SZXN1bHRzL2IzTmZhV1JmWVdNd09EZ3dZVE10T1RNMk9DMDBPRE14TFdGaU56TXRNRE5qTURobFltUXlZalV5P2FwaS12ZXJzaW9uPTIwMTctMTEtMTUmYXN5bmNpbmZv", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:05:45 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14992" + ], + "x-ms-request-id": [ + "9f759233-c362-4c0e-b1a4-d918abbf37d6" + ], + "x-ms-correlation-request-id": [ + "9f759233-c362-4c0e-b1a4-d918abbf37d6" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200546Z:9f759233-c362-4c0e-b1a4-d918abbf37d6" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b" + } +} \ No newline at end of file diff --git a/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientTest/CreateAndDelete.json b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientTest/CreateAndDelete.json new file mode 100644 index 000000000000..ea5bc3fbb7cd --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientTest/CreateAndDelete.json @@ -0,0 +1,618 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourcegroups/unitTestingDPSCreateUpdate?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlZ3JvdXBzL3VuaXRUZXN0aW5nRFBTQ3JlYXRlVXBkYXRlP2FwaS12ZXJzaW9uPTIwMTUtMTEtMDE=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"eastus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ], + "x-ms-client-request-id": [ + "3f7bd5c8-3a5f-44f7-90ec-ab14cfe867fb" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCreateUpdate\",\r\n \"name\": \"unitTestingDPSCreateUpdate\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "205" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:06:43 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "36cc8657-7e51-4372-9995-0f1fbc812300" + ], + "x-ms-correlation-request-id": [ + "36cc8657-7e51-4372-9995-0f1fbc812300" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200644Z:36cc8657-7e51-4372-9995-0f1fbc812300" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9jaGVja1Byb3Zpc2lvbmluZ1NlcnZpY2VOYW1lQXZhaWxhYmlsaXR5P2FwaS12ZXJzaW9uPTIwMTctMTEtMTU=", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"name\": \"unitTestingDPSCreateUpdate\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "44" + ], + "x-ms-client-request-id": [ + "c1be89c7-2b2d-4db3-969c-85add4d33782" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"nameAvailable\": true,\r\n \"reason\": \"Invalid\",\r\n \"message\": null\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:06:48 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "x-ms-request-id": [ + "c40d38a9-95d9-4ed1-a592-6aa33d467b55" + ], + "x-ms-correlation-request-id": [ + "c40d38a9-95d9-4ed1-a592-6aa33d467b55" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200649Z:c40d38a9-95d9-4ed1-a592-6aa33d467b55" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCreateUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCreateUpdate?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQ3JlYXRlVXBkYXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0NyZWF0ZVVwZGF0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"capacity\": 1\r\n },\r\n \"location\": \"eastus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "105" + ], + "x-ms-client-request-id": [ + "200891ae-3535-4bb2-8595-9ed01479c066" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"name\": \"unitTestingDPSCreateUpdate\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Activating\",\r\n \"provisioningState\": \"Accepted\",\r\n \"allocationPolicy\": \"Hashed\",\r\n \"idScope\": null\r\n },\r\n \"resourcegroup\": \"unitTestingDPSCreateUpdate\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCreateUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCreateUpdate\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "554" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:06:53 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCreateUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCreateUpdate/operationResults/b3NfaWRfYjRmMjI0YWEtZjg2Ni00NDhkLWE5N2MtYTdlMmU2ODlkMjNm?api-version=2017-11-15&asyncinfo" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "4999" + ], + "x-ms-request-id": [ + "443eee4d-b670-4728-9b91-2bda8641c5d7" + ], + "x-ms-correlation-request-id": [ + "443eee4d-b670-4728-9b91-2bda8641c5d7" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200654Z:443eee4d-b670-4728-9b91-2bda8641c5d7" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCreateUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCreateUpdate/operationResults/b3NfaWRfYjRmMjI0YWEtZjg2Ni00NDhkLWE5N2MtYTdlMmU2ODlkMjNm?api-version=2017-11-15&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQ3JlYXRlVXBkYXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0NyZWF0ZVVwZGF0ZS9vcGVyYXRpb25SZXN1bHRzL2IzTmZhV1JmWWpSbU1qSTBZV0V0WmpnMk5pMDBORGhrTFdFNU4yTXRZVGRsTW1VMk9EbGtNak5tP2FwaS12ZXJzaW9uPTIwMTctMTEtMTUmYXN5bmNpbmZv", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:07:24 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14996" + ], + "x-ms-request-id": [ + "05701055-8d44-4119-8b3d-883994251249" + ], + "x-ms-correlation-request-id": [ + "05701055-8d44-4119-8b3d-883994251249" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200724Z:05701055-8d44-4119-8b3d-883994251249" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCreateUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCreateUpdate?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQ3JlYXRlVXBkYXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0NyZWF0ZVVwZGF0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKLqg=\",\r\n \"name\": \"unitTestingDPSCreateUpdate\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"serviceOperationsHostName\": \"unitTestingDPSCreateUpdate.azure-devices-provisioning.net\",\r\n \"deviceProvisioningHostName\": \"global.azure-devices-provisioning.net\",\r\n \"idScope\": \"0ne0000928D\"\r\n },\r\n \"resourcegroup\": \"unitTestingDPSCreateUpdate\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCreateUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCreateUpdate\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:07:24 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14995" + ], + "x-ms-request-id": [ + "c62f3351-2422-4e6b-92a2-d8e82618054f" + ], + "x-ms-correlation-request-id": [ + "c62f3351-2422-4e6b-92a2-d8e82618054f" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200724Z:c62f3351-2422-4e6b-92a2-d8e82618054f" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCreateUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCreateUpdate?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQ3JlYXRlVXBkYXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0NyZWF0ZVVwZGF0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "80458e90-8c70-4006-81b1-da9a94adfba8" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKLqg=\",\r\n \"name\": \"unitTestingDPSCreateUpdate\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"serviceOperationsHostName\": \"unitTestingDPSCreateUpdate.azure-devices-provisioning.net\",\r\n \"deviceProvisioningHostName\": \"global.azure-devices-provisioning.net\",\r\n \"idScope\": \"0ne0000928D\"\r\n },\r\n \"resourcegroup\": \"unitTestingDPSCreateUpdate\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCreateUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCreateUpdate\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:07:31 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14993" + ], + "x-ms-request-id": [ + "aeea6ff0-91c8-4e0b-91e9-a809b11f79a6" + ], + "x-ms-correlation-request-id": [ + "aeea6ff0-91c8-4e0b-91e9-a809b11f79a6" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200731Z:aeea6ff0-91c8-4e0b-91e9-a809b11f79a6" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCreateUpdate/providers/Microsoft.Devices/provisioningServices?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQ3JlYXRlVXBkYXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcz9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "1dd74399-5d8d-4a99-b36d-b2961e0525ce" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"etag\": \"AAAAAAAKLqg=\",\r\n \"name\": \"unitTestingDPSCreateUpdate\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"serviceOperationsHostName\": \"unitTestingDPSCreateUpdate.azure-devices-provisioning.net\",\r\n \"deviceProvisioningHostName\": \"global.azure-devices-provisioning.net\",\r\n \"idScope\": \"0ne0000928D\"\r\n },\r\n \"resourcegroup\": \"unitTestingDPSCreateUpdate\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCreateUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCreateUpdate\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:07:29 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14994" + ], + "x-ms-request-id": [ + "8df483d8-fbe2-47a9-afb2-9d50c83dc4eb" + ], + "x-ms-correlation-request-id": [ + "8df483d8-fbe2-47a9-afb2-9d50c83dc4eb" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200729Z:8df483d8-fbe2-47a9-afb2-9d50c83dc4eb" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCreateUpdate/providers/Microsoft.Devices/provisioningServices?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQ3JlYXRlVXBkYXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcz9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "2edd44b3-8c6e-4061-8f10-511723de1a5b" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": []\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:08:01 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14991" + ], + "x-ms-request-id": [ + "d51a2568-7cd9-4240-a85a-3b3863788226" + ], + "x-ms-correlation-request-id": [ + "d51a2568-7cd9-4240-a85a-3b3863788226" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200801Z:d51a2568-7cd9-4240-a85a-3b3863788226" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCreateUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCreateUpdate?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQ3JlYXRlVXBkYXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0NyZWF0ZVVwZGF0ZT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "66432e04-fbba-4245-8e11-1ecc338d8642" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "null", + "ResponseHeaders": { + "Content-Length": [ + "4" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:07:39 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCreateUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCreateUpdate/operationResults/b3NfaWRfNWVmMGRkMGEtYzRhZC00MjM3LTgwZWEtOWU3NGFiZGY4MDkw?api-version=2017-11-15" + ], + "Retry-After": [ + "15" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCreateUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCreateUpdate/operationResults/b3NfaWRfNWVmMGRkMGEtYzRhZC00MjM3LTgwZWEtOWU3NGFiZGY4MDkw?api-version=2017-11-15&asyncinfo" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1197" + ], + "x-ms-request-id": [ + "a2c82fca-d8a4-4b6a-ac14-a163d989b0ab" + ], + "x-ms-correlation-request-id": [ + "a2c82fca-d8a4-4b6a-ac14-a163d989b0ab" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200739Z:a2c82fca-d8a4-4b6a-ac14-a163d989b0ab" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCreateUpdate/providers/Microsoft.Devices/provisioningServices/unitTestingDPSCreateUpdate/operationResults/b3NfaWRfNWVmMGRkMGEtYzRhZC00MjM3LTgwZWEtOWU3NGFiZGY4MDkw?api-version=2017-11-15&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQ3JlYXRlVXBkYXRlL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU0NyZWF0ZVVwZGF0ZS9vcGVyYXRpb25SZXN1bHRzL2IzTmZhV1JmTldWbU1HUmtNR0V0WXpSaFpDMDBNak0zTFRnd1pXRXRPV1UzTkdGaVpHWTRNRGt3P2FwaS12ZXJzaW9uPTIwMTctMTEtMTUmYXN5bmNpbmZv", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:07:54 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14992" + ], + "x-ms-request-id": [ + "9e58cd25-dfff-4f7d-a1b3-d546cbc09311" + ], + "x-ms-correlation-request-id": [ + "9e58cd25-dfff-4f7d-a1b3-d546cbc09311" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200754Z:9e58cd25-dfff-4f7d-a1b3-d546cbc09311" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b" + } +} \ No newline at end of file diff --git a/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientTest/CreateFailure.json b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientTest/CreateFailure.json new file mode 100644 index 000000000000..8ed6cd4e97a7 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientTest/CreateFailure.json @@ -0,0 +1,133 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourcegroups/unitTestingDPSCreateUpdateInvalidName?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlZ3JvdXBzL3VuaXRUZXN0aW5nRFBTQ3JlYXRlVXBkYXRlSW52YWxpZE5hbWU/YXBpLXZlcnNpb249MjAxNS0xMS0wMQ==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"eastus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ], + "x-ms-client-request-id": [ + "960f1675-f7f4-4805-944a-ff33e851cbb7" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCreateUpdateInvalidName\",\r\n \"name\": \"unitTestingDPSCreateUpdateInvalidName\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "227" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:08:48 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "f6b147d4-20c4-4c9a-a1f5-d3365ded86f0" + ], + "x-ms-correlation-request-id": [ + "f6b147d4-20c4-4c9a-a1f5-d3365ded86f0" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200848Z:f6b147d4-20c4-4c9a-a1f5-d3365ded86f0" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSCreateUpdateInvalidName/providers/Microsoft.Devices/provisioningServices/1%C3%B11unitTestingDPSCreateUpdateInvalidName!!!?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTQ3JlYXRlVXBkYXRlSW52YWxpZE5hbWUvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZpY2VzL3Byb3Zpc2lvbmluZ1NlcnZpY2VzLzElQzMlQjExdW5pdFRlc3RpbmdEUFNDcmVhdGVVcGRhdGVJbnZhbGlkTmFtZSEhIT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"capacity\": 1\r\n },\r\n \"location\": \"eastus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "105" + ], + "x-ms-client-request-id": [ + "ebdad7b3-bb3a-49bf-99db-62302a58d193" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"Code\": \"InvalidIotDpsName\",\r\n \"HttpStatusCode\": \"BadRequest\",\r\n \"Message\": \"Provisioning Service name can contain only alphanumeric and hyphen and must start/end with alphanumeric. Should be 3 to 50 chars long. Name 'global' not allowed. If you contact a support representative please include this correlation identifier: 421496a5-e9da-470c-9fce-a06149abf312, timestamp: 2018-01-10 20:09:02Z, errorcode: IH400305.\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "408" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:09:01 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "4999" + ], + "x-ms-request-id": [ + "50b60738-3a3c-413e-8d10-c5f049da6195" + ], + "x-ms-correlation-request-id": [ + "50b60738-3a3c-413e-8d10-c5f049da6195" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200902Z:50b60738-3a3c-413e-8d10-c5f049da6195" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 400 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b" + } +} \ No newline at end of file diff --git a/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientTest/UpdateSku.json b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientTest/UpdateSku.json new file mode 100644 index 000000000000..e1a8f5a06c63 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/DeviceProvisioningServices.Tests/SessionRecords/DeviceProvisioningServices.Tests.ScenarioTests.DeviceProvisioningClientTest/UpdateSku.json @@ -0,0 +1,490 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourcegroups/unitTestingDPSUpdateSku?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlZ3JvdXBzL3VuaXRUZXN0aW5nRFBTVXBkYXRlU2t1P2FwaS12ZXJzaW9uPTIwMTUtMTEtMDE=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"eastus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ], + "x-ms-client-request-id": [ + "8f763868-0467-4b81-ba03-c1167389b727" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSUpdateSku\",\r\n \"name\": \"unitTestingDPSUpdateSku\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "199" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:09:48 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "x-ms-request-id": [ + "9149e58d-6d17-45c8-a2bb-afdd470e19c8" + ], + "x-ms-correlation-request-id": [ + "9149e58d-6d17-45c8-a2bb-afdd470e19c8" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200949Z:9149e58d-6d17-45c8-a2bb-afdd470e19c8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9jaGVja1Byb3Zpc2lvbmluZ1NlcnZpY2VOYW1lQXZhaWxhYmlsaXR5P2FwaS12ZXJzaW9uPTIwMTctMTEtMTU=", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"name\": \"unitTestingDPSUpdateSku\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "41" + ], + "x-ms-client-request-id": [ + "ca868ad2-9846-4af0-a6a8-e8003b8a3ef8" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"nameAvailable\": true,\r\n \"reason\": \"Invalid\",\r\n \"message\": null\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:09:53 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "x-ms-request-id": [ + "99d46d37-a7ca-4a67-ac14-2dc9c33bb12e" + ], + "x-ms-correlation-request-id": [ + "99d46d37-a7ca-4a67-ac14-2dc9c33bb12e" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200953Z:99d46d37-a7ca-4a67-ac14-2dc9c33bb12e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSUpdateSku/providers/Microsoft.Devices/provisioningServices/unitTestingDPSUpdateSku?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTVXBkYXRlU2t1L3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1VwZGF0ZVNrdT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"capacity\": 1\r\n },\r\n \"location\": \"eastus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "105" + ], + "x-ms-client-request-id": [ + "de9e1e61-3685-425c-8580-f8628f18a70b" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"name\": \"unitTestingDPSUpdateSku\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Activating\",\r\n \"provisioningState\": \"Accepted\",\r\n \"allocationPolicy\": \"Hashed\",\r\n \"idScope\": null\r\n },\r\n \"resourcegroup\": \"unitTestingDPSUpdateSku\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSUpdateSku/providers/Microsoft.Devices/provisioningServices/unitTestingDPSUpdateSku\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "542" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:09:55 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSUpdateSku/providers/Microsoft.Devices/provisioningServices/unitTestingDPSUpdateSku/operationResults/b3NfaWRfZTMxMTk5ZmMtYTFlOS00ZDlkLTgzNTYtM2YxNWZhN2MyMzll?api-version=2017-11-15&asyncinfo" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "4999" + ], + "x-ms-request-id": [ + "2c84c64f-e79d-4ee2-9b10-b9c918d6694c" + ], + "x-ms-correlation-request-id": [ + "2c84c64f-e79d-4ee2-9b10-b9c918d6694c" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T200955Z:2c84c64f-e79d-4ee2-9b10-b9c918d6694c" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSUpdateSku/providers/Microsoft.Devices/provisioningServices/unitTestingDPSUpdateSku?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTVXBkYXRlU2t1L3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1VwZGF0ZVNrdT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"etag\": \"AAAAAAAKLt0=\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\"\r\n },\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"capacity\": 2\r\n },\r\n \"location\": \"eastus\",\r\n \"tags\": {}\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "229" + ], + "x-ms-client-request-id": [ + "79f38efb-dfa2-43b1-b08f-479eecf5c671" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKLt0=\",\r\n \"name\": \"unitTestingDPSUpdateSku\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Transitioning\",\r\n \"provisioningState\": \"Accepted\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"idScope\": null\r\n },\r\n \"resourcegroup\": \"unitTestingDPSUpdateSku\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSUpdateSku/providers/Microsoft.Devices/provisioningServices/unitTestingDPSUpdateSku\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 2\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "580" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:11:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSUpdateSku/providers/Microsoft.Devices/provisioningServices/unitTestingDPSUpdateSku/operationResults/b3NfaWRfNTgxOGI2Y2EtMWZhOC00NzRkLWEzMzQtMTRiM2VhMzE5ZTlj?api-version=2017-11-15&asyncinfo" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "4998" + ], + "x-ms-request-id": [ + "cae87099-614d-48b4-9875-12a0f7b074ff" + ], + "x-ms-correlation-request-id": [ + "cae87099-614d-48b4-9875-12a0f7b074ff" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T201101Z:cae87099-614d-48b4-9875-12a0f7b074ff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSUpdateSku/providers/Microsoft.Devices/provisioningServices/unitTestingDPSUpdateSku/operationResults/b3NfaWRfZTMxMTk5ZmMtYTFlOS00ZDlkLTgzNTYtM2YxNWZhN2MyMzll?api-version=2017-11-15&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTVXBkYXRlU2t1L3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1VwZGF0ZVNrdS9vcGVyYXRpb25SZXN1bHRzL2IzTmZhV1JmWlRNeE1UazVabU10WVRGbE9TMDBaRGxrTFRnek5UWXRNMll4TldaaE4yTXlNemxsP2FwaS12ZXJzaW9uPTIwMTctMTEtMTUmYXN5bmNpbmZv", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:10:25 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14996" + ], + "x-ms-request-id": [ + "dabafbf1-6125-4ea6-9ea2-a3c165e00814" + ], + "x-ms-correlation-request-id": [ + "dabafbf1-6125-4ea6-9ea2-a3c165e00814" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T201026Z:dabafbf1-6125-4ea6-9ea2-a3c165e00814" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSUpdateSku/providers/Microsoft.Devices/provisioningServices/unitTestingDPSUpdateSku?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTVXBkYXRlU2t1L3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1VwZGF0ZVNrdT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKLt0=\",\r\n \"name\": \"unitTestingDPSUpdateSku\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"serviceOperationsHostName\": \"unitTestingDPSUpdateSku.azure-devices-provisioning.net\",\r\n \"deviceProvisioningHostName\": \"global.azure-devices-provisioning.net\",\r\n \"idScope\": \"0ne00009290\"\r\n },\r\n \"resourcegroup\": \"unitTestingDPSUpdateSku\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSUpdateSku/providers/Microsoft.Devices/provisioningServices/unitTestingDPSUpdateSku\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 1\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:10:26 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14995" + ], + "x-ms-request-id": [ + "a7f85066-6ba5-4f97-8c1a-7eaa84c04a3c" + ], + "x-ms-correlation-request-id": [ + "a7f85066-6ba5-4f97-8c1a-7eaa84c04a3c" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T201026Z:a7f85066-6ba5-4f97-8c1a-7eaa84c04a3c" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSUpdateSku/providers/Microsoft.Devices/provisioningServices/unitTestingDPSUpdateSku?api-version=2017-11-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTVXBkYXRlU2t1L3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1VwZGF0ZVNrdT9hcGktdmVyc2lvbj0yMDE3LTExLTE1", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"etag\": \"AAAAAAAKLuc=\",\r\n \"name\": \"unitTestingDPSUpdateSku\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"state\": \"Active\",\r\n \"iotHubs\": [],\r\n \"allocationPolicy\": \"Hashed\",\r\n \"serviceOperationsHostName\": \"unitTestingDPSUpdateSku.azure-devices-provisioning.net\",\r\n \"deviceProvisioningHostName\": \"global.azure-devices-provisioning.net\",\r\n \"idScope\": \"0ne00009290\"\r\n },\r\n \"resourcegroup\": \"unitTestingDPSUpdateSku\",\r\n \"type\": \"Microsoft.Devices/provisioningServices\",\r\n \"id\": \"/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSUpdateSku/providers/Microsoft.Devices/provisioningServices/unitTestingDPSUpdateSku\",\r\n \"subscriptionid\": \"9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b\",\r\n \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"S1\",\r\n \"tier\": \"Standard\",\r\n \"capacity\": 2\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:11:32 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14993" + ], + "x-ms-request-id": [ + "7209aeaa-7ac2-4978-9dba-0a0acd551c03" + ], + "x-ms-correlation-request-id": [ + "7209aeaa-7ac2-4978-9dba-0a0acd551c03" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T201132Z:7209aeaa-7ac2-4978-9dba-0a0acd551c03" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b/resourceGroups/unitTestingDPSUpdateSku/providers/Microsoft.Devices/provisioningServices/unitTestingDPSUpdateSku/operationResults/b3NfaWRfNTgxOGI2Y2EtMWZhOC00NzRkLWEzMzQtMTRiM2VhMzE5ZTlj?api-version=2017-11-15&asyncinfo", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxMmZmMjUtZGZhMy00OGYzLThhNmEtNWEyYmMwMGZiMDhiL3Jlc291cmNlR3JvdXBzL3VuaXRUZXN0aW5nRFBTVXBkYXRlU2t1L3Byb3ZpZGVycy9NaWNyb3NvZnQuRGV2aWNlcy9wcm92aXNpb25pbmdTZXJ2aWNlcy91bml0VGVzdGluZ0RQU1VwZGF0ZVNrdS9vcGVyYXRpb25SZXN1bHRzL2IzTmZhV1JmTlRneE9HSTJZMkV0TVdaaE9DMDBOelJrTFdFek16UXRNVFJpTTJWaE16RTVaVGxqP2FwaS12ZXJzaW9uPTIwMTctMTEtMTUmYXN5bmNpbmZv", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ProvisioningServices.IotDpsClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 10 Jan 2018 20:11:31 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14994" + ], + "x-ms-request-id": [ + "bec5fa4f-d3a0-4811-a90c-3665933f57ea" + ], + "x-ms-correlation-request-id": [ + "bec5fa4f-d3a0-4811-a90c-3665933f57ea" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20180110T201131Z:bec5fa4f-d3a0-4811-a90c-3665933f57ea" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "9712ff25-dfa3-48f3-8a6a-5a2bc00fb08b" + } +} \ No newline at end of file diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices.sln b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices.sln new file mode 100644 index 000000000000..be39082f6eb1 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices.sln @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27004.2009 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Management.DeviceProvisioningServices", "Management.DeviceProvisioningServices\Microsoft.Azure.Management.DeviceProvisioningServices.csproj", "{8B1E153F-90A7-49C3-99EA-C502627380A9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DeviceProvisioningServices.Tests", "DeviceProvisioningServices.Tests\DeviceProvisioningServices.Tests.csproj", "{C716AD7C-9F09-4206-B0DA-C779CBB2F1CA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Management.IotHub", "..\IotHub\Management.IotHub\Microsoft.Azure.Management.IotHub.csproj", "{15FABBE1-F329-4F7A-AA06-9B755DDB72D8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8B1E153F-90A7-49C3-99EA-C502627380A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8B1E153F-90A7-49C3-99EA-C502627380A9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8B1E153F-90A7-49C3-99EA-C502627380A9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8B1E153F-90A7-49C3-99EA-C502627380A9}.Release|Any CPU.Build.0 = Release|Any CPU + {C716AD7C-9F09-4206-B0DA-C779CBB2F1CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C716AD7C-9F09-4206-B0DA-C779CBB2F1CA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C716AD7C-9F09-4206-B0DA-C779CBB2F1CA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C716AD7C-9F09-4206-B0DA-C779CBB2F1CA}.Release|Any CPU.Build.0 = Release|Any CPU + {15FABBE1-F329-4F7A-AA06-9B755DDB72D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {15FABBE1-F329-4F7A-AA06-9B755DDB72D8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {15FABBE1-F329-4F7A-AA06-9B755DDB72D8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {15FABBE1-F329-4F7A-AA06-9B755DDB72D8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F153AC1E-A864-4774-AAC2-96BFFC6944F4} + EndGlobalSection +EndGlobal diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/DpsCertificateOperations.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/DpsCertificateOperations.cs new file mode 100644 index 000000000000..350b8bee2a8b --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/DpsCertificateOperations.cs @@ -0,0 +1,1350 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices +{ + 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; + + /// + /// DpsCertificateOperations operations. + /// + internal partial class DpsCertificateOperations : IServiceOperations, IDpsCertificateOperations + { + /// + /// Initializes a new instance of the DpsCertificateOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DpsCertificateOperations(IotDpsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the IotDpsClient + /// + public IotDpsClient Client { get; private set; } + + /// + /// Get the certificate from the provisioning service. + /// + /// + /// Name of the certificate to retrieve. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of the provisioning service the certificate is associated with. + /// + /// + /// ETag of the certificate. + /// + /// + /// 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 certificateName, string resourceGroupName, string provisioningServiceName, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (certificateName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "certificateName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (provisioningServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("certificateName", certificateName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + tracingParameters.Add("ifMatch", ifMatch); + 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.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}").ToString(); + _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + 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 (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + 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; + } + + /// + /// Upload the certificate to the provisioning service. + /// + /// + /// Add new certificate or update an existing certificate. + /// + /// + /// Resource group identifier. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the certificate create or update. + /// + /// + /// The certificate body. + /// + /// + /// ETag of the certificate. This is required to update an existing + /// certificate, and ignored while creating a brand new certificate. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, string certificateName, CertificateBodyDescription certificateDescription, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (provisioningServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + } + if (certificateName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "certificateName"); + } + if (certificateName != null) + { + if (certificateName.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "certificateName", 256); + } + } + if (certificateDescription == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "certificateDescription"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + tracingParameters.Add("certificateName", certificateName); + tracingParameters.Add("certificateDescription", certificateDescription); + tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); + 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 (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + 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(certificateDescription != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(certificateDescription, 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 the Provisioning Service Certificate. + /// + /// + /// Deletes the specified certificate assosciated with the Provisioning Service + /// + /// + /// Resource group identifier. + /// + /// + /// ETag of the certificate + /// + /// + /// The name of the provisioning service. + /// + /// + /// This is a mandatory field, and is the logical name of the certificate that + /// the provisioning service will access by. + /// + /// + /// This is optional, and it is the Common Name of the certificate. + /// + /// + /// Raw data within the certificate. + /// + /// + /// Indicates if certificate has been verified by owner of the private key. + /// + /// + /// A description that mentions the purpose of the certificate. Possible values + /// include: 'clientAuthentication', 'serverAuthentication' + /// + /// + /// Time the certificate is created. + /// + /// + /// Time the certificate is last updated. + /// + /// + /// Indicates if the certificate contains a private key. + /// + /// + /// Random number generated to indicate Proof of Possession. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string ifMatch, string provisioningServiceName, string certificateName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string), 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 (ifMatch == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); + } + if (provisioningServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + } + if (certificateName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "certificateName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + tracingParameters.Add("certificateName", certificateName); + tracingParameters.Add("certificatename", certificatename); + tracingParameters.Add("certificaterawBytes", certificaterawBytes); + tracingParameters.Add("certificateisVerified", certificateisVerified); + tracingParameters.Add("certificatepurpose", certificatepurpose); + tracingParameters.Add("certificatecreated", certificatecreated); + tracingParameters.Add("certificatelastUpdated", certificatelastUpdated); + tracingParameters.Add("certificatehasPrivateKey", certificatehasPrivateKey); + tracingParameters.Add("certificatenonce", certificatenonce); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); + List _queryParameters = new List(); + if (certificatename != null) + { + _queryParameters.Add(string.Format("certificate.name={0}", System.Uri.EscapeDataString(certificatename))); + } + if (certificaterawBytes != null) + { + _queryParameters.Add(string.Format("certificate.rawBytes={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificaterawBytes, Client.SerializationSettings).Trim('"')))); + } + if (certificateisVerified != null) + { + _queryParameters.Add(string.Format("certificate.isVerified={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificateisVerified, Client.SerializationSettings).Trim('"')))); + } + if (certificatepurpose != null) + { + _queryParameters.Add(string.Format("certificate.purpose={0}", System.Uri.EscapeDataString(certificatepurpose))); + } + if (certificatecreated != null) + { + _queryParameters.Add(string.Format("certificate.created={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificatecreated, Client.SerializationSettings).Trim('"')))); + } + if (certificatelastUpdated != null) + { + _queryParameters.Add(string.Format("certificate.lastUpdated={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificatelastUpdated, Client.SerializationSettings).Trim('"')))); + } + if (certificatehasPrivateKey != null) + { + _queryParameters.Add(string.Format("certificate.hasPrivateKey={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificatehasPrivateKey, Client.SerializationSettings).Trim('"')))); + } + if (certificatenonce != null) + { + _queryParameters.Add(string.Format("certificate.nonce={0}", System.Uri.EscapeDataString(certificatenonce))); + } + 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 (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new 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; + } + + /// + /// Generate verification code for Proof of Possession. + /// + /// + /// The mandatory logical name of the certificate, that the provisioning + /// service uses to access. + /// + /// + /// ETag of the certificate. This is required to update an existing + /// certificate, and ignored while creating a brand new certificate. + /// + /// + /// name of resource group. + /// + /// + /// Name of provisioning service. + /// + /// + /// Common Name for the certificate. + /// + /// + /// Raw data of certificate. + /// + /// + /// Indicates if the certificate has been verified by owner of the private key. + /// + /// + /// Description mentioning the purpose of the certificate. Possible values + /// include: 'clientAuthentication', 'serverAuthentication' + /// + /// + /// Certificate creation time. + /// + /// + /// Certificate last updated time. + /// + /// + /// Indicates if the certificate contains private key. + /// + /// + /// Random number generated to indicate Proof of Possession. + /// + /// + /// 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> GenerateVerificationCodeWithHttpMessagesAsync(string certificateName, string ifMatch, string resourceGroupName, string provisioningServiceName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (certificateName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "certificateName"); + } + if (ifMatch == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (provisioningServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("certificateName", certificateName); + tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + tracingParameters.Add("certificatename", certificatename); + tracingParameters.Add("certificaterawBytes", certificaterawBytes); + tracingParameters.Add("certificateisVerified", certificateisVerified); + tracingParameters.Add("certificatepurpose", certificatepurpose); + tracingParameters.Add("certificatecreated", certificatecreated); + tracingParameters.Add("certificatelastUpdated", certificatelastUpdated); + tracingParameters.Add("certificatehasPrivateKey", certificatehasPrivateKey); + tracingParameters.Add("certificatenonce", certificatenonce); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GenerateVerificationCode", 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.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/generateVerificationCode").ToString(); + _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + List _queryParameters = new List(); + if (certificatename != null) + { + _queryParameters.Add(string.Format("certificate.name={0}", System.Uri.EscapeDataString(certificatename))); + } + if (certificaterawBytes != null) + { + _queryParameters.Add(string.Format("certificate.rawBytes={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificaterawBytes, Client.SerializationSettings).Trim('"')))); + } + if (certificateisVerified != null) + { + _queryParameters.Add(string.Format("certificate.isVerified={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificateisVerified, Client.SerializationSettings).Trim('"')))); + } + if (certificatepurpose != null) + { + _queryParameters.Add(string.Format("certificate.purpose={0}", System.Uri.EscapeDataString(certificatepurpose))); + } + if (certificatecreated != null) + { + _queryParameters.Add(string.Format("certificate.created={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificatecreated, Client.SerializationSettings).Trim('"')))); + } + if (certificatelastUpdated != null) + { + _queryParameters.Add(string.Format("certificate.lastUpdated={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificatelastUpdated, Client.SerializationSettings).Trim('"')))); + } + if (certificatehasPrivateKey != null) + { + _queryParameters.Add(string.Format("certificate.hasPrivateKey={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificatehasPrivateKey, Client.SerializationSettings).Trim('"')))); + } + if (certificatenonce != null) + { + _queryParameters.Add(string.Format("certificate.nonce={0}", System.Uri.EscapeDataString(certificatenonce))); + } + 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 (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + 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; + } + + /// + /// Verify certificate's private key possession. + /// + /// + /// Verifies the certificate's private key possession by providing the leaf + /// cert issued by the verifying pre uploaded certificate. + /// + /// + /// The mandatory logical name of the certificate, that the provisioning + /// service uses to access. + /// + /// + /// ETag of the certificate. + /// + /// + /// The name of the certificate + /// + /// + /// Resource group name. + /// + /// + /// Provisioning service name. + /// + /// + /// Common Name for the certificate. + /// + /// + /// Raw data of certificate. + /// + /// + /// Indicates if the certificate has been verified by owner of the private key. + /// + /// + /// Describe the purpose of the certificate. Possible values include: + /// 'clientAuthentication', 'serverAuthentication' + /// + /// + /// Certificate creation time. + /// + /// + /// Certificate last updated time. + /// + /// + /// Indicates if the certificate contains private key. + /// + /// + /// Random number generated to indicate Proof of Possession. + /// + /// + /// 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> VerifyCertificateWithHttpMessagesAsync(string certificateName, string ifMatch, VerificationCodeRequest request, string resourceGroupName, string provisioningServiceName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (certificateName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "certificateName"); + } + if (ifMatch == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); + } + if (request == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "request"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (provisioningServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("certificateName", certificateName); + tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("request", request); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + tracingParameters.Add("certificatename", certificatename); + tracingParameters.Add("certificaterawBytes", certificaterawBytes); + tracingParameters.Add("certificateisVerified", certificateisVerified); + tracingParameters.Add("certificatepurpose", certificatepurpose); + tracingParameters.Add("certificatecreated", certificatecreated); + tracingParameters.Add("certificatelastUpdated", certificatelastUpdated); + tracingParameters.Add("certificatehasPrivateKey", certificatehasPrivateKey); + tracingParameters.Add("certificatenonce", certificatenonce); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "VerifyCertificate", 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.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/verify").ToString(); + _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + List _queryParameters = new List(); + if (certificatename != null) + { + _queryParameters.Add(string.Format("certificate.name={0}", System.Uri.EscapeDataString(certificatename))); + } + if (certificaterawBytes != null) + { + _queryParameters.Add(string.Format("certificate.rawBytes={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificaterawBytes, Client.SerializationSettings).Trim('"')))); + } + if (certificateisVerified != null) + { + _queryParameters.Add(string.Format("certificate.isVerified={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificateisVerified, Client.SerializationSettings).Trim('"')))); + } + if (certificatepurpose != null) + { + _queryParameters.Add(string.Format("certificate.purpose={0}", System.Uri.EscapeDataString(certificatepurpose))); + } + if (certificatecreated != null) + { + _queryParameters.Add(string.Format("certificate.created={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificatecreated, Client.SerializationSettings).Trim('"')))); + } + if (certificatelastUpdated != null) + { + _queryParameters.Add(string.Format("certificate.lastUpdated={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificatelastUpdated, Client.SerializationSettings).Trim('"')))); + } + if (certificatehasPrivateKey != null) + { + _queryParameters.Add(string.Format("certificate.hasPrivateKey={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificatehasPrivateKey, Client.SerializationSettings).Trim('"')))); + } + if (certificatenonce != null) + { + _queryParameters.Add(string.Format("certificate.nonce={0}", System.Uri.EscapeDataString(certificatenonce))); + } + 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 (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + 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(request != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(request, 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; + } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/DpsCertificateOperationsExtensions.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/DpsCertificateOperationsExtensions.cs new file mode 100644 index 000000000000..9f2d1cfa4b8b --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/DpsCertificateOperationsExtensions.cs @@ -0,0 +1,474 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DpsCertificateOperations. + /// + public static partial class DpsCertificateOperationsExtensions + { + /// + /// Get the certificate from the provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the certificate to retrieve. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of the provisioning service the certificate is associated with. + /// + /// + /// ETag of the certificate. + /// + public static CertificateResponse Get(this IDpsCertificateOperations operations, string certificateName, string resourceGroupName, string provisioningServiceName, string ifMatch = default(string)) + { + return operations.GetAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Get the certificate from the provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the certificate to retrieve. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of the provisioning service the certificate is associated with. + /// + /// + /// ETag of the certificate. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDpsCertificateOperations operations, string certificateName, string resourceGroupName, string provisioningServiceName, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Upload the certificate to the provisioning service. + /// + /// + /// Add new certificate or update an existing certificate. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the certificate create or update. + /// + /// + /// The certificate body. + /// + /// + /// ETag of the certificate. This is required to update an existing + /// certificate, and ignored while creating a brand new certificate. + /// + public static CertificateResponse CreateOrUpdate(this IDpsCertificateOperations operations, string resourceGroupName, string provisioningServiceName, string certificateName, CertificateBodyDescription certificateDescription, string ifMatch = default(string)) + { + return operations.CreateOrUpdateAsync(resourceGroupName, provisioningServiceName, certificateName, certificateDescription, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Upload the certificate to the provisioning service. + /// + /// + /// Add new certificate or update an existing certificate. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the certificate create or update. + /// + /// + /// The certificate body. + /// + /// + /// ETag of the certificate. This is required to update an existing + /// certificate, and ignored while creating a brand new certificate. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDpsCertificateOperations operations, string resourceGroupName, string provisioningServiceName, string certificateName, CertificateBodyDescription certificateDescription, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, certificateName, certificateDescription, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the Provisioning Service Certificate. + /// + /// + /// Deletes the specified certificate assosciated with the Provisioning Service + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// ETag of the certificate + /// + /// + /// The name of the provisioning service. + /// + /// + /// This is a mandatory field, and is the logical name of the certificate that + /// the provisioning service will access by. + /// + /// + /// This is optional, and it is the Common Name of the certificate. + /// + /// + /// Raw data within the certificate. + /// + /// + /// Indicates if certificate has been verified by owner of the private key. + /// + /// + /// A description that mentions the purpose of the certificate. Possible values + /// include: 'clientAuthentication', 'serverAuthentication' + /// + /// + /// Time the certificate is created. + /// + /// + /// Time the certificate is last updated. + /// + /// + /// Indicates if the certificate contains a private key. + /// + /// + /// Random number generated to indicate Proof of Possession. + /// + public static void Delete(this IDpsCertificateOperations operations, string resourceGroupName, string ifMatch, string provisioningServiceName, string certificateName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string)) + { + operations.DeleteAsync(resourceGroupName, ifMatch, provisioningServiceName, certificateName, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce).GetAwaiter().GetResult(); + } + + /// + /// Delete the Provisioning Service Certificate. + /// + /// + /// Deletes the specified certificate assosciated with the Provisioning Service + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// ETag of the certificate + /// + /// + /// The name of the provisioning service. + /// + /// + /// This is a mandatory field, and is the logical name of the certificate that + /// the provisioning service will access by. + /// + /// + /// This is optional, and it is the Common Name of the certificate. + /// + /// + /// Raw data within the certificate. + /// + /// + /// Indicates if certificate has been verified by owner of the private key. + /// + /// + /// A description that mentions the purpose of the certificate. Possible values + /// include: 'clientAuthentication', 'serverAuthentication' + /// + /// + /// Time the certificate is created. + /// + /// + /// Time the certificate is last updated. + /// + /// + /// Indicates if the certificate contains a private key. + /// + /// + /// Random number generated to indicate Proof of Possession. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDpsCertificateOperations operations, string resourceGroupName, string ifMatch, string provisioningServiceName, string certificateName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, ifMatch, provisioningServiceName, certificateName, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Generate verification code for Proof of Possession. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The mandatory logical name of the certificate, that the provisioning + /// service uses to access. + /// + /// + /// ETag of the certificate. This is required to update an existing + /// certificate, and ignored while creating a brand new certificate. + /// + /// + /// name of resource group. + /// + /// + /// Name of provisioning service. + /// + /// + /// Common Name for the certificate. + /// + /// + /// Raw data of certificate. + /// + /// + /// Indicates if the certificate has been verified by owner of the private key. + /// + /// + /// Description mentioning the purpose of the certificate. Possible values + /// include: 'clientAuthentication', 'serverAuthentication' + /// + /// + /// Certificate creation time. + /// + /// + /// Certificate last updated time. + /// + /// + /// Indicates if the certificate contains private key. + /// + /// + /// Random number generated to indicate Proof of Possession. + /// + public static VerificationCodeResponse GenerateVerificationCode(this IDpsCertificateOperations operations, string certificateName, string ifMatch, string resourceGroupName, string provisioningServiceName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string)) + { + return operations.GenerateVerificationCodeAsync(certificateName, ifMatch, resourceGroupName, provisioningServiceName, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce).GetAwaiter().GetResult(); + } + + /// + /// Generate verification code for Proof of Possession. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The mandatory logical name of the certificate, that the provisioning + /// service uses to access. + /// + /// + /// ETag of the certificate. This is required to update an existing + /// certificate, and ignored while creating a brand new certificate. + /// + /// + /// name of resource group. + /// + /// + /// Name of provisioning service. + /// + /// + /// Common Name for the certificate. + /// + /// + /// Raw data of certificate. + /// + /// + /// Indicates if the certificate has been verified by owner of the private key. + /// + /// + /// Description mentioning the purpose of the certificate. Possible values + /// include: 'clientAuthentication', 'serverAuthentication' + /// + /// + /// Certificate creation time. + /// + /// + /// Certificate last updated time. + /// + /// + /// Indicates if the certificate contains private key. + /// + /// + /// Random number generated to indicate Proof of Possession. + /// + /// + /// The cancellation token. + /// + public static async Task GenerateVerificationCodeAsync(this IDpsCertificateOperations operations, string certificateName, string ifMatch, string resourceGroupName, string provisioningServiceName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GenerateVerificationCodeWithHttpMessagesAsync(certificateName, ifMatch, resourceGroupName, provisioningServiceName, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Verify certificate's private key possession. + /// + /// + /// Verifies the certificate's private key possession by providing the leaf + /// cert issued by the verifying pre uploaded certificate. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The mandatory logical name of the certificate, that the provisioning + /// service uses to access. + /// + /// + /// ETag of the certificate. + /// + /// + /// The name of the certificate + /// + /// + /// Resource group name. + /// + /// + /// Provisioning service name. + /// + /// + /// Common Name for the certificate. + /// + /// + /// Raw data of certificate. + /// + /// + /// Indicates if the certificate has been verified by owner of the private key. + /// + /// + /// Describe the purpose of the certificate. Possible values include: + /// 'clientAuthentication', 'serverAuthentication' + /// + /// + /// Certificate creation time. + /// + /// + /// Certificate last updated time. + /// + /// + /// Indicates if the certificate contains private key. + /// + /// + /// Random number generated to indicate Proof of Possession. + /// + public static CertificateResponse VerifyCertificate(this IDpsCertificateOperations operations, string certificateName, string ifMatch, VerificationCodeRequest request, string resourceGroupName, string provisioningServiceName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string)) + { + return operations.VerifyCertificateAsync(certificateName, ifMatch, request, resourceGroupName, provisioningServiceName, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce).GetAwaiter().GetResult(); + } + + /// + /// Verify certificate's private key possession. + /// + /// + /// Verifies the certificate's private key possession by providing the leaf + /// cert issued by the verifying pre uploaded certificate. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The mandatory logical name of the certificate, that the provisioning + /// service uses to access. + /// + /// + /// ETag of the certificate. + /// + /// + /// The name of the certificate + /// + /// + /// Resource group name. + /// + /// + /// Provisioning service name. + /// + /// + /// Common Name for the certificate. + /// + /// + /// Raw data of certificate. + /// + /// + /// Indicates if the certificate has been verified by owner of the private key. + /// + /// + /// Describe the purpose of the certificate. Possible values include: + /// 'clientAuthentication', 'serverAuthentication' + /// + /// + /// Certificate creation time. + /// + /// + /// Certificate last updated time. + /// + /// + /// Indicates if the certificate contains private key. + /// + /// + /// Random number generated to indicate Proof of Possession. + /// + /// + /// The cancellation token. + /// + public static async Task VerifyCertificateAsync(this IDpsCertificateOperations operations, string certificateName, string ifMatch, VerificationCodeRequest request, string resourceGroupName, string provisioningServiceName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.VerifyCertificateWithHttpMessagesAsync(certificateName, ifMatch, request, resourceGroupName, provisioningServiceName, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/DpsCertificatesOperations.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/DpsCertificatesOperations.cs new file mode 100644 index 000000000000..f7c906bfd248 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/DpsCertificatesOperations.cs @@ -0,0 +1,245 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices +{ + 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; + + /// + /// DpsCertificatesOperations operations. + /// + internal partial class DpsCertificatesOperations : IServiceOperations, IDpsCertificatesOperations + { + /// + /// Initializes a new instance of the DpsCertificatesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DpsCertificatesOperations(IotDpsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the IotDpsClient + /// + public IotDpsClient Client { get; private set; } + + /// + /// Get all the certificates tied to the provisioning service. + /// + /// + /// Name of resource group. + /// + /// + /// Name of provisioning service to retrieve certificates for. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, 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 (provisioningServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/DpsCertificatesOperationsExtensions.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/DpsCertificatesOperationsExtensions.cs new file mode 100644 index 000000000000..60f5aaa3abeb --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/DpsCertificatesOperationsExtensions.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DpsCertificatesOperations. + /// + public static partial class DpsCertificatesOperationsExtensions + { + /// + /// Get all the certificates tied to the provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of resource group. + /// + /// + /// Name of provisioning service to retrieve certificates for. + /// + public static CertificateListDescription List(this IDpsCertificatesOperations operations, string resourceGroupName, string provisioningServiceName) + { + return operations.ListAsync(resourceGroupName, provisioningServiceName).GetAwaiter().GetResult(); + } + + /// + /// Get all the certificates tied to the provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of resource group. + /// + /// + /// Name of provisioning service to retrieve certificates for. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IDpsCertificatesOperations operations, string resourceGroupName, string provisioningServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IDpsCertificateOperations.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IDpsCertificateOperations.cs new file mode 100644 index 000000000000..1fa168aa1853 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IDpsCertificateOperations.cs @@ -0,0 +1,281 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DpsCertificateOperations operations. + /// + public partial interface IDpsCertificateOperations + { + /// + /// Get the certificate from the provisioning service. + /// + /// + /// Name of the certificate to retrieve. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of the provisioning service the certificate is associated + /// with. + /// + /// + /// ETag of the certificate. + /// + /// + /// 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 certificateName, string resourceGroupName, string provisioningServiceName, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Upload the certificate to the provisioning service. + /// + /// + /// Add new certificate or update an existing certificate. + /// + /// + /// Resource group identifier. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the certificate create or update. + /// + /// + /// The certificate body. + /// + /// + /// ETag of the certificate. This is required to update an existing + /// certificate, and ignored while creating a brand new certificate. + /// + /// + /// 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 provisioningServiceName, string certificateName, CertificateBodyDescription certificateDescription, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the Provisioning Service Certificate. + /// + /// + /// Deletes the specified certificate assosciated with the Provisioning + /// Service + /// + /// + /// Resource group identifier. + /// + /// + /// ETag of the certificate + /// + /// + /// The name of the provisioning service. + /// + /// + /// This is a mandatory field, and is the logical name of the + /// certificate that the provisioning service will access by. + /// + /// + /// This is optional, and it is the Common Name of the certificate. + /// + /// + /// Raw data within the certificate. + /// + /// + /// Indicates if certificate has been verified by owner of the private + /// key. + /// + /// + /// A description that mentions the purpose of the certificate. + /// Possible values include: 'clientAuthentication', + /// 'serverAuthentication' + /// + /// + /// Time the certificate is created. + /// + /// + /// Time the certificate is last updated. + /// + /// + /// Indicates if the certificate contains a private key. + /// + /// + /// Random number generated to indicate Proof of Possession. + /// + /// + /// 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 ifMatch, string provisioningServiceName, string certificateName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Generate verification code for Proof of Possession. + /// + /// + /// The mandatory logical name of the certificate, that the + /// provisioning service uses to access. + /// + /// + /// ETag of the certificate. This is required to update an existing + /// certificate, and ignored while creating a brand new certificate. + /// + /// + /// name of resource group. + /// + /// + /// Name of provisioning service. + /// + /// + /// Common Name for the certificate. + /// + /// + /// Raw data of certificate. + /// + /// + /// Indicates if the certificate has been verified by owner of the + /// private key. + /// + /// + /// Description mentioning the purpose of the certificate. Possible + /// values include: 'clientAuthentication', 'serverAuthentication' + /// + /// + /// Certificate creation time. + /// + /// + /// Certificate last updated time. + /// + /// + /// Indicates if the certificate contains private key. + /// + /// + /// Random number generated to indicate Proof of Possession. + /// + /// + /// 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> GenerateVerificationCodeWithHttpMessagesAsync(string certificateName, string ifMatch, string resourceGroupName, string provisioningServiceName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Verify certificate's private key possession. + /// + /// + /// Verifies the certificate's private key possession by providing the + /// leaf cert issued by the verifying pre uploaded certificate. + /// + /// + /// The mandatory logical name of the certificate, that the + /// provisioning service uses to access. + /// + /// + /// ETag of the certificate. + /// + /// + /// The name of the certificate + /// + /// + /// Resource group name. + /// + /// + /// Provisioning service name. + /// + /// + /// Common Name for the certificate. + /// + /// + /// Raw data of certificate. + /// + /// + /// Indicates if the certificate has been verified by owner of the + /// private key. + /// + /// + /// Describe the purpose of the certificate. Possible values include: + /// 'clientAuthentication', 'serverAuthentication' + /// + /// + /// Certificate creation time. + /// + /// + /// Certificate last updated time. + /// + /// + /// Indicates if the certificate contains private key. + /// + /// + /// Random number generated to indicate Proof of Possession. + /// + /// + /// 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> VerifyCertificateWithHttpMessagesAsync(string certificateName, string ifMatch, VerificationCodeRequest request, string resourceGroupName, string provisioningServiceName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IDpsCertificatesOperations.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IDpsCertificatesOperations.cs new file mode 100644 index 000000000000..4a08b9116496 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IDpsCertificatesOperations.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DpsCertificatesOperations operations. + /// + public partial interface IDpsCertificatesOperations + { + /// + /// Get all the certificates tied to the provisioning service. + /// + /// + /// Name of resource group. + /// + /// + /// Name of provisioning service to retrieve certificates for. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IIotDpsClient.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IIotDpsClient.cs new file mode 100644 index 000000000000..90bb04df9dd4 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IIotDpsClient.cs @@ -0,0 +1,92 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// API for using the Azure IoT Hub Device Provisioning Service features. + /// + public partial interface IIotDpsClient : 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; } + + /// + /// Gets or sets the preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// Gets or sets the retry timeout in seconds for Long Running + /// Operations. Default value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// When set to true a unique x-ms-client-request-id value is generated + /// and included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the IDpsCertificateOperations. + /// + IDpsCertificateOperations DpsCertificate { get; } + + /// + /// Gets the IIotDpsResourceOperations. + /// + IIotDpsResourceOperations IotDpsResource { get; } + + /// + /// Gets the IDpsCertificatesOperations. + /// + IDpsCertificatesOperations DpsCertificates { get; } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IIotDpsResourceOperations.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IIotDpsResourceOperations.cs new file mode 100644 index 000000000000..38dd659835f4 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IIotDpsResourceOperations.cs @@ -0,0 +1,534 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// IotDpsResourceOperations operations. + /// + public partial interface IIotDpsResourceOperations + { + /// + /// Get the non-security related metadata of the provisioning service. + /// + /// + /// Get the metadata of the provisioning service without SAS keys. + /// + /// + /// Name of the provisioning service to retrieve. + /// + /// + /// Resource group name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update the metadata of the provisioning service. + /// + /// + /// Create or update the metadata of the provisioning service. The + /// usual pattern to modify a property is to retrieve the provisioning + /// service metadata and security metadata, and then combine them with + /// the modified values in a new body to update the provisioning + /// service. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// Description of the provisioning service to create or update. + /// + /// + /// 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 provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an existing provisioning service's tags. + /// + /// + /// Update an existing provisioning service's tags. to update other + /// fields use the CreateOrUpdate method + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// Updated tag information to set into the provisioning 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the Provisioning Service + /// + /// + /// Deletes the Provisioning Service. + /// + /// + /// Name of provisioning service to delete. + /// + /// + /// Resource group identifier. + /// + /// + /// 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 provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all the provisioning services in a subscription. + /// + /// + /// List all the provisioning services for a given subscription id. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a list of all provisioning services in the given resource + /// group. + /// + /// + /// Resource group identifier. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the status of a long running operation, such as create, update + /// or delete a provisioning service. + /// + /// + /// Operation id corresponding to long running operation. Use this to + /// poll for the status. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service that the operation is running on. + /// + /// + /// Async header used to poll on the status of the operation, obtained + /// while creating the long running 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> GetOperationResultWithHttpMessagesAsync(string operationId, string resourceGroupName, string provisioningServiceName, string asyncinfo, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the list of valid SKUs for a provisioning service. + /// + /// + /// Gets the list of valid SKUs and tiers for a provisioning service. + /// + /// + /// Name of provisioning service. + /// + /// + /// Name of resource group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListValidSkusWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Check if a provisioning service name is available. + /// + /// + /// Check if a provisioning service name is available. This will + /// validate if the name is syntactically valid and if the name is + /// usable + /// + /// + /// Set the name parameter in the OperationInputs structure to the name + /// of the provisioning service 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> CheckProvisioningServiceNameAvailabilityWithHttpMessagesAsync(OperationInputs arguments, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the security metadata for a provisioning service. + /// + /// + /// List the primary and secondary keys for a provisioning service. + /// + /// + /// The provisioning service name to get the shared access keys for. + /// + /// + /// resource group name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListKeysWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a shared access policy by name from a provisioning service. + /// + /// + /// List primary and secondary keys for a specific key name + /// + /// + /// Name of the provisioning service. + /// + /// + /// Logical key name to get key-values for. + /// + /// + /// The name of the resource group that contains the provisioning + /// service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListKeysForKeyNameWithHttpMessagesAsync(string provisioningServiceName, string keyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update the metadata of the provisioning service. + /// + /// + /// Create or update the metadata of the provisioning service. The + /// usual pattern to modify a property is to retrieve the provisioning + /// service metadata and security metadata, and then combine them with + /// the modified values in a new body to update the provisioning + /// service. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// Description of the provisioning service to create or update. + /// + /// + /// 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 provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an existing provisioning service's tags. + /// + /// + /// Update an existing provisioning service's tags. to update other + /// fields use the CreateOrUpdate method + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// Updated tag information to set into the provisioning 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the Provisioning Service + /// + /// + /// Deletes the Provisioning Service. + /// + /// + /// Name of provisioning service to delete. + /// + /// + /// Resource group identifier. + /// + /// + /// 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 provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all the provisioning services in a subscription. + /// + /// + /// List all the provisioning services for a given subscription id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a list of all provisioning services in the given resource + /// group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the list of valid SKUs for a provisioning service. + /// + /// + /// Gets the list of valid SKUs and tiers for a provisioning service. + /// + /// + /// 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>> ListValidSkusNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the security metadata for a provisioning service. + /// + /// + /// List the primary and secondary keys for a provisioning service. + /// + /// + /// 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>> ListKeysNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IOperations.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IOperations.cs new file mode 100644 index 000000000000..4ffca0bd4ec3 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IOperations.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices +{ + 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 Microsoft.Devices 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 Microsoft.Devices 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/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IotDpsClient.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IotDpsClient.cs new file mode 100644 index 000000000000..1077c59836fa --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IotDpsClient.cs @@ -0,0 +1,335 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices +{ + 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; + + /// + /// API for using the Azure IoT Hub Device Provisioning Service features. + /// + public partial class IotDpsClient : ServiceClient, IIotDpsClient, 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; } + + /// + /// Gets or sets the preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// Gets or sets the retry timeout in seconds for Long Running Operations. + /// Default value is 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// When set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the IDpsCertificateOperations. + /// + public virtual IDpsCertificateOperations DpsCertificate { get; private set; } + + /// + /// Gets the IIotDpsResourceOperations. + /// + public virtual IIotDpsResourceOperations IotDpsResource { get; private set; } + + /// + /// Gets the IDpsCertificatesOperations. + /// + public virtual IDpsCertificatesOperations DpsCertificates { get; private set; } + + /// + /// Initializes a new instance of the IotDpsClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected IotDpsClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the IotDpsClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected IotDpsClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the IotDpsClient 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 IotDpsClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the IotDpsClient 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 IotDpsClient(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 IotDpsClient 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 IotDpsClient(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 IotDpsClient 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 IotDpsClient(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 IotDpsClient 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 IotDpsClient(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 IotDpsClient 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 IotDpsClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + Operations = new Operations(this); + DpsCertificate = new DpsCertificateOperations(this); + IotDpsResource = new IotDpsResourceOperations(this); + DpsCertificates = new DpsCertificatesOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2017-11-15"; + 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/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IotDpsResourceOperations.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IotDpsResourceOperations.cs new file mode 100644 index 000000000000..48a881ae3c80 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IotDpsResourceOperations.cs @@ -0,0 +1,2994 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices +{ + 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; + + /// + /// IotDpsResourceOperations operations. + /// + internal partial class IotDpsResourceOperations : IServiceOperations, IIotDpsResourceOperations + { + /// + /// Initializes a new instance of the IotDpsResourceOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal IotDpsResourceOperations(IotDpsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the IotDpsClient + /// + public IotDpsClient Client { get; private set; } + + /// + /// Get the non-security related metadata of the provisioning service. + /// + /// + /// Get the metadata of the provisioning service without SAS keys. + /// + /// + /// Name of the provisioning service to retrieve. + /// + /// + /// Resource group name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (provisioningServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + 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.Devices/provisioningServices/{provisioningServiceName}").ToString(); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + _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; + } + + /// + /// Create or update the metadata of the provisioning service. + /// + /// + /// Create or update the metadata of the provisioning service. The usual + /// pattern to modify a property is to retrieve the provisioning service + /// metadata and security metadata, and then combine them with the modified + /// values in a new body to update the provisioning service. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// Description of the provisioning service to create or update. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update an existing provisioning service's tags. + /// + /// + /// Update an existing provisioning service's tags. to update other fields use + /// the CreateOrUpdate method + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// Updated tag information to set into the provisioning service instance. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete the Provisioning Service + /// + /// + /// Deletes the Provisioning Service. + /// + /// + /// Name of provisioning service to delete. + /// + /// + /// Resource group identifier. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get all the provisioning services in a subscription. + /// + /// + /// List all the provisioning services for a given subscription id. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices").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 a list of all provisioning services in the given resource group. + /// + /// + /// Resource group identifier. + /// + /// + /// 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 (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("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.Devices/provisioningServices").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the status of a long running operation, such as create, update or + /// delete a provisioning service. + /// + /// + /// Operation id corresponding to long running operation. Use this to poll for + /// the status. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service that the operation is running on. + /// + /// + /// Async header used to poll on the status of the operation, obtained while + /// creating the long running 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> GetOperationResultWithHttpMessagesAsync(string operationId, string resourceGroupName, string provisioningServiceName, string asyncinfo, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (operationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (provisioningServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + } + if (asyncinfo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "asyncinfo"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("operationId", operationId); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + tracingParameters.Add("asyncinfo", asyncinfo); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetOperationResult", 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.Devices/provisioningServices/{provisioningServiceName}/operationresults/{operationId}").ToString(); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + List _queryParameters = new List(); + if (asyncinfo != null) + { + _queryParameters.Add(string.Format("asyncinfo={0}", System.Uri.EscapeDataString(asyncinfo))); + } + 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 the list of valid SKUs for a provisioning service. + /// + /// + /// Gets the list of valid SKUs and tiers for a provisioning service. + /// + /// + /// Name of provisioning service. + /// + /// + /// Name of resource group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListValidSkusWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (provisioningServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListValidSkus", 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.Devices/provisioningServices/{provisioningServiceName}/skus").ToString(); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + _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 provisioning service name is available. + /// + /// + /// Check if a provisioning service name is available. This will validate if + /// the name is syntactically valid and if the name is usable + /// + /// + /// Set the name parameter in the OperationInputs structure to the name of the + /// provisioning service 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> CheckProvisioningServiceNameAvailabilityWithHttpMessagesAsync(OperationInputs arguments, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (arguments == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "arguments"); + } + if (arguments != null) + { + arguments.Validate(); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("arguments", arguments); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CheckProvisioningServiceNameAvailability", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability").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(arguments != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(arguments, 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; + } + + /// + /// Get the security metadata for a provisioning service. + /// + /// + /// List the primary and secondary keys for a provisioning service. + /// + /// + /// The provisioning service name to get the shared access keys for. + /// + /// + /// resource group name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListKeysWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (provisioningServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListKeys", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/listkeys").ToString(); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + _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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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 a shared access policy by name from a provisioning service. + /// + /// + /// List primary and secondary keys for a specific key name + /// + /// + /// Name of the provisioning service. + /// + /// + /// Logical key name to get key-values for. + /// + /// + /// The name of the resource group that contains the provisioning service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListKeysForKeyNameWithHttpMessagesAsync(string provisioningServiceName, string keyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (provisioningServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + } + if (keyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "keyName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + tracingParameters.Add("keyName", keyName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListKeysForKeyName", 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.Devices/provisioningServices/{provisioningServiceName}/keys/{keyName}/listkeys").ToString(); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + _url = _url.Replace("{keyName}", System.Uri.EscapeDataString(keyName)); + _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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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 the provisioning service. + /// + /// + /// Create or update the metadata of the provisioning service. The usual + /// pattern to modify a property is to retrieve the provisioning service + /// metadata and security metadata, and then combine them with the modified + /// values in a new body to update the provisioning service. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// Description of the provisioning service to create or update. + /// + /// + /// 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 provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, 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 (provisioningServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + } + if (iotDpsDescription == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iotDpsDescription"); + } + if (iotDpsDescription != null) + { + iotDpsDescription.Validate(); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + tracingParameters.Add("iotDpsDescription", iotDpsDescription); + 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.Devices/provisioningServices/{provisioningServiceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + 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(iotDpsDescription != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(iotDpsDescription, 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 an existing provisioning service's tags. + /// + /// + /// Update an existing provisioning service's tags. to update other fields use + /// the CreateOrUpdate method + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// Updated tag information to set into the provisioning 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags, 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 (provisioningServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + } + if (provisioningServiceTags == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceTags"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + tracingParameters.Add("provisioningServiceTags", provisioningServiceTags); + 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.Devices/provisioningServices/{provisioningServiceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + 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(provisioningServiceTags != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(provisioningServiceTags, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + 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 the Provisioning Service + /// + /// + /// Deletes the Provisioning Service. + /// + /// + /// Name of provisioning service to delete. + /// + /// + /// Resource group identifier. + /// + /// + /// 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 provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (provisioningServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + 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.Devices/provisioningServices/{provisioningServiceName}").ToString(); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + _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("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204 && (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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get all the provisioning services in a subscription. + /// + /// + /// List all the provisioning services for a given subscription id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get a list of all provisioning services in the given 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; + } + + /// + /// Get the list of valid SKUs for a provisioning service. + /// + /// + /// Gets the list of valid SKUs and tiers for a provisioning service. + /// + /// + /// 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>> ListValidSkusNextWithHttpMessagesAsync(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, "ListValidSkusNext", 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 the security metadata for a provisioning service. + /// + /// + /// List the primary and secondary keys for a provisioning service. + /// + /// + /// 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>> ListKeysNextWithHttpMessagesAsync(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, "ListKeysNext", 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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IotDpsResourceOperationsExtensions.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IotDpsResourceOperationsExtensions.cs new file mode 100644 index 000000000000..76ff87ac2416 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/IotDpsResourceOperationsExtensions.cs @@ -0,0 +1,849 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for IotDpsResourceOperations. + /// + public static partial class IotDpsResourceOperationsExtensions + { + /// + /// Get the non-security related metadata of the provisioning service. + /// + /// + /// Get the metadata of the provisioning service without SAS keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the provisioning service to retrieve. + /// + /// + /// Resource group name. + /// + public static ProvisioningServiceDescription Get(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName) + { + return operations.GetAsync(provisioningServiceName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Get the non-security related metadata of the provisioning service. + /// + /// + /// Get the metadata of the provisioning service without SAS keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the provisioning service to retrieve. + /// + /// + /// Resource group name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update the metadata of the provisioning service. + /// + /// + /// Create or update the metadata of the provisioning service. The usual + /// pattern to modify a property is to retrieve the provisioning service + /// metadata and security metadata, and then combine them with the modified + /// values in a new body to update the provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// Description of the provisioning service to create or update. + /// + public static ProvisioningServiceDescription CreateOrUpdate(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription) + { + return operations.CreateOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription).GetAwaiter().GetResult(); + } + + /// + /// Create or update the metadata of the provisioning service. + /// + /// + /// Create or update the metadata of the provisioning service. The usual + /// pattern to modify a property is to retrieve the provisioning service + /// metadata and security metadata, and then combine them with the modified + /// values in a new body to update the provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// Description of the provisioning service to create or update. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an existing provisioning service's tags. + /// + /// + /// Update an existing provisioning service's tags. to update other fields use + /// the CreateOrUpdate method + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// Updated tag information to set into the provisioning service instance. + /// + public static ProvisioningServiceDescription Update(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags) + { + return operations.UpdateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags).GetAwaiter().GetResult(); + } + + /// + /// Update an existing provisioning service's tags. + /// + /// + /// Update an existing provisioning service's tags. to update other fields use + /// the CreateOrUpdate method + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// Updated tag information to set into the provisioning service instance. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the Provisioning Service + /// + /// + /// Deletes the Provisioning Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of provisioning service to delete. + /// + /// + /// Resource group identifier. + /// + public static void Delete(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName) + { + operations.DeleteAsync(provisioningServiceName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Delete the Provisioning Service + /// + /// + /// Deletes the Provisioning Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of provisioning service to delete. + /// + /// + /// Resource group identifier. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get all the provisioning services in a subscription. + /// + /// + /// List all the provisioning services for a given subscription id. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this IIotDpsResourceOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Get all the provisioning services in a subscription. + /// + /// + /// List all the provisioning services for a given subscription id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IIotDpsResourceOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a list of all provisioning services in the given resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + public static IPage ListByResourceGroup(this IIotDpsResourceOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Get a list of all provisioning services in the given resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IIotDpsResourceOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the status of a long running operation, such as create, update or + /// delete a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Operation id corresponding to long running operation. Use this to poll for + /// the status. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service that the operation is running on. + /// + /// + /// Async header used to poll on the status of the operation, obtained while + /// creating the long running operation. + /// + public static AsyncOperationResult GetOperationResult(this IIotDpsResourceOperations operations, string operationId, string resourceGroupName, string provisioningServiceName, string asyncinfo) + { + return operations.GetOperationResultAsync(operationId, resourceGroupName, provisioningServiceName, asyncinfo).GetAwaiter().GetResult(); + } + + /// + /// Gets the status of a long running operation, such as create, update or + /// delete a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Operation id corresponding to long running operation. Use this to poll for + /// the status. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service that the operation is running on. + /// + /// + /// Async header used to poll on the status of the operation, obtained while + /// creating the long running operation. + /// + /// + /// The cancellation token. + /// + public static async Task GetOperationResultAsync(this IIotDpsResourceOperations operations, string operationId, string resourceGroupName, string provisioningServiceName, string asyncinfo, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetOperationResultWithHttpMessagesAsync(operationId, resourceGroupName, provisioningServiceName, asyncinfo, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the list of valid SKUs for a provisioning service. + /// + /// + /// Gets the list of valid SKUs and tiers for a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of provisioning service. + /// + /// + /// Name of resource group. + /// + public static IPage ListValidSkus(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName) + { + return operations.ListValidSkusAsync(provisioningServiceName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Get the list of valid SKUs for a provisioning service. + /// + /// + /// Gets the list of valid SKUs and tiers for a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of provisioning service. + /// + /// + /// Name of resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListValidSkusAsync(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListValidSkusWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Check if a provisioning service name is available. + /// + /// + /// Check if a provisioning service name is available. This will validate if + /// the name is syntactically valid and if the name is usable + /// + /// + /// The operations group for this extension method. + /// + /// + /// Set the name parameter in the OperationInputs structure to the name of the + /// provisioning service to check. + /// + public static NameAvailabilityInfo CheckProvisioningServiceNameAvailability(this IIotDpsResourceOperations operations, OperationInputs arguments) + { + return operations.CheckProvisioningServiceNameAvailabilityAsync(arguments).GetAwaiter().GetResult(); + } + + /// + /// Check if a provisioning service name is available. + /// + /// + /// Check if a provisioning service name is available. This will validate if + /// the name is syntactically valid and if the name is usable + /// + /// + /// The operations group for this extension method. + /// + /// + /// Set the name parameter in the OperationInputs structure to the name of the + /// provisioning service to check. + /// + /// + /// The cancellation token. + /// + public static async Task CheckProvisioningServiceNameAvailabilityAsync(this IIotDpsResourceOperations operations, OperationInputs arguments, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckProvisioningServiceNameAvailabilityWithHttpMessagesAsync(arguments, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the security metadata for a provisioning service. + /// + /// + /// List the primary and secondary keys for a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The provisioning service name to get the shared access keys for. + /// + /// + /// resource group name + /// + public static IPage ListKeys(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName) + { + return operations.ListKeysAsync(provisioningServiceName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Get the security metadata for a provisioning service. + /// + /// + /// List the primary and secondary keys for a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The provisioning service name to get the shared access keys for. + /// + /// + /// resource group name + /// + /// + /// The cancellation token. + /// + public static async Task> ListKeysAsync(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListKeysWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a shared access policy by name from a provisioning service. + /// + /// + /// List primary and secondary keys for a specific key name + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the provisioning service. + /// + /// + /// Logical key name to get key-values for. + /// + /// + /// The name of the resource group that contains the provisioning service. + /// + public static SharedAccessSignatureAuthorizationRuleAccessRightsDescription ListKeysForKeyName(this IIotDpsResourceOperations operations, string provisioningServiceName, string keyName, string resourceGroupName) + { + return operations.ListKeysForKeyNameAsync(provisioningServiceName, keyName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Get a shared access policy by name from a provisioning service. + /// + /// + /// List primary and secondary keys for a specific key name + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the provisioning service. + /// + /// + /// Logical key name to get key-values for. + /// + /// + /// The name of the resource group that contains the provisioning service. + /// + /// + /// The cancellation token. + /// + public static async Task ListKeysForKeyNameAsync(this IIotDpsResourceOperations operations, string provisioningServiceName, string keyName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListKeysForKeyNameWithHttpMessagesAsync(provisioningServiceName, keyName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update the metadata of the provisioning service. + /// + /// + /// Create or update the metadata of the provisioning service. The usual + /// pattern to modify a property is to retrieve the provisioning service + /// metadata and security metadata, and then combine them with the modified + /// values in a new body to update the provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// Description of the provisioning service to create or update. + /// + public static ProvisioningServiceDescription BeginCreateOrUpdate(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription).GetAwaiter().GetResult(); + } + + /// + /// Create or update the metadata of the provisioning service. + /// + /// + /// Create or update the metadata of the provisioning service. The usual + /// pattern to modify a property is to retrieve the provisioning service + /// metadata and security metadata, and then combine them with the modified + /// values in a new body to update the provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// Description of the provisioning service to create or update. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an existing provisioning service's tags. + /// + /// + /// Update an existing provisioning service's tags. to update other fields use + /// the CreateOrUpdate method + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// Updated tag information to set into the provisioning service instance. + /// + public static ProvisioningServiceDescription BeginUpdate(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags) + { + return operations.BeginUpdateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags).GetAwaiter().GetResult(); + } + + /// + /// Update an existing provisioning service's tags. + /// + /// + /// Update an existing provisioning service's tags. to update other fields use + /// the CreateOrUpdate method + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// Updated tag information to set into the provisioning service instance. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the Provisioning Service + /// + /// + /// Deletes the Provisioning Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of provisioning service to delete. + /// + /// + /// Resource group identifier. + /// + public static void BeginDelete(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName) + { + operations.BeginDeleteAsync(provisioningServiceName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Delete the Provisioning Service + /// + /// + /// Deletes the Provisioning Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of provisioning service to delete. + /// + /// + /// Resource group identifier. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get all the provisioning services in a subscription. + /// + /// + /// List all the provisioning services for a given subscription id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IIotDpsResourceOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all the provisioning services in a subscription. + /// + /// + /// List all the provisioning services for a given subscription id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this IIotDpsResourceOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a list of all provisioning services in the given resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IIotDpsResourceOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get a list of all provisioning services in the given 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 IIotDpsResourceOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the list of valid SKUs for a provisioning service. + /// + /// + /// Gets the list of valid SKUs and tiers for a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListValidSkusNext(this IIotDpsResourceOperations operations, string nextPageLink) + { + return operations.ListValidSkusNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get the list of valid SKUs for a provisioning service. + /// + /// + /// Gets the list of valid SKUs and tiers for a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListValidSkusNextAsync(this IIotDpsResourceOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListValidSkusNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the security metadata for a provisioning service. + /// + /// + /// List the primary and secondary keys for a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListKeysNext(this IIotDpsResourceOperations operations, string nextPageLink) + { + return operations.ListKeysNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get the security metadata for a provisioning service. + /// + /// + /// List the primary and secondary keys for a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListKeysNextAsync(this IIotDpsResourceOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListKeysNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/AccessRightsDescription.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/AccessRightsDescription.cs new file mode 100644 index 000000000000..629d33aad14b --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/AccessRightsDescription.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + + /// + /// Defines values for AccessRightsDescription. + /// + public static class AccessRightsDescription + { + public const string ServiceConfig = "ServiceConfig"; + public const string EnrollmentRead = "EnrollmentRead"; + public const string EnrollmentWrite = "EnrollmentWrite"; + public const string DeviceConnect = "DeviceConnect"; + public const string RegistrationStatusRead = "RegistrationStatusRead"; + public const string RegistrationStatusWrite = "RegistrationStatusWrite"; + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/AllocationPolicy.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/AllocationPolicy.cs new file mode 100644 index 000000000000..869a29ddfab9 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/AllocationPolicy.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + + /// + /// Defines values for AllocationPolicy. + /// + public static class AllocationPolicy + { + public const string Hashed = "Hashed"; + public const string GeoLatency = "GeoLatency"; + public const string Static = "Static"; + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/AsyncOperationResult.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/AsyncOperationResult.cs new file mode 100644 index 000000000000..b34925448456 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/AsyncOperationResult.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Result of a long running operation. + /// + public partial class AsyncOperationResult + { + /// + /// Initializes a new instance of the AsyncOperationResult class. + /// + public AsyncOperationResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AsyncOperationResult class. + /// + /// current status of a long running + /// operation. + /// Error message containing code, description and + /// details + public AsyncOperationResult(string status = default(string), ErrorMesssage error = default(ErrorMesssage)) + { + Status = status; + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current status of a long running operation. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets error message containing code, description and details + /// + [JsonProperty(PropertyName = "error")] + public ErrorMesssage Error { get; set; } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/CertificateBodyDescription.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/CertificateBodyDescription.cs new file mode 100644 index 000000000000..9f0f9360730b --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/CertificateBodyDescription.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The JSON-serialized X509 Certificate. + /// + public partial class CertificateBodyDescription + { + /// + /// Initializes a new instance of the CertificateBodyDescription class. + /// + public CertificateBodyDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateBodyDescription class. + /// + /// Base-64 representation of the X509 leaf + /// certificate .cer file or just .pem file content. + public CertificateBodyDescription(string certificate = default(string)) + { + Certificate = certificate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets base-64 representation of the X509 leaf certificate + /// .cer file or just .pem file content. + /// + [JsonProperty(PropertyName = "certificate")] + public string Certificate { get; set; } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/CertificateListDescription.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/CertificateListDescription.cs new file mode 100644 index 000000000000..4edf2dea0527 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/CertificateListDescription.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The JSON-serialized array of Certificate objects. + /// + public partial class CertificateListDescription + { + /// + /// Initializes a new instance of the CertificateListDescription class. + /// + public CertificateListDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateListDescription class. + /// + /// The array of Certificate objects. + public CertificateListDescription(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the array of Certificate objects. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/CertificateProperties.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/CertificateProperties.cs new file mode 100644 index 000000000000..7d007bb8dbe1 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/CertificateProperties.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The description of an X509 CA Certificate. + /// + public partial class CertificateProperties + { + /// + /// Initializes a new instance of the CertificateProperties class. + /// + public CertificateProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateProperties class. + /// + /// The certificate's subject name. + /// The certificate's expiration date and + /// time. + /// The certificate's thumbprint. + /// Determines whether certificate has been + /// verified. + /// The certificate's creation date and + /// time. + /// The certificate's last update date and + /// time. + public CertificateProperties(string subject = default(string), System.DateTime? expiry = default(System.DateTime?), string thumbprint = default(string), bool? isVerified = default(bool?), System.DateTime? created = default(System.DateTime?), System.DateTime? updated = default(System.DateTime?)) + { + Subject = subject; + Expiry = expiry; + Thumbprint = thumbprint; + IsVerified = isVerified; + Created = created; + Updated = updated; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the certificate's subject name. + /// + [JsonProperty(PropertyName = "subject")] + public string Subject { get; private set; } + + /// + /// Gets the certificate's expiration date and time. + /// + [JsonConverter(typeof(DateTimeRfc1123JsonConverter))] + [JsonProperty(PropertyName = "expiry")] + public System.DateTime? Expiry { get; private set; } + + /// + /// Gets the certificate's thumbprint. + /// + [JsonProperty(PropertyName = "thumbprint")] + public string Thumbprint { get; private set; } + + /// + /// Gets determines whether certificate has been verified. + /// + [JsonProperty(PropertyName = "isVerified")] + public bool? IsVerified { get; private set; } + + /// + /// Gets the certificate's creation date and time. + /// + [JsonConverter(typeof(DateTimeRfc1123JsonConverter))] + [JsonProperty(PropertyName = "created")] + public System.DateTime? Created { get; private set; } + + /// + /// Gets the certificate's last update date and time. + /// + [JsonConverter(typeof(DateTimeRfc1123JsonConverter))] + [JsonProperty(PropertyName = "updated")] + public System.DateTime? Updated { get; private set; } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/CertificatePurpose.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/CertificatePurpose.cs new file mode 100644 index 000000000000..8d42c4fb0575 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/CertificatePurpose.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + + /// + /// Defines values for CertificatePurpose. + /// + public static class CertificatePurpose + { + public const string ClientAuthentication = "clientAuthentication"; + public const string ServerAuthentication = "serverAuthentication"; + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/CertificateResponse.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/CertificateResponse.cs new file mode 100644 index 000000000000..2ddbfd09bf8f --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/CertificateResponse.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The X509 Certificate. + /// + public partial class CertificateResponse : IResource + { + /// + /// Initializes a new instance of the CertificateResponse class. + /// + public CertificateResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateResponse class. + /// + /// properties of a certificate + /// The resource identifier. + /// The name of the certificate. + /// The entity tag. + /// The resource type. + public CertificateResponse(CertificateProperties properties = default(CertificateProperties), string id = default(string), string name = default(string), string etag = default(string), string type = default(string)) + { + Properties = properties; + Id = id; + Name = name; + Etag = etag; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of a certificate + /// + [JsonProperty(PropertyName = "properties")] + public CertificateProperties Properties { get; set; } + + /// + /// Gets the resource identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the certificate. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the entity tag. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + /// + /// Gets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/ErrorDetails.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/ErrorDetails.cs new file mode 100644 index 000000000000..80bf511666df --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/ErrorDetails.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.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. + /// + /// The error code. + /// The HTTP status code. + /// The error message. + /// The error details. + public ErrorDetails(string code = default(string), string httpStatusCode = default(string), string message = default(string), string details = default(string)) + { + Code = code; + HttpStatusCode = httpStatusCode; + Message = message; + Details = details; + 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 HTTP status code. + /// + [JsonProperty(PropertyName = "HttpStatusCode")] + public string HttpStatusCode { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "Message")] + public string Message { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "Details")] + public string Details { get; private set; } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/ErrorDetailsException.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/ErrorDetailsException.cs new file mode 100644 index 000000000000..d8daf7716fa1 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/ErrorDetailsException.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.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/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/ErrorMesssage.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/ErrorMesssage.cs new file mode 100644 index 000000000000..00ace596ad62 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/ErrorMesssage.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error response containing message and code. + /// + public partial class ErrorMesssage + { + /// + /// Initializes a new instance of the ErrorMesssage class. + /// + public ErrorMesssage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorMesssage class. + /// + /// standard error code + /// standard error description + /// detailed summary of error + public ErrorMesssage(string code = default(string), string message = default(string), string details = default(string)) + { + Code = code; + Message = message; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets standard error code + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets standard error description + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets detailed summary of error + /// + [JsonProperty(PropertyName = "details")] + public string Details { get; set; } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/IotDpsPropertiesDescription.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/IotDpsPropertiesDescription.cs new file mode 100644 index 000000000000..dee983613f06 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/IotDpsPropertiesDescription.cs @@ -0,0 +1,132 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// the service specific properties of a provisoning service, including + /// keys, linked iot hubs, current state, and system generated properties + /// such as hostname and idScope + /// + public partial class IotDpsPropertiesDescription + { + /// + /// Initializes a new instance of the IotDpsPropertiesDescription + /// class. + /// + public IotDpsPropertiesDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IotDpsPropertiesDescription + /// class. + /// + /// Current state of the provisioning service. + /// Possible values include: 'Activating', 'Active', 'Deleting', + /// 'Deleted', 'ActivationFailed', 'DeletionFailed', 'Transitioning', + /// 'Suspending', 'Suspended', 'Resuming', 'FailingOver', + /// 'FailoverFailed' + /// The ARM provisioning state of the + /// provisioning service. + /// List of IoT hubs assosciated with this + /// provisioning service. + /// Allocation policy to be used by this + /// provisioning service. Possible values include: 'Hashed', + /// 'GeoLatency', 'Static' + /// Service endpoint for + /// provisioning service. + /// Device endpoint for this + /// provisioning service. + /// Unique identifier of this provisioning + /// service. + /// List of authorization keys for + /// a provisioning service. + public IotDpsPropertiesDescription(string state = default(string), string provisioningState = default(string), IList iotHubs = default(IList), string allocationPolicy = default(string), string serviceOperationsHostName = default(string), string deviceProvisioningHostName = default(string), string idScope = default(string), IList authorizationPolicies = default(IList)) + { + State = state; + ProvisioningState = provisioningState; + IotHubs = iotHubs; + AllocationPolicy = allocationPolicy; + ServiceOperationsHostName = serviceOperationsHostName; + DeviceProvisioningHostName = deviceProvisioningHostName; + IdScope = idScope; + AuthorizationPolicies = authorizationPolicies; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current state of the provisioning service. Possible + /// values include: 'Activating', 'Active', 'Deleting', 'Deleted', + /// 'ActivationFailed', 'DeletionFailed', 'Transitioning', + /// 'Suspending', 'Suspended', 'Resuming', 'FailingOver', + /// 'FailoverFailed' + /// + [JsonProperty(PropertyName = "state")] + public string State { get; set; } + + /// + /// Gets or sets the ARM provisioning state of the provisioning + /// service. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets list of IoT hubs assosciated with this provisioning + /// service. + /// + [JsonProperty(PropertyName = "iotHubs")] + public IList IotHubs { get; set; } + + /// + /// Gets or sets allocation policy to be used by this provisioning + /// service. Possible values include: 'Hashed', 'GeoLatency', 'Static' + /// + [JsonProperty(PropertyName = "allocationPolicy")] + public string AllocationPolicy { get; set; } + + /// + /// Gets service endpoint for provisioning service. + /// + [JsonProperty(PropertyName = "serviceOperationsHostName")] + public string ServiceOperationsHostName { get; private set; } + + /// + /// Gets device endpoint for this provisioning service. + /// + [JsonProperty(PropertyName = "deviceProvisioningHostName")] + public string DeviceProvisioningHostName { get; private set; } + + /// + /// Gets unique identifier of this provisioning service. + /// + [JsonProperty(PropertyName = "idScope")] + public string IdScope { get; private set; } + + /// + /// Gets or sets list of authorization keys for a provisioning service. + /// + [JsonProperty(PropertyName = "authorizationPolicies")] + public IList AuthorizationPolicies { get; set; } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/IotDpsSku.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/IotDpsSku.cs new file mode 100644 index 000000000000..1412ef27c11f --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/IotDpsSku.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + + /// + /// Defines values for IotDpsSku. + /// + public static class IotDpsSku + { + public const string S1 = "S1"; + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/IotDpsSkuDefinition.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/IotDpsSkuDefinition.cs new file mode 100644 index 000000000000..9cd9ba2244d4 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/IotDpsSkuDefinition.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Available Sku's of tier and units. + /// + public partial class IotDpsSkuDefinition + { + /// + /// Initializes a new instance of the IotDpsSkuDefinition class. + /// + public IotDpsSkuDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IotDpsSkuDefinition class. + /// + /// Sku name. Possible values include: 'S1' + public IotDpsSkuDefinition(string name = default(string)) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets sku name. Possible values include: 'S1' + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/IotDpsSkuInfo.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/IotDpsSkuInfo.cs new file mode 100644 index 000000000000..6b0738f5cda6 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/IotDpsSkuInfo.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// List of possible provisoning service SKUs. + /// + public partial class IotDpsSkuInfo + { + /// + /// Initializes a new instance of the IotDpsSkuInfo class. + /// + public IotDpsSkuInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IotDpsSkuInfo class. + /// + /// Sku name. Possible values include: 'S1' + /// Pricing tier name of the provisioning + /// service. + /// The number of units to provision + public IotDpsSkuInfo(string name = default(string), string tier = default(string), long? capacity = default(long?)) + { + Name = name; + Tier = tier; + Capacity = capacity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets sku name. Possible values include: 'S1' + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets pricing tier name of the provisioning service. + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; private set; } + + /// + /// Gets or sets the number of units to provision + /// + [JsonProperty(PropertyName = "capacity")] + public long? Capacity { get; set; } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/IotHubDefinitionDescription.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/IotHubDefinitionDescription.cs new file mode 100644 index 000000000000..087abaae8f2d --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/IotHubDefinitionDescription.cs @@ -0,0 +1,107 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Description of the IoT hub. + /// + public partial class IotHubDefinitionDescription + { + /// + /// Initializes a new instance of the IotHubDefinitionDescription + /// class. + /// + public IotHubDefinitionDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IotHubDefinitionDescription + /// class. + /// + /// Connection string og the IoT + /// hub. + /// ARM region of the IoT hub. + /// flag for applying + /// allocationPolicy or not for a given iot hub. + /// weight to apply for a given iot + /// h. + /// Host name of the IoT hub. + public IotHubDefinitionDescription(string connectionString, string location, bool? applyAllocationPolicy = default(bool?), int? allocationWeight = default(int?), string name = default(string)) + { + ApplyAllocationPolicy = applyAllocationPolicy; + AllocationWeight = allocationWeight; + Name = name; + ConnectionString = connectionString; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets flag for applying allocationPolicy or not for a given + /// iot hub. + /// + [JsonProperty(PropertyName = "applyAllocationPolicy")] + public bool? ApplyAllocationPolicy { get; set; } + + /// + /// Gets or sets weight to apply for a given iot h. + /// + [JsonProperty(PropertyName = "allocationWeight")] + public int? AllocationWeight { get; set; } + + /// + /// Gets host name of the IoT hub. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets or sets connection string og the IoT hub. + /// + [JsonProperty(PropertyName = "connectionString")] + public string ConnectionString { get; set; } + + /// + /// Gets or sets ARM region of the IoT hub. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ConnectionString == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ConnectionString"); + } + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/NameAvailabilityInfo.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/NameAvailabilityInfo.cs new file mode 100644 index 000000000000..12125656a6c0 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/NameAvailabilityInfo.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Description of name availability. + /// + public partial class NameAvailabilityInfo + { + /// + /// Initializes a new instance of the NameAvailabilityInfo class. + /// + public NameAvailabilityInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NameAvailabilityInfo class. + /// + /// specifies if a name is available or + /// not + /// specifies the reason a name is unavailable. + /// Possible values include: 'Invalid', 'AlreadyExists' + /// message containing a etailed reason name is + /// unavailable + public NameAvailabilityInfo(bool? nameAvailable = default(bool?), string reason = default(string), string message = default(string)) + { + NameAvailable = nameAvailable; + Reason = reason; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies if a name is available or not + /// + [JsonProperty(PropertyName = "nameAvailable")] + public bool? NameAvailable { get; set; } + + /// + /// Gets or sets specifies the reason a name is unavailable. Possible + /// values include: 'Invalid', 'AlreadyExists' + /// + [JsonProperty(PropertyName = "reason")] + public string Reason { get; set; } + + /// + /// Gets or sets message containing a etailed reason name is + /// unavailable + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/NameUnavailabilityReason.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/NameUnavailabilityReason.cs new file mode 100644 index 000000000000..e81ab9e6f9b7 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/NameUnavailabilityReason.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + + /// + /// Defines values for NameUnavailabilityReason. + /// + public static class NameUnavailabilityReason + { + public const string Invalid = "Invalid"; + public const string AlreadyExists = "AlreadyExists"; + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/Operation.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/Operation.cs new file mode 100644 index 000000000000..6af1781fa9d6 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/Operation.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// IoT Hub 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} + /// The object that represents the + /// operation. + public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay)) + { + Name = name; + Display = display; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets operation name: {provider}/{resource}/{read | write | action | + /// delete} + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets or sets the object that represents the operation. + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/OperationDisplay.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..7dc145ee72e5 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/OperationDisplay.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.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 Devices. + /// Resource Type: ProvisioningServices. + /// Name of the operation. + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets service provider: Microsoft Devices. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; private set; } + + /// + /// Gets resource Type: ProvisioningServices. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; private set; } + + /// + /// Gets name of the operation. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; private set; } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/OperationInputs.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/OperationInputs.cs new file mode 100644 index 000000000000..49e6b4c2b24c --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/OperationInputs.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Input values for operation results call. + /// + public partial class OperationInputs + { + /// + /// Initializes a new instance of the OperationInputs class. + /// + public OperationInputs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationInputs class. + /// + /// The name of the Provisioning Service to + /// check. + public OperationInputs(string name) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the Provisioning Service to check. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/Page.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/Page.cs new file mode 100644 index 000000000000..42a8f2c3653e --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/Page.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.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/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/ProvisioningServiceDescription.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/ProvisioningServiceDescription.cs new file mode 100644 index 000000000000..9ee57bc08986 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/ProvisioningServiceDescription.cs @@ -0,0 +1,101 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The description of the provisioning service. + /// + public partial class ProvisioningServiceDescription : Resource + { + /// + /// Initializes a new instance of the ProvisioningServiceDescription + /// class. + /// + public ProvisioningServiceDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProvisioningServiceDescription + /// class. + /// + /// The resource location. + /// Service specific properties for a + /// provisioning service + /// Sku info for a provisioning Service. + /// The resource identifier. + /// The resource name. + /// The resource type. + /// The resource tags. + /// The Etag field is *not* required. If it is + /// provided in the response body, it must also be provided as a header + /// per the normal ETag convention. + public ProvisioningServiceDescription(string location, IotDpsPropertiesDescription properties, IotDpsSkuInfo sku, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string etag = default(string)) + : base(location, id, name, type, tags) + { + Etag = etag; + Properties = properties; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Etag field is *not* required. If it is provided in + /// the response body, it must also be provided as a header per the + /// normal ETag convention. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + /// + /// Gets or sets service specific properties for a provisioning service + /// + [JsonProperty(PropertyName = "properties")] + public IotDpsPropertiesDescription Properties { get; set; } + + /// + /// Gets or sets sku info for a provisioning Service. + /// + [JsonProperty(PropertyName = "sku")] + public IotDpsSkuInfo Sku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + if (Sku == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Sku"); + } + } + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/Resource.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/Resource.cs new file mode 100644 index 000000000000..1a430c4d513d --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/Resource.cs @@ -0,0 +1,107 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.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 an Azure resource. + /// + 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. + public Resource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the resource identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets 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; } + + /// + /// 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, "^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "Name", "^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$"); + } + } + } + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/SharedAccessSignatureAuthorizationRuleAccessRightsDescription.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/SharedAccessSignatureAuthorizationRuleAccessRightsDescription.cs new file mode 100644 index 000000000000..fe2aea1eaed3 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/SharedAccessSignatureAuthorizationRuleAccessRightsDescription.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Description of the shared access key. + /// + public partial class SharedAccessSignatureAuthorizationRuleAccessRightsDescription + { + /// + /// Initializes a new instance of the + /// SharedAccessSignatureAuthorizationRuleAccessRightsDescription + /// class. + /// + public SharedAccessSignatureAuthorizationRuleAccessRightsDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SharedAccessSignatureAuthorizationRuleAccessRightsDescription + /// class. + /// + /// Name of the key. + /// Rights that this key has. Possible values + /// include: 'ServiceConfig', 'EnrollmentRead', 'EnrollmentWrite', + /// 'DeviceConnect', 'RegistrationStatusRead', + /// 'RegistrationStatusWrite' + /// Primary SAS key value. + /// Secondary SAS key value. + public SharedAccessSignatureAuthorizationRuleAccessRightsDescription(string keyName, string rights, string primaryKey = default(string), string secondaryKey = default(string)) + { + KeyName = keyName; + PrimaryKey = primaryKey; + SecondaryKey = secondaryKey; + Rights = rights; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the key. + /// + [JsonProperty(PropertyName = "keyName")] + public string KeyName { get; set; } + + /// + /// Gets or sets primary SAS key value. + /// + [JsonProperty(PropertyName = "primaryKey")] + public string PrimaryKey { get; set; } + + /// + /// Gets or sets secondary SAS key value. + /// + [JsonProperty(PropertyName = "secondaryKey")] + public string SecondaryKey { get; set; } + + /// + /// Gets or sets rights that this key has. Possible values include: + /// 'ServiceConfig', 'EnrollmentRead', 'EnrollmentWrite', + /// 'DeviceConnect', 'RegistrationStatusRead', + /// 'RegistrationStatusWrite' + /// + [JsonProperty(PropertyName = "rights")] + public string Rights { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (KeyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KeyName"); + } + if (Rights == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Rights"); + } + } + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/State.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/State.cs new file mode 100644 index 000000000000..4cb71e5ec2f0 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/State.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + + /// + /// Defines values for State. + /// + public static class State + { + public const string Activating = "Activating"; + public const string Active = "Active"; + public const string Deleting = "Deleting"; + public const string Deleted = "Deleted"; + public const string ActivationFailed = "ActivationFailed"; + public const string DeletionFailed = "DeletionFailed"; + public const string Transitioning = "Transitioning"; + public const string Suspending = "Suspending"; + public const string Suspended = "Suspended"; + public const string Resuming = "Resuming"; + public const string FailingOver = "FailingOver"; + public const string FailoverFailed = "FailoverFailed"; + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/TagsResource.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/TagsResource.cs new file mode 100644 index 000000000000..3e7e12667151 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/TagsResource.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A container holding only the Tags for a resource, allowing the user to + /// update the tags on a Provisioning Service instance. + /// + public partial class TagsResource + { + /// + /// Initializes a new instance of the TagsResource class. + /// + public TagsResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TagsResource class. + /// + /// Resource tags + public TagsResource(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/VerificationCodeRequest.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/VerificationCodeRequest.cs new file mode 100644 index 000000000000..2a7f21b9dfdb --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/VerificationCodeRequest.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The JSON-serialized leaf certificate + /// + public partial class VerificationCodeRequest + { + /// + /// Initializes a new instance of the VerificationCodeRequest class. + /// + public VerificationCodeRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VerificationCodeRequest class. + /// + /// base-64 representation of X509 + /// certificate .cer file or just .pem file content. + public VerificationCodeRequest(string certificate = default(string)) + { + Certificate = certificate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets base-64 representation of X509 certificate .cer file + /// or just .pem file content. + /// + [JsonProperty(PropertyName = "certificate")] + public string Certificate { get; set; } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/VerificationCodeResponse.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/VerificationCodeResponse.cs new file mode 100644 index 000000000000..dada77807da1 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/VerificationCodeResponse.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Description of the response of the verification code. + /// + public partial class VerificationCodeResponse : IResource + { + /// + /// Initializes a new instance of the VerificationCodeResponse class. + /// + public VerificationCodeResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VerificationCodeResponse class. + /// + /// Name of certificate. + /// Request etag. + /// The resource identifier. + /// The resource type. + public VerificationCodeResponse(string name = default(string), string etag = default(string), string id = default(string), string type = default(string), VerificationCodeResponseProperties properties = default(VerificationCodeResponseProperties)) + { + Name = name; + Etag = etag; + Id = id; + Type = type; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets name of certificate. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets request etag. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + /// + /// Gets the resource identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public VerificationCodeResponseProperties Properties { get; set; } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/VerificationCodeResponseProperties.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/VerificationCodeResponseProperties.cs new file mode 100644 index 000000000000..e92b0961607e --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Models/VerificationCodeResponseProperties.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class VerificationCodeResponseProperties + { + /// + /// Initializes a new instance of the + /// VerificationCodeResponseProperties class. + /// + public VerificationCodeResponseProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VerificationCodeResponseProperties class. + /// + /// Verification code. + /// Certificate subject. + /// Code expiry. + /// Certificate thumbprint. + /// Indicate if the certificate is verified by + /// owner of private key. + /// Certificate created time. + /// Certificate updated time. + public VerificationCodeResponseProperties(string verificationCode = default(string), string subject = default(string), string expiry = default(string), string thumbprint = default(string), bool? isVerified = default(bool?), string created = default(string), string updated = default(string)) + { + VerificationCode = verificationCode; + Subject = subject; + Expiry = expiry; + Thumbprint = thumbprint; + IsVerified = isVerified; + Created = created; + Updated = updated; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets verification code. + /// + [JsonProperty(PropertyName = "verificationCode")] + public string VerificationCode { get; set; } + + /// + /// Gets or sets certificate subject. + /// + [JsonProperty(PropertyName = "subject")] + public string Subject { get; set; } + + /// + /// Gets or sets code expiry. + /// + [JsonProperty(PropertyName = "expiry")] + public string Expiry { get; set; } + + /// + /// Gets or sets certificate thumbprint. + /// + [JsonProperty(PropertyName = "thumbprint")] + public string Thumbprint { get; set; } + + /// + /// Gets or sets indicate if the certificate is verified by owner of + /// private key. + /// + [JsonProperty(PropertyName = "isVerified")] + public bool? IsVerified { get; set; } + + /// + /// Gets or sets certificate created time. + /// + [JsonProperty(PropertyName = "created")] + public string Created { get; set; } + + /// + /// Gets or sets certificate updated time. + /// + [JsonProperty(PropertyName = "updated")] + public string Updated { get; set; } + + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Operations.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Operations.cs new file mode 100644 index 000000000000..d667cdd721bc --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/Operations.cs @@ -0,0 +1,390 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices +{ + 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(IotDpsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the IotDpsClient + /// + public IotDpsClient Client { get; private set; } + + /// + /// Lists all of the available Microsoft.Devices REST API operations. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Devices/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 Microsoft.Devices 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/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/OperationsExtensions.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..572ac046cfb3 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/OperationsExtensions.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceProvisioningServices +{ + 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 Microsoft.Devices 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 Microsoft.Devices 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 Microsoft.Devices 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 Microsoft.Devices 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/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/SdkInfo_iotDpsClient.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/SdkInfo_iotDpsClient.cs new file mode 100644 index 000000000000..e0e84a89f3de --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Generated/SdkInfo_iotDpsClient.cs @@ -0,0 +1,21 @@ + +using System; +using System.Collections.Generic; +using System.Linq; + +internal static partial class SdkInfo +{ + public static IEnumerable> ApiInfo_iotDpsClient + { + get + { + return new Tuple[] + { + new Tuple("Devices", "DpsCertificate", "2017-11-15"), + new Tuple("Devices", "DpsCertificates", "2017-11-15"), + new Tuple("Devices", "IotDpsResource", "2017-11-15"), + new Tuple("Devices", "Operations", "2017-11-15"), + }.AsEnumerable(); + } + } +} diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Microsoft.Azure.Management.DeviceProvisioningServices.csproj b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Microsoft.Azure.Management.DeviceProvisioningServices.csproj new file mode 100644 index 000000000000..e85cf5c28364 --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Microsoft.Azure.Management.DeviceProvisioningServices.csproj @@ -0,0 +1,22 @@ + + + + + + + Microsoft.Azure.Management.DeviceProvisioningServices + Provides management capabilities for Microsoft Azure IoT Device Provisioning Service. + Microsoft Azure Provisioning Service Management + Microsoft.Azure.Management.DeviceProvisioningServices + 0.9.0-preview + Microsoft Azure IoT Provisioning Services;IoT Device Provisioning Service Management;IoT Provisioning Service; + This is a general availability release of the Azure Iot Device Provisioning Service SDK. + + + net452;netstandard1.4 + + + + + + \ No newline at end of file diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Properties/AssemblyInfo.cs b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..4a83bc21a34c --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/Properties/AssemblyInfo.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System.Reflection; +using System.Resources; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Microsoft Azure Provisioning Service Management Library")] +[assembly: AssemblyDescription("Provides management capabilities for Microsoft Azure IoT Device Provisioning Service.")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Microsoft Azure .NET SDK")] +[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: NeutralResourcesLanguage("en")] +[assembly: AssemblyVersion("0.9.0.0")] +[assembly: AssemblyFileVersion("0.9.0.0")] diff --git a/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/generate.cmd b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/generate.cmd new file mode 100644 index 000000000000..9a9079fa870c --- /dev/null +++ b/src/SDKs/DeviceProvisioningServices/Management.DeviceProvisioningServices/generate.cmd @@ -0,0 +1,7 @@ +:: +:: Microsoft Azure SDK for Net - Generate library code +:: Copyright (C) Microsoft Corporation. All Rights Reserved. +:: + +@echo off +call %~dp0..\..\..\..\tools\generate.cmd deviceprovisioningservices/resource-manager %* diff --git a/src/SDKs/_metadata/deviceprovisioningservices_resource-manager.txt b/src/SDKs/_metadata/deviceprovisioningservices_resource-manager.txt new file mode 100644 index 000000000000..0ca060937895 --- /dev/null +++ b/src/SDKs/_metadata/deviceprovisioningservices_resource-manager.txt @@ -0,0 +1,11 @@ +2018-02-06 21:26:17 UTC + +1) azure-rest-api-specs repository information +GitHub user: Azure +Branch: current +Commit: d390062ed96aa6478741b5f5196039540cb90d65 + +2) AutoRest information +Requested version: latest +Bootstrapper version: C:\Users\pamontg\AppData\Roaming\npm `-- autorest@2.0.4245 +Latest installed version: