From 6ed841cf3346ac63bf9ca7c147424766927db666 Mon Sep 17 00:00:00 2001 From: Ryan K Date: Wed, 10 Jun 2020 01:00:58 -0700 Subject: [PATCH] Azure Digital Twins 0.1.0 SDK (#12538) * DigitalTwins SDK and Tests * New swagger and tests updated * enable CI * Update version Co-authored-by: Yeming Liu Co-authored-by: Ryan Kelly Co-authored-by: Yeming Liu Co-authored-by: Yeming Liu --- .../digitaltwins_resource-manager.txt | 14 + eng/pipelines/mgmt.yml | 1 + .../AzSdk.RP.props | 7 + ...icrosoft.Azure.Management.DigitalTwins.sln | 31 + .../AzureDigitalTwinsManagementClient.cs | 374 ++++ .../DigitalTwinsEndpointOperations.cs | 1083 ++++++++++ ...igitalTwinsEndpointOperationsExtensions.cs | 341 ++++ .../src/Generated/DigitalTwinsOperations.cs | 1807 +++++++++++++++++ .../DigitalTwinsOperationsExtensions.cs | 513 +++++ .../IAzureDigitalTwinsManagementClient.cs | 88 + .../IDigitalTwinsEndpointOperations.cs | 226 +++ .../src/Generated/IDigitalTwinsOperations.cs | 340 ++++ .../src/Generated/IOperations.cs | 70 + .../src/Generated/Models/CheckNameRequest.cs | 65 + .../src/Generated/Models/CheckNameResult.cs | 83 + .../Models/DigitalTwinsDescription.cs | 92 + .../Models/DigitalTwinsEndpointResource.cs | 56 + .../DigitalTwinsEndpointResourceProperties.cs | 76 + .../Models/DigitalTwinsPatchDescription.cs | 55 + .../Generated/Models/DigitalTwinsResource.cs | 101 + .../Generated/Models/DigitalTwinsSkuInfo.cs | 49 + .../Models/EndpointProvisioningState.cs | 25 + .../src/Generated/Models/ErrorDefinition.cs | 71 + .../src/Generated/Models/ErrorResponse.cs | 51 + .../Models/ErrorResponseException.cs | 62 + .../src/Generated/Models/EventGrid.cs | 81 + .../src/Generated/Models/EventHub.cs | 74 + .../src/Generated/Models/ExternalResource.cs | 67 + .../src/Generated/Models/Operation.cs | 61 + .../src/Generated/Models/OperationDisplay.cs | 77 + .../src/Generated/Models/Page.cs | 53 + .../src/Generated/Models/ProvisioningState.cs | 25 + .../src/Generated/Models/Reason.cs | 22 + .../src/Generated/Models/ServiceBus.cs | 73 + .../src/Generated/Operations.cs | 380 ++++ .../src/Generated/OperationsExtensions.cs | 87 + ...kInfo_AzureDigitalTwinsManagementClient.cs | 29 + ...osoft.Azure.Management.DigitalTwins.csproj | 25 + .../src/generate.ps1 | 1 + .../Helpers/DigitalTwinsTestUtilities.cs | 32 + .../Helpers/RecordedDelegatingHandler.cs | 87 + ...Azure.Management.DigitalTwins.Tests.csproj | 31 + .../DigitalTwinsLifecycleTests.cs | 97 + .../ScenarioTests/DigitalTwinsTestBase.cs | 92 + .../TestDigitalTwinsLifecycle.json | 602 ++++++ 45 files changed, 7677 insertions(+) create mode 100644 eng/mgmt/mgmtmetadata/digitaltwins_resource-manager.txt create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/AzSdk.RP.props create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/Microsoft.Azure.Management.DigitalTwins.sln create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/AzureDigitalTwinsManagementClient.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/DigitalTwinsEndpointOperations.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/DigitalTwinsEndpointOperationsExtensions.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/DigitalTwinsOperations.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/DigitalTwinsOperationsExtensions.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/IAzureDigitalTwinsManagementClient.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/IDigitalTwinsEndpointOperations.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/IDigitalTwinsOperations.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/IOperations.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/CheckNameRequest.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/CheckNameResult.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsDescription.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsEndpointResource.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsEndpointResourceProperties.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsPatchDescription.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsResource.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsSkuInfo.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/EndpointProvisioningState.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ErrorDefinition.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ErrorResponse.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ErrorResponseException.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/EventGrid.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/EventHub.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ExternalResource.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/Operation.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/OperationDisplay.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/Page.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/Reason.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ServiceBus.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Operations.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/OperationsExtensions.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/SdkInfo_AzureDigitalTwinsManagementClient.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Microsoft.Azure.Management.DigitalTwins.csproj create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/generate.ps1 create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/Helpers/DigitalTwinsTestUtilities.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/Helpers/RecordedDelegatingHandler.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/Microsoft.Azure.Management.DigitalTwins.Tests.csproj create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/ScenarioTests/DigitalTwinsLifecycleTests.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/ScenarioTests/DigitalTwinsTestBase.cs create mode 100644 sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/SessionRecords/DigitalTwinsLifecycleTests/TestDigitalTwinsLifecycle.json diff --git a/eng/mgmt/mgmtmetadata/digitaltwins_resource-manager.txt b/eng/mgmt/mgmtmetadata/digitaltwins_resource-manager.txt new file mode 100644 index 000000000000..b09091330e96 --- /dev/null +++ b/eng/mgmt/mgmtmetadata/digitaltwins_resource-manager.txt @@ -0,0 +1,14 @@ +Installing AutoRest version: v2 +AutoRest installed successfully. +Commencing code generation +Generating CSharp code +Executing AutoRest command +cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/digitaltwins/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\src\azure-sdk-for-net\sdk +2020-05-27 18:57:42 UTC +Azure-rest-api-specs repository information +GitHub fork: Azure +Branch: master +Commit: aad8a360e27b1811a4ecbe64ee898d25b44693a6 +AutoRest information +Requested version: v2 +Bootstrapper version: autorest@2.0.4413 diff --git a/eng/pipelines/mgmt.yml b/eng/pipelines/mgmt.yml index 178968e2eb0a..6b9c9c9d654a 100644 --- a/eng/pipelines/mgmt.yml +++ b/eng/pipelines/mgmt.yml @@ -55,6 +55,7 @@ pr: - sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices - sdk/devspaces/Microsoft.Azure.Management.DevSpaces - sdk/devtestlabs/Microsoft.Azure.Management.DevTestLabs + - sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins - sdk/dns/Microsoft.Azure.Management.Dns - sdk/edgegateway/Microsoft.Azure.Management.EdgeGateway - sdk/eng/mgmt diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/AzSdk.RP.props b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/AzSdk.RP.props new file mode 100644 index 000000000000..b43c128bb135 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/AzSdk.RP.props @@ -0,0 +1,7 @@ + + + + DigitalTwins_2020-03-01-preview; + $(PackageTags);$(CommonTags);$(AzureApiTag); + + \ No newline at end of file diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/Microsoft.Azure.Management.DigitalTwins.sln b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/Microsoft.Azure.Management.DigitalTwins.sln new file mode 100644 index 000000000000..80daa560930d --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/Microsoft.Azure.Management.DigitalTwins.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.128 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Management.DigitalTwins", "src\Microsoft.Azure.Management.DigitalTwins.csproj", "{51A009FA-D751-4375-9C1D-7FB78789BAB0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Management.DigitalTwins.Tests", "tests\Microsoft.Azure.Management.DigitalTwins.Tests.csproj", "{B94C7A88-E9F4-4238-99D7-B698EE6219F8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {51A009FA-D751-4375-9C1D-7FB78789BAB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {51A009FA-D751-4375-9C1D-7FB78789BAB0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {51A009FA-D751-4375-9C1D-7FB78789BAB0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {51A009FA-D751-4375-9C1D-7FB78789BAB0}.Release|Any CPU.Build.0 = Release|Any CPU + {B94C7A88-E9F4-4238-99D7-B698EE6219F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B94C7A88-E9F4-4238-99D7-B698EE6219F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B94C7A88-E9F4-4238-99D7-B698EE6219F8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B94C7A88-E9F4-4238-99D7-B698EE6219F8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {79BDA1D3-B45F-4F36-927B-856F345347AD} + EndGlobalSection +EndGlobal diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/AzureDigitalTwinsManagementClient.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/AzureDigitalTwinsManagementClient.cs new file mode 100644 index 000000000000..e1e8fb157653 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/AzureDigitalTwinsManagementClient.cs @@ -0,0 +1,374 @@ +// +// 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.DigitalTwins +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + + /// + /// Azure Digital Twins Client for managing DigitalTwinsInstance + /// + public partial class AzureDigitalTwinsManagementClient : ServiceClient, IAzureDigitalTwinsManagementClient, 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; } + + /// + /// Version of the DigitalTwinsInstance Management API. + /// + public string ApiVersion { get; private set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IDigitalTwinsOperations. + /// + public virtual IDigitalTwinsOperations DigitalTwins { get; private set; } + + /// + /// Gets the IDigitalTwinsEndpointOperations. + /// + public virtual IDigitalTwinsEndpointOperations DigitalTwinsEndpoint { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Initializes a new instance of the AzureDigitalTwinsManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling AzureDigitalTwinsManagementClient.Dispose(). False: will not dispose provided httpClient + protected AzureDigitalTwinsManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the AzureDigitalTwinsManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected AzureDigitalTwinsManagementClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the AzureDigitalTwinsManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected AzureDigitalTwinsManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the AzureDigitalTwinsManagementClient 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 AzureDigitalTwinsManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the AzureDigitalTwinsManagementClient 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 AzureDigitalTwinsManagementClient(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 AzureDigitalTwinsManagementClient 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 AzureDigitalTwinsManagementClient(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 AzureDigitalTwinsManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling AzureDigitalTwinsManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public AzureDigitalTwinsManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the AzureDigitalTwinsManagementClient 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 AzureDigitalTwinsManagementClient(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 AzureDigitalTwinsManagementClient 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 AzureDigitalTwinsManagementClient(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 AzureDigitalTwinsManagementClient 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 AzureDigitalTwinsManagementClient(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() + { + DigitalTwins = new DigitalTwinsOperations(this); + DigitalTwinsEndpoint = new DigitalTwinsEndpointOperations(this); + Operations = new Operations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2020-03-01-preview"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("endpointType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("endpointType")); + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/DigitalTwinsEndpointOperations.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/DigitalTwinsEndpointOperations.cs new file mode 100644 index 000000000000..d30311ff3672 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/DigitalTwinsEndpointOperations.cs @@ -0,0 +1,1083 @@ +// +// 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.DigitalTwins +{ + 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; + + /// + /// DigitalTwinsEndpointOperations operations. + /// + internal partial class DigitalTwinsEndpointOperations : IServiceOperations, IDigitalTwinsEndpointOperations + { + /// + /// Initializes a new instance of the DigitalTwinsEndpointOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DigitalTwinsEndpointOperations(AzureDigitalTwinsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureDigitalTwinsManagementClient + /// + public AzureDigitalTwinsManagementClient Client { get; private set; } + + /// + /// Get DigitalTwinsInstance Endpoints. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// 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 resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "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.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get DigitalTwinsInstances Endpoint. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string endpointName, 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("endpointName", endpointName); + 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.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update DigitalTwinsInstance endpoint. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + /// + /// DigitalTwinsInstance endpoint resource properties. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string endpointName, DigitalTwinsEndpointResourceProperties properties = default(DigitalTwinsEndpointResourceProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, endpointName, properties, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete a DigitalTwinsInstance endpoint. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string endpointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, endpointName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or update DigitalTwinsInstance endpoint. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + /// + /// DigitalTwinsInstance endpoint resource properties. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string endpointName, DigitalTwinsEndpointResourceProperties properties = default(DigitalTwinsEndpointResourceProperties), 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + DigitalTwinsEndpointResource endpointDescription = new DigitalTwinsEndpointResource(); + if (properties != null) + { + endpointDescription.Properties = properties; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("endpointDescription", endpointDescription); + 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.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + 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(endpointDescription != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(endpointDescription, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a DigitalTwinsInstance endpoint. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string endpointName, 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("endpointName", endpointName); + 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.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new 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 == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get DigitalTwinsInstance Endpoints. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/DigitalTwinsEndpointOperationsExtensions.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/DigitalTwinsEndpointOperationsExtensions.cs new file mode 100644 index 000000000000..a50d9940ebb1 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/DigitalTwinsEndpointOperationsExtensions.cs @@ -0,0 +1,341 @@ +// +// 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.DigitalTwins +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DigitalTwinsEndpointOperations. + /// + public static partial class DigitalTwinsEndpointOperationsExtensions + { + /// + /// Get DigitalTwinsInstance Endpoints. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + public static IPage List(this IDigitalTwinsEndpointOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Get DigitalTwinsInstance Endpoints. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDigitalTwinsEndpointOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get DigitalTwinsInstances Endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + public static DigitalTwinsEndpointResource Get(this IDigitalTwinsEndpointOperations operations, string resourceGroupName, string resourceName, string endpointName) + { + return operations.GetAsync(resourceGroupName, resourceName, endpointName).GetAwaiter().GetResult(); + } + + /// + /// Get DigitalTwinsInstances Endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDigitalTwinsEndpointOperations operations, string resourceGroupName, string resourceName, string endpointName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, endpointName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update DigitalTwinsInstance endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + /// + /// DigitalTwinsInstance endpoint resource properties. + /// + public static DigitalTwinsEndpointResource CreateOrUpdate(this IDigitalTwinsEndpointOperations operations, string resourceGroupName, string resourceName, string endpointName, DigitalTwinsEndpointResourceProperties properties = default(DigitalTwinsEndpointResourceProperties)) + { + return operations.CreateOrUpdateAsync(resourceGroupName, resourceName, endpointName, properties).GetAwaiter().GetResult(); + } + + /// + /// Create or update DigitalTwinsInstance endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + /// + /// DigitalTwinsInstance endpoint resource properties. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDigitalTwinsEndpointOperations operations, string resourceGroupName, string resourceName, string endpointName, DigitalTwinsEndpointResourceProperties properties = default(DigitalTwinsEndpointResourceProperties), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, endpointName, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a DigitalTwinsInstance endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + public static DigitalTwinsEndpointResource Delete(this IDigitalTwinsEndpointOperations operations, string resourceGroupName, string resourceName, string endpointName) + { + return operations.DeleteAsync(resourceGroupName, resourceName, endpointName).GetAwaiter().GetResult(); + } + + /// + /// Delete a DigitalTwinsInstance endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDigitalTwinsEndpointOperations operations, string resourceGroupName, string resourceName, string endpointName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, endpointName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update DigitalTwinsInstance endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + /// + /// DigitalTwinsInstance endpoint resource properties. + /// + public static DigitalTwinsEndpointResource BeginCreateOrUpdate(this IDigitalTwinsEndpointOperations operations, string resourceGroupName, string resourceName, string endpointName, DigitalTwinsEndpointResourceProperties properties = default(DigitalTwinsEndpointResourceProperties)) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, resourceName, endpointName, properties).GetAwaiter().GetResult(); + } + + /// + /// Create or update DigitalTwinsInstance endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + /// + /// DigitalTwinsInstance endpoint resource properties. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IDigitalTwinsEndpointOperations operations, string resourceGroupName, string resourceName, string endpointName, DigitalTwinsEndpointResourceProperties properties = default(DigitalTwinsEndpointResourceProperties), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, endpointName, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a DigitalTwinsInstance endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + public static DigitalTwinsEndpointResource BeginDelete(this IDigitalTwinsEndpointOperations operations, string resourceGroupName, string resourceName, string endpointName) + { + return operations.BeginDeleteAsync(resourceGroupName, resourceName, endpointName).GetAwaiter().GetResult(); + } + + /// + /// Delete a DigitalTwinsInstance endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IDigitalTwinsEndpointOperations operations, string resourceGroupName, string resourceName, string endpointName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, endpointName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get DigitalTwinsInstance Endpoints. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDigitalTwinsEndpointOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get DigitalTwinsInstance Endpoints. + /// + /// + /// 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 IDigitalTwinsEndpointOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/DigitalTwinsOperations.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/DigitalTwinsOperations.cs new file mode 100644 index 000000000000..86f4945e1a42 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/DigitalTwinsOperations.cs @@ -0,0 +1,1807 @@ +// +// 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.DigitalTwins +{ + 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; + + /// + /// DigitalTwinsOperations operations. + /// + internal partial class DigitalTwinsOperations : IServiceOperations, IDigitalTwinsOperations + { + /// + /// Initializes a new instance of the DigitalTwinsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DigitalTwinsOperations(AzureDigitalTwinsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureDigitalTwinsManagementClient + /// + public AzureDigitalTwinsManagementClient Client { get; private set; } + + /// + /// Get DigitalTwinsInstances resource. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update the metadata of a DigitalTwinsInstance. The usual pattern + /// to modify a property is to retrieve the DigitalTwinsInstance and security + /// metadata, and then combine them with the modified values in a new body to + /// update the DigitalTwinsInstance. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// The DigitalTwinsInstance and security metadata. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, DigitalTwinsDescription digitalTwinsCreate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, digitalTwinsCreate, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update metadata of DigitalTwinsInstance. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Instance tags + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, tags, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete a DigitalTwinsInstance. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get all the DigitalTwinsInstances in a subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/digitalTwinsInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get all the DigitalTwinsInstances in a resource group. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// 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"); + } + // 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.DigitalTwins/digitalTwinsInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Check if a DigitalTwinsInstance name is available. + /// + /// + /// Location of DigitalTwinsInstance. + /// + /// + /// Resource 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> CheckNameAvailabilityWithHttpMessagesAsync(string location, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + CheckNameRequest digitalTwinsInstanceCheckName = new CheckNameRequest(); + if (name != null) + { + digitalTwinsInstanceCheckName.Name = name; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("digitalTwinsInstanceCheckName", digitalTwinsInstanceCheckName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/locations/{location}/checkNameAvailability").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + 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(digitalTwinsInstanceCheckName != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(digitalTwinsInstanceCheckName, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update the metadata of a DigitalTwinsInstance. The usual pattern + /// to modify a property is to retrieve the DigitalTwinsInstance and security + /// metadata, and then combine them with the modified values in a new body to + /// update the DigitalTwinsInstance. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// The DigitalTwinsInstance and security metadata. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, DigitalTwinsDescription digitalTwinsCreate, 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (digitalTwinsCreate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "digitalTwinsCreate"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("digitalTwinsCreate", digitalTwinsCreate); + 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.DigitalTwins/digitalTwinsInstances/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(digitalTwinsCreate != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(digitalTwinsCreate, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update metadata of DigitalTwinsInstance. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Instance tags + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + DigitalTwinsPatchDescription digitalTwinsPatchDescription = new DigitalTwinsPatchDescription(); + if (tags != null) + { + digitalTwinsPatchDescription.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("digitalTwinsPatchDescription", digitalTwinsPatchDescription); + 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.DigitalTwins/digitalTwinsInstances/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(digitalTwinsPatchDescription != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(digitalTwinsPatchDescription, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a DigitalTwinsInstance. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// 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> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new 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 == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get all the DigitalTwinsInstances in a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get all the DigitalTwinsInstances in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/DigitalTwinsOperationsExtensions.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/DigitalTwinsOperationsExtensions.cs new file mode 100644 index 000000000000..8f3722f3d63b --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/DigitalTwinsOperationsExtensions.cs @@ -0,0 +1,513 @@ +// +// 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.DigitalTwins +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DigitalTwinsOperations. + /// + public static partial class DigitalTwinsOperationsExtensions + { + /// + /// Get DigitalTwinsInstances resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + public static DigitalTwinsDescription Get(this IDigitalTwinsOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Get DigitalTwinsInstances resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDigitalTwinsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update the metadata of a DigitalTwinsInstance. The usual pattern + /// to modify a property is to retrieve the DigitalTwinsInstance and security + /// metadata, and then combine them with the modified values in a new body to + /// update the DigitalTwinsInstance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// The DigitalTwinsInstance and security metadata. + /// + public static DigitalTwinsDescription CreateOrUpdate(this IDigitalTwinsOperations operations, string resourceGroupName, string resourceName, DigitalTwinsDescription digitalTwinsCreate) + { + return operations.CreateOrUpdateAsync(resourceGroupName, resourceName, digitalTwinsCreate).GetAwaiter().GetResult(); + } + + /// + /// Create or update the metadata of a DigitalTwinsInstance. The usual pattern + /// to modify a property is to retrieve the DigitalTwinsInstance and security + /// metadata, and then combine them with the modified values in a new body to + /// update the DigitalTwinsInstance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// The DigitalTwinsInstance and security metadata. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDigitalTwinsOperations operations, string resourceGroupName, string resourceName, DigitalTwinsDescription digitalTwinsCreate, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, digitalTwinsCreate, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update metadata of DigitalTwinsInstance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Instance tags + /// + public static DigitalTwinsDescription Update(this IDigitalTwinsOperations operations, string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, resourceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Update metadata of DigitalTwinsInstance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Instance tags + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDigitalTwinsOperations operations, string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a DigitalTwinsInstance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + public static DigitalTwinsDescription Delete(this IDigitalTwinsOperations operations, string resourceGroupName, string resourceName) + { + return operations.DeleteAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Delete a DigitalTwinsInstance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDigitalTwinsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all the DigitalTwinsInstances in a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IDigitalTwinsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Get all the DigitalTwinsInstances in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDigitalTwinsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all the DigitalTwinsInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + public static IPage ListByResourceGroup(this IDigitalTwinsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Get all the DigitalTwinsInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IDigitalTwinsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Check if a DigitalTwinsInstance name is available. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Location of DigitalTwinsInstance. + /// + /// + /// Resource name. + /// + public static CheckNameResult CheckNameAvailability(this IDigitalTwinsOperations operations, string location, string name) + { + return operations.CheckNameAvailabilityAsync(location, name).GetAwaiter().GetResult(); + } + + /// + /// Check if a DigitalTwinsInstance name is available. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Location of DigitalTwinsInstance. + /// + /// + /// Resource name. + /// + /// + /// The cancellation token. + /// + public static async Task CheckNameAvailabilityAsync(this IDigitalTwinsOperations operations, string location, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(location, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update the metadata of a DigitalTwinsInstance. The usual pattern + /// to modify a property is to retrieve the DigitalTwinsInstance and security + /// metadata, and then combine them with the modified values in a new body to + /// update the DigitalTwinsInstance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// The DigitalTwinsInstance and security metadata. + /// + public static DigitalTwinsDescription BeginCreateOrUpdate(this IDigitalTwinsOperations operations, string resourceGroupName, string resourceName, DigitalTwinsDescription digitalTwinsCreate) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, resourceName, digitalTwinsCreate).GetAwaiter().GetResult(); + } + + /// + /// Create or update the metadata of a DigitalTwinsInstance. The usual pattern + /// to modify a property is to retrieve the DigitalTwinsInstance and security + /// metadata, and then combine them with the modified values in a new body to + /// update the DigitalTwinsInstance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// The DigitalTwinsInstance and security metadata. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IDigitalTwinsOperations operations, string resourceGroupName, string resourceName, DigitalTwinsDescription digitalTwinsCreate, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, digitalTwinsCreate, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update metadata of DigitalTwinsInstance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Instance tags + /// + public static DigitalTwinsDescription BeginUpdate(this IDigitalTwinsOperations operations, string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary)) + { + return operations.BeginUpdateAsync(resourceGroupName, resourceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Update metadata of DigitalTwinsInstance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Instance tags + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IDigitalTwinsOperations operations, string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a DigitalTwinsInstance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + public static DigitalTwinsDescription BeginDelete(this IDigitalTwinsOperations operations, string resourceGroupName, string resourceName) + { + return operations.BeginDeleteAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Delete a DigitalTwinsInstance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IDigitalTwinsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all the DigitalTwinsInstances in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDigitalTwinsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all the DigitalTwinsInstances in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IDigitalTwinsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all the DigitalTwinsInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IDigitalTwinsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all the DigitalTwinsInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IDigitalTwinsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/IAzureDigitalTwinsManagementClient.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/IAzureDigitalTwinsManagementClient.cs new file mode 100644 index 000000000000..120807e4f46f --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/IAzureDigitalTwinsManagementClient.cs @@ -0,0 +1,88 @@ +// +// 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.DigitalTwins +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// Azure Digital Twins Client for managing DigitalTwinsInstance + /// + public partial interface IAzureDigitalTwinsManagementClient : 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; } + + /// + /// Version of the DigitalTwinsInstance Management API. + /// + string ApiVersion { get; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IDigitalTwinsOperations. + /// + IDigitalTwinsOperations DigitalTwins { get; } + + /// + /// Gets the IDigitalTwinsEndpointOperations. + /// + IDigitalTwinsEndpointOperations DigitalTwinsEndpoint { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/IDigitalTwinsEndpointOperations.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/IDigitalTwinsEndpointOperations.cs new file mode 100644 index 000000000000..2ee03dcf8eaa --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/IDigitalTwinsEndpointOperations.cs @@ -0,0 +1,226 @@ +// +// 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.DigitalTwins +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DigitalTwinsEndpointOperations operations. + /// + public partial interface IDigitalTwinsEndpointOperations + { + /// + /// Get DigitalTwinsInstance Endpoints. + /// + /// + /// The name of the resource group that contains the + /// DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// 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 resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get DigitalTwinsInstances Endpoint. + /// + /// + /// The name of the resource group that contains the + /// DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string endpointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update DigitalTwinsInstance endpoint. + /// + /// + /// The name of the resource group that contains the + /// DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + /// + /// DigitalTwinsInstance endpoint resource properties. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string endpointName, DigitalTwinsEndpointResourceProperties properties = default(DigitalTwinsEndpointResourceProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a DigitalTwinsInstance endpoint. + /// + /// + /// The name of the resource group that contains the + /// DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string endpointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update DigitalTwinsInstance endpoint. + /// + /// + /// The name of the resource group that contains the + /// DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + /// + /// DigitalTwinsInstance endpoint resource properties. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string endpointName, DigitalTwinsEndpointResourceProperties properties = default(DigitalTwinsEndpointResourceProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a DigitalTwinsInstance endpoint. + /// + /// + /// The name of the resource group that contains the + /// DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Name of Endpoint Resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string endpointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get DigitalTwinsInstance Endpoints. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/IDigitalTwinsOperations.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/IDigitalTwinsOperations.cs new file mode 100644 index 000000000000..2d24d6b53612 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/IDigitalTwinsOperations.cs @@ -0,0 +1,340 @@ +// +// 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.DigitalTwins +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DigitalTwinsOperations operations. + /// + public partial interface IDigitalTwinsOperations + { + /// + /// Get DigitalTwinsInstances resource. + /// + /// + /// The name of the resource group that contains the + /// DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update the metadata of a DigitalTwinsInstance. The usual + /// pattern to modify a property is to retrieve the + /// DigitalTwinsInstance and security metadata, and then combine them + /// with the modified values in a new body to update the + /// DigitalTwinsInstance. + /// + /// + /// The name of the resource group that contains the + /// DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// The DigitalTwinsInstance and security metadata. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, DigitalTwinsDescription digitalTwinsCreate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update metadata of DigitalTwinsInstance. + /// + /// + /// The name of the resource group that contains the + /// DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Instance tags + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a DigitalTwinsInstance. + /// + /// + /// The name of the resource group that contains the + /// DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// 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> DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all the DigitalTwinsInstances in a subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all the DigitalTwinsInstances in a resource group. + /// + /// + /// The name of the resource group that contains the + /// DigitalTwinsInstance. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Check if a DigitalTwinsInstance name is available. + /// + /// + /// Location of DigitalTwinsInstance. + /// + /// + /// Resource 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> CheckNameAvailabilityWithHttpMessagesAsync(string location, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update the metadata of a DigitalTwinsInstance. The usual + /// pattern to modify a property is to retrieve the + /// DigitalTwinsInstance and security metadata, and then combine them + /// with the modified values in a new body to update the + /// DigitalTwinsInstance. + /// + /// + /// The name of the resource group that contains the + /// DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// The DigitalTwinsInstance and security metadata. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, DigitalTwinsDescription digitalTwinsCreate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update metadata of DigitalTwinsInstance. + /// + /// + /// The name of the resource group that contains the + /// DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// Instance tags + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a DigitalTwinsInstance. + /// + /// + /// The name of the resource group that contains the + /// DigitalTwinsInstance. + /// + /// + /// The name of the DigitalTwinsInstance. + /// + /// + /// 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> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all the DigitalTwinsInstances in a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all the DigitalTwinsInstances in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/IOperations.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/IOperations.cs new file mode 100644 index 000000000000..5dca539fe10d --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/IOperations.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DigitalTwins +{ + 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 DigitalTwins service REST API + /// operations. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the available DigitalTwins service REST API + /// operations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/CheckNameRequest.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/CheckNameRequest.cs new file mode 100644 index 000000000000..6d251e788d98 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/CheckNameRequest.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.DigitalTwins.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The result returned from a database check name availability request. + /// + public partial class CheckNameRequest + { + /// + /// Initializes a new instance of the CheckNameRequest class. + /// + public CheckNameRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckNameRequest class. + /// + /// Resource name. + public CheckNameRequest(string name) + { + Name = name; + CustomInit(); + } + /// + /// Static constructor for CheckNameRequest class. + /// + static CheckNameRequest() + { + Type = "Microsoft.DigitalTwins/digitalTwinsInstances"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// The type of resource, for instance + /// Microsoft.DigitalTwins/digitalTwinsInstances. + /// + [JsonProperty(PropertyName = "type")] + public static string Type { get; private set; } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/CheckNameResult.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/CheckNameResult.cs new file mode 100644 index 000000000000..c14e0b608428 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/CheckNameResult.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.DigitalTwins.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The result returned from a check name availability request. + /// + public partial class CheckNameResult + { + /// + /// Initializes a new instance of the CheckNameResult class. + /// + public CheckNameResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckNameResult class. + /// + /// Specifies a Boolean value that + /// indicates if the name is available. + /// The name that was checked. + /// Message indicating an unavailable name due to + /// a conflict, or a description of the naming rules that are + /// violated. + /// Message providing the reason why the given + /// name is invalid. Possible values include: 'Invalid', + /// 'AlreadyExists' + public CheckNameResult(bool? nameAvailable = default(bool?), string name = default(string), string message = default(string), string reason = default(string)) + { + NameAvailable = nameAvailable; + Name = name; + Message = message; + Reason = reason; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies a Boolean value that indicates if the name + /// is available. + /// + [JsonProperty(PropertyName = "nameAvailable")] + public bool? NameAvailable { get; set; } + + /// + /// Gets or sets the name that was checked. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets message indicating an unavailable name due to a + /// conflict, or a description of the naming rules that are violated. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets message providing the reason why the given name is + /// invalid. Possible values include: 'Invalid', 'AlreadyExists' + /// + [JsonProperty(PropertyName = "reason")] + public string Reason { get; set; } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsDescription.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsDescription.cs new file mode 100644 index 000000000000..cdb642bdf5eb --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsDescription.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.DigitalTwins.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The description of the DigitalTwins service. + /// + [Rest.Serialization.JsonTransformation] + public partial class DigitalTwinsDescription : DigitalTwinsResource + { + /// + /// Initializes a new instance of the DigitalTwinsDescription class. + /// + public DigitalTwinsDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DigitalTwinsDescription class. + /// + /// The resource location. + /// The resource identifier. + /// The resource name. + /// The resource type. + /// The resource tags. + /// Time when DigitalTwinsInstance was + /// created. + /// Time when DigitalTwinsInstance was + /// created. + /// The provisioning state. Possible + /// values include: 'Provisioning', 'Deleting', 'Succeeded', 'Failed', + /// 'Canceled' + /// Api endpoint to work with + /// DigitalTwinsInstance. + public DigitalTwinsDescription(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), System.DateTime? createdTime = default(System.DateTime?), System.DateTime? lastUpdatedTime = default(System.DateTime?), string provisioningState = default(string), string hostName = default(string)) + : base(location, id, name, type, tags) + { + CreatedTime = createdTime; + LastUpdatedTime = lastUpdatedTime; + ProvisioningState = provisioningState; + HostName = hostName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets time when DigitalTwinsInstance was created. + /// + [JsonProperty(PropertyName = "properties.createdTime")] + public System.DateTime? CreatedTime { get; private set; } + + /// + /// Gets time when DigitalTwinsInstance was created. + /// + [JsonProperty(PropertyName = "properties.lastUpdatedTime")] + public System.DateTime? LastUpdatedTime { get; private set; } + + /// + /// Gets the provisioning state. Possible values include: + /// 'Provisioning', 'Deleting', 'Succeeded', 'Failed', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets api endpoint to work with DigitalTwinsInstance. + /// + [JsonProperty(PropertyName = "properties.hostName")] + public string HostName { get; private set; } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsEndpointResource.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsEndpointResource.cs new file mode 100644 index 000000000000..97ca77b60b4e --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsEndpointResource.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DigitalTwins.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// DigitalTwinsInstance endpoint resource. + /// + public partial class DigitalTwinsEndpointResource : IResource + { + /// + /// Initializes a new instance of the DigitalTwinsEndpointResource + /// class. + /// + public DigitalTwinsEndpointResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DigitalTwinsEndpointResource + /// class. + /// + /// DigitalTwinsInstance endpoint resource + /// properties. + public DigitalTwinsEndpointResource(DigitalTwinsEndpointResourceProperties properties = default(DigitalTwinsEndpointResourceProperties)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets digitalTwinsInstance endpoint resource properties. + /// + [JsonProperty(PropertyName = "properties")] + public DigitalTwinsEndpointResourceProperties Properties { get; set; } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsEndpointResourceProperties.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsEndpointResourceProperties.cs new file mode 100644 index 000000000000..1aa34605697f --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsEndpointResourceProperties.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DigitalTwins.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties related to Digital Twins Endpoint + /// + [Newtonsoft.Json.JsonObject("DigitalTwinsEndpointResourceProperties")] + public partial class DigitalTwinsEndpointResourceProperties + { + /// + /// Initializes a new instance of the + /// DigitalTwinsEndpointResourceProperties class. + /// + public DigitalTwinsEndpointResourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// DigitalTwinsEndpointResourceProperties class. + /// + /// The provisioning state. Possible + /// values include: 'Provisioning', 'Deleting', 'Succeeded', 'Failed', + /// 'Canceled' + /// Time when the Endpoint was added to + /// DigitalTwinsInstance. + /// The resource tags. + public DigitalTwinsEndpointResourceProperties(string provisioningState = default(string), System.DateTime? createdTime = default(System.DateTime?), IDictionary tags = default(IDictionary)) + { + ProvisioningState = provisioningState; + CreatedTime = createdTime; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the provisioning state. Possible values include: + /// 'Provisioning', 'Deleting', 'Succeeded', 'Failed', 'Canceled' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets time when the Endpoint was added to DigitalTwinsInstance. + /// + [JsonProperty(PropertyName = "createdTime")] + public System.DateTime? CreatedTime { get; private set; } + + /// + /// Gets or sets the resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsPatchDescription.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsPatchDescription.cs new file mode 100644 index 000000000000..cc0e1f7570d1 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsPatchDescription.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DigitalTwins.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The description of the DigitalTwins service. + /// + public partial class DigitalTwinsPatchDescription + { + /// + /// Initializes a new instance of the DigitalTwinsPatchDescription + /// class. + /// + public DigitalTwinsPatchDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DigitalTwinsPatchDescription + /// class. + /// + /// Instance tags + public DigitalTwinsPatchDescription(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets instance tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsResource.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsResource.cs new file mode 100644 index 000000000000..4769757c70fb --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsResource.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.DigitalTwins.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The common properties of a DigitalTwinsInstance. + /// + public partial class DigitalTwinsResource : IResource + { + /// + /// Initializes a new instance of the DigitalTwinsResource class. + /// + public DigitalTwinsResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DigitalTwinsResource class. + /// + /// The resource location. + /// The resource identifier. + /// The resource name. + /// The resource type. + /// The resource tags. + public DigitalTwinsResource(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(); + } + /// + /// Static constructor for DigitalTwinsResource class. + /// + static DigitalTwinsResource() + { + Sku = new DigitalTwinsSkuInfo(); + } + + /// + /// 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; } + + /// + /// This property is reserved for future use, and will be + /// ignored/omitted + /// + [JsonProperty(PropertyName = "sku")] + public static DigitalTwinsSkuInfo Sku { get; private set; } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsSkuInfo.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsSkuInfo.cs new file mode 100644 index 000000000000..17e2eb078725 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/DigitalTwinsSkuInfo.cs @@ -0,0 +1,49 @@ +// +// 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.DigitalTwins.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about the SKU of the DigitalTwinsInstance. + /// + public partial class DigitalTwinsSkuInfo + { + /// + /// Initializes a new instance of the DigitalTwinsSkuInfo class. + /// + public DigitalTwinsSkuInfo() + { + CustomInit(); + } + + /// + /// Static constructor for DigitalTwinsSkuInfo class. + /// + static DigitalTwinsSkuInfo() + { + Name = "F1"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// The name of the SKU. + /// + [JsonProperty(PropertyName = "name")] + public static string Name { get; private set; } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/EndpointProvisioningState.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/EndpointProvisioningState.cs new file mode 100644 index 000000000000..9c76355196d0 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/EndpointProvisioningState.cs @@ -0,0 +1,25 @@ +// +// 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.DigitalTwins.Models +{ + + /// + /// Defines values for EndpointProvisioningState. + /// + public static class EndpointProvisioningState + { + public const string Provisioning = "Provisioning"; + public const string Deleting = "Deleting"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Canceled = "Canceled"; + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ErrorDefinition.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ErrorDefinition.cs new file mode 100644 index 000000000000..693cf2f903db --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ErrorDefinition.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DigitalTwins.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Error definition. + /// + public partial class ErrorDefinition + { + /// + /// Initializes a new instance of the ErrorDefinition class. + /// + public ErrorDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDefinition class. + /// + /// Service specific error code which serves as the + /// substatus for the HTTP error code. + /// Description of the error. + /// Internal error details. + public ErrorDefinition(string code = default(string), string message = default(string), IList details = default(IList)) + { + Code = code; + Message = message; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets service specific error code which serves as the substatus for + /// the HTTP error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets description of the error. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets internal error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ErrorResponse.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..fe2f7be48a6a --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ErrorResponse.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.DigitalTwins.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error response. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// Error description + public ErrorResponse(ErrorDefinition error = default(ErrorDefinition)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error description + /// + [JsonProperty(PropertyName = "error")] + public ErrorDefinition Error { get; set; } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ErrorResponseException.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..6c76c75acad9 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DigitalTwins.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/EventGrid.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/EventGrid.cs new file mode 100644 index 000000000000..7a849de2c215 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/EventGrid.cs @@ -0,0 +1,81 @@ +// +// 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.DigitalTwins.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// properties related to eventgrid. + /// + [Newtonsoft.Json.JsonObject("EventGrid")] + public partial class EventGrid : DigitalTwinsEndpointResourceProperties + { + /// + /// Initializes a new instance of the EventGrid class. + /// + public EventGrid() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EventGrid class. + /// + /// EventGrid secondary accesskey. Will be + /// obfuscated during read + /// EventGrid secondary accesskey. Will be + /// obfuscated during read + /// The provisioning state. Possible + /// values include: 'Provisioning', 'Deleting', 'Succeeded', 'Failed', + /// 'Canceled' + /// Time when the Endpoint was added to + /// DigitalTwinsInstance. + /// The resource tags. + /// EventGrid Topic Endpoint + public EventGrid(string accessKey1, string accessKey2, string provisioningState = default(string), System.DateTime? createdTime = default(System.DateTime?), IDictionary tags = default(IDictionary), string topicEndpoint = default(string)) + : base(provisioningState, createdTime, tags) + { + TopicEndpoint = topicEndpoint; + AccessKey1 = accessKey1; + AccessKey2 = accessKey2; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets eventGrid Topic Endpoint + /// + [JsonProperty(PropertyName = "TopicEndpoint")] + public string TopicEndpoint { get; set; } + + /// + /// Gets or sets eventGrid secondary accesskey. Will be obfuscated + /// during read + /// + [JsonProperty(PropertyName = "accessKey1")] + public string AccessKey1 { get; set; } + + /// + /// Gets or sets eventGrid secondary accesskey. Will be obfuscated + /// during read + /// + [JsonProperty(PropertyName = "accessKey2")] + public string AccessKey2 { get; set; } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/EventHub.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/EventHub.cs new file mode 100644 index 000000000000..9c5bb217f6fb --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/EventHub.cs @@ -0,0 +1,74 @@ +// +// 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.DigitalTwins.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// properties related to eventhub. + /// + [Newtonsoft.Json.JsonObject("EventHub")] + public partial class EventHub : DigitalTwinsEndpointResourceProperties + { + /// + /// Initializes a new instance of the EventHub class. + /// + public EventHub() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EventHub class. + /// + /// PrimaryConnectionString of + /// the endpoint. Will be obfuscated during read + /// SecondaryConnectionString of + /// the endpoint. Will be obfuscated during read + /// The provisioning state. Possible + /// values include: 'Provisioning', 'Deleting', 'Succeeded', 'Failed', + /// 'Canceled' + /// Time when the Endpoint was added to + /// DigitalTwinsInstance. + /// The resource tags. + public EventHub(string connectionStringPrimaryKey, string connectionStringSecondaryKey, string provisioningState = default(string), System.DateTime? createdTime = default(System.DateTime?), IDictionary tags = default(IDictionary)) + : base(provisioningState, createdTime, tags) + { + ConnectionStringPrimaryKey = connectionStringPrimaryKey; + ConnectionStringSecondaryKey = connectionStringSecondaryKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets primaryConnectionString of the endpoint. Will be + /// obfuscated during read + /// + [JsonProperty(PropertyName = "connectionString-PrimaryKey")] + public string ConnectionStringPrimaryKey { get; set; } + + /// + /// Gets or sets secondaryConnectionString of the endpoint. Will be + /// obfuscated during read + /// + [JsonProperty(PropertyName = "connectionString-SecondaryKey")] + public string ConnectionStringSecondaryKey { get; set; } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ExternalResource.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ExternalResource.cs new file mode 100644 index 000000000000..48ee169735c7 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ExternalResource.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.DigitalTwins.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Definition of a Resource. + /// + public partial class ExternalResource + { + /// + /// Initializes a new instance of the ExternalResource class. + /// + public ExternalResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExternalResource class. + /// + /// The resource identifier. + /// Extension resource name. + /// The resource type. + public ExternalResource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the resource identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets extension resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/Operation.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/Operation.cs new file mode 100644 index 000000000000..d7866a22c01e --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/Operation.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DigitalTwins.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// DigitalTwins service REST API operation + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + /// Operation name: {provider}/{resource}/{read | + /// write | action | delete} + /// Operation properties display + 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 operation properties display + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/OperationDisplay.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..cba23a60a0a7 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DigitalTwins.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 + /// DigitalTwins + /// Resource Type: DigitalTwinsInstances + /// Name of the operation + /// Friendly description for the + /// operation, + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets service provider: Microsoft DigitalTwins + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; private set; } + + /// + /// Gets resource Type: DigitalTwinsInstances + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; private set; } + + /// + /// Gets name of the operation + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; private set; } + + /// + /// Gets friendly description for the operation, + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/Page.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/Page.cs new file mode 100644 index 000000000000..2bcc9235fa19 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/Page.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DigitalTwins.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ProvisioningState.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..fdbb4e6b2642 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,25 @@ +// +// 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.DigitalTwins.Models +{ + + /// + /// Defines values for ProvisioningState. + /// + public static class ProvisioningState + { + public const string Provisioning = "Provisioning"; + public const string Deleting = "Deleting"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Canceled = "Canceled"; + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/Reason.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/Reason.cs new file mode 100644 index 000000000000..16e8938f0902 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/Reason.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.DigitalTwins.Models +{ + + /// + /// Defines values for Reason. + /// + public static class Reason + { + public const string Invalid = "Invalid"; + public const string AlreadyExists = "AlreadyExists"; + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ServiceBus.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ServiceBus.cs new file mode 100644 index 000000000000..a4c6ac3f9197 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Models/ServiceBus.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DigitalTwins.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// properties related to servicebus. + /// + [Newtonsoft.Json.JsonObject("ServiceBus")] + public partial class ServiceBus : DigitalTwinsEndpointResourceProperties + { + /// + /// Initializes a new instance of the ServiceBus class. + /// + public ServiceBus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceBus class. + /// + /// PrimaryConnectionString of + /// the endpoint. Will be obfuscated during read + /// SecondaryConnectionString + /// of the endpoint. Will be obfuscated during read + /// The provisioning state. Possible + /// values include: 'Provisioning', 'Deleting', 'Succeeded', 'Failed', + /// 'Canceled' + /// Time when the Endpoint was added to + /// DigitalTwinsInstance. + /// The resource tags. + public ServiceBus(string primaryConnectionString, string secondaryConnectionString, string provisioningState = default(string), System.DateTime? createdTime = default(System.DateTime?), IDictionary tags = default(IDictionary)) + : base(provisioningState, createdTime, tags) + { + PrimaryConnectionString = primaryConnectionString; + SecondaryConnectionString = secondaryConnectionString; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets primaryConnectionString of the endpoint. Will be + /// obfuscated during read + /// + [JsonProperty(PropertyName = "primaryConnectionString")] + public string PrimaryConnectionString { get; set; } + + /// + /// Gets or sets secondaryConnectionString of the endpoint. Will be + /// obfuscated during read + /// + [JsonProperty(PropertyName = "secondaryConnectionString")] + public string SecondaryConnectionString { get; set; } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Operations.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Operations.cs new file mode 100644 index 000000000000..47fa51cfbc8f --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/Operations.cs @@ -0,0 +1,380 @@ +// +// 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.DigitalTwins +{ + 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(AzureDigitalTwinsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureDigitalTwinsManagementClient + /// + public AzureDigitalTwinsManagementClient Client { get; private set; } + + /// + /// Lists all of the available DigitalTwins service REST API operations. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.DigitalTwins/operations").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the available DigitalTwins service REST API operations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/OperationsExtensions.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..be72a50cc9dd --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/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.DigitalTwins +{ + 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 DigitalTwins service REST API operations. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available DigitalTwins service REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the available DigitalTwins service REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available DigitalTwins service REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/SdkInfo_AzureDigitalTwinsManagementClient.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/SdkInfo_AzureDigitalTwinsManagementClient.cs new file mode 100644 index 000000000000..39cba73f5d2f --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Generated/SdkInfo_AzureDigitalTwinsManagementClient.cs @@ -0,0 +1,29 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DigitalTwins +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_AzureDigitalTwinsManagementClient + { + get + { + return new Tuple[] + { + new Tuple("DigitalTwins", "DigitalTwins", "2020-03-01-preview"), + new Tuple("DigitalTwins", "DigitalTwinsEndpoint", "2020-03-01-preview"), + new Tuple("DigitalTwins", "Operations", "2020-03-01-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Microsoft.Azure.Management.DigitalTwins.csproj b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Microsoft.Azure.Management.DigitalTwins.csproj new file mode 100644 index 000000000000..6b67d6e3eb6e --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/Microsoft.Azure.Management.DigitalTwins.csproj @@ -0,0 +1,25 @@ + + + + + + + Microsoft.Azure.Management.DigitalTwins + Provides management capabilities for Microsoft Azure Digital Twins. + Microsoft Azure DigitalTwins Management + Microsoft.Azure.Management.DigitalTwins + 1.0.0-preview.1 + Microsoft Azure DigitalTwins;DigitalTwins management;DigitalTwins; + Initial DigitalTwins 2020-03-01-preview management SDK release + + + $(SdkTargetFx) + + + + + + + + + diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/generate.ps1 b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/generate.ps1 new file mode 100644 index 000000000000..a552581332f3 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/src/generate.ps1 @@ -0,0 +1 @@ +Start-AutoRestCodeGeneration -ResourceProvider "digitaltwins/resource-manager" -AutoRestVersion "v2" diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/Helpers/DigitalTwinsTestUtilities.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/Helpers/DigitalTwinsTestUtilities.cs new file mode 100644 index 000000000000..5a7fdb3fe357 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/Helpers/DigitalTwinsTestUtilities.cs @@ -0,0 +1,32 @@ +namespace DigitalTwins.Tests.Helpers +{ + + using Microsoft.Azure.Management.DigitalTwins; + using Microsoft.Azure.Management.ResourceManager; + using Microsoft.Rest.ClientRuntime.Azure.TestFramework; + using System.Net; + class DigitalTwinsTestUtilities + { + public static string DefaultLocation = "westus2"; + public static string DefaultInstanceName = "DigitalTwinsSDK"; + public static string DefaultEndpointName = "DigitalTwinsSDKEndpoint"; + public static string DefaultResourceGroupName = "DigitalTwinsSDKResourceGroup"; + + public static AzureDigitalTwinsManagementClient GetDigitalTwinsClient(MockContext context, RecordedDelegatingHandler handler = null) + { + if (handler != null) + { + handler.IsPassThrough = true; + } + + return context.GetServiceClient(handlers: handler ?? new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }); + } + + public static ResourceManagementClient GetResourceManagementClient(MockContext context, RecordedDelegatingHandler handler) + { + handler.IsPassThrough = true; + var client = context.GetServiceClient(handlers: handler); + return client; + } + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/Helpers/RecordedDelegatingHandler.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/Helpers/RecordedDelegatingHandler.cs new file mode 100644 index 000000000000..4c6d04958196 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/Helpers/RecordedDelegatingHandler.cs @@ -0,0 +1,87 @@ +namespace DigitalTwins.Tests.Helpers +{ + using System; + using System.Net; + using System.Net.Http; + using System.Net.Http.Headers; + using System.Threading.Tasks; + + 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/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/Microsoft.Azure.Management.DigitalTwins.Tests.csproj b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/Microsoft.Azure.Management.DigitalTwins.Tests.csproj new file mode 100644 index 000000000000..fc63b659c075 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/Microsoft.Azure.Management.DigitalTwins.Tests.csproj @@ -0,0 +1,31 @@ + + + + DigitalTwins.Tests + DigitalTwins.Tests Class Library + DigitalTwins.Tests + 2020-03-01-preview + + + false + false + + + + + + + + + PreserveNewest + + + + + + + + + + + \ No newline at end of file diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/ScenarioTests/DigitalTwinsLifecycleTests.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/ScenarioTests/DigitalTwinsLifecycleTests.cs new file mode 100644 index 000000000000..9412f986c0b1 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/ScenarioTests/DigitalTwinsLifecycleTests.cs @@ -0,0 +1,97 @@ +namespace DigitalTwins.Tests.ScenarioTests +{ + using System; + using System.Collections.Generic; + using System.Linq; + using DigitalTwins.Tests.Helpers; + using Microsoft.Azure.Management.DigitalTwins; + using Microsoft.Azure.Management.DigitalTwins.Models; + using Microsoft.Rest.ClientRuntime.Azure.TestFramework; + using Xunit; + + public class DigitalTwinsLifecycleTests: DigitalTwinsTestBase + { + [Fact] + public void TestDigitalTwinsLifecycle() + { + using (MockContext context = MockContext.Start(this.GetType())) + { + + var digitalTwinsDescription = new DigitalTwinsDescription() + { + Location = location, + }; + + this.Initialize(context); + + // Create Resource Group + var resourceGroup = this.CreateResourceGroup(DigitalTwinsTestUtilities.DefaultResourceGroupName); + + // Check if instance exists and delete + var digitalTwinsAvailability = this.digitalTwinsClient.DigitalTwins.CheckNameAvailability(DigitalTwinsTestUtilities.DefaultLocation, DigitalTwinsTestUtilities.DefaultInstanceName); + + if (!(bool)digitalTwinsAvailability.NameAvailable) + { + this.digitalTwinsClient.DigitalTwins.Delete( + DigitalTwinsTestUtilities.DefaultResourceGroupName, + DigitalTwinsTestUtilities.DefaultInstanceName); + + digitalTwinsAvailability = this.digitalTwinsClient.DigitalTwins.CheckNameAvailability(DigitalTwinsTestUtilities.DefaultLocation, DigitalTwinsTestUtilities.DefaultInstanceName); + Assert.True(digitalTwinsAvailability.NameAvailable); + } + + // Create DigitalTwins resource + var digitalTwinsInstance = this.CreateDigitalTwinsInstance(resourceGroup, DigitalTwinsTestUtilities.DefaultLocation, DigitalTwinsTestUtilities.DefaultInstanceName); + + Assert.NotNull(digitalTwinsInstance); + Assert.Equal(DigitalTwinsTestUtilities.DefaultInstanceName, digitalTwinsInstance.Name); + Assert.Equal(DigitalTwinsTestUtilities.DefaultLocation, digitalTwinsInstance.Location); + + // Add and Get Tags + IDictionary tags = new Dictionary(); + tags.Add("key1", "value1"); + tags.Add("key2", "value2"); + digitalTwinsInstance = this.digitalTwinsClient.DigitalTwins.Update(DigitalTwinsTestUtilities.DefaultResourceGroupName, DigitalTwinsTestUtilities.DefaultInstanceName, tags); + + Assert.NotNull(digitalTwinsInstance); + Assert.True(digitalTwinsInstance.Tags.Count().Equals(2)); + Assert.Equal("value2", digitalTwinsInstance.Tags["key2"]); + + // List DigitalTwins instances in Resource Group + var twinsResources = this.digitalTwinsClient.DigitalTwins.ListByResourceGroup(DigitalTwinsTestUtilities.DefaultResourceGroupName); + Assert.True(twinsResources.Count() > 0); + + // Get all of the available operations, ensure CRUD + var operationList = this.digitalTwinsClient.Operations.List(); + Assert.True(operationList.Count() > 0); + Assert.Contains(operationList, e => e.Name.Equals($"Microsoft.DigitalTwins/digitalTwinsInstances/read", StringComparison.OrdinalIgnoreCase)); + Assert.Contains(operationList, e => e.Name.Equals($"Microsoft.DigitalTwins/digitalTwinsInstances/write", StringComparison.OrdinalIgnoreCase)); + Assert.Contains(operationList, e => e.Name.Equals($"Microsoft.DigitalTwins/digitalTwinsInstances/delete", StringComparison.OrdinalIgnoreCase)); + + // Get other operations + + // Register Operation + var registerOperations = operationList.Where(e => e.Name.Contains($"Microsoft.DigitalTwins/register")); + Assert.True(registerOperations.Count() > 0); + + // Twin Operations + var twinOperations = operationList.Where(e => e.Name.Contains($"Microsoft.DigitalTwins/digitaltwins")); + Assert.True(twinOperations.Count() > 0); + + // Event Route Operations + var eventRouteOperations = operationList.Where(e => e.Name.Contains($"Microsoft.DigitalTwins/eventroutes")); + Assert.True(eventRouteOperations.Count() > 0); + + // Model operations + var modelOperations = operationList.Where(e => e.Name.Contains($"Microsoft.DigitalTwins/models")); + Assert.True(modelOperations.Count() > 0); + + // Delete instance + var deleteOp = this.digitalTwinsClient.DigitalTwins.BeginDelete(DigitalTwinsTestUtilities.DefaultResourceGroupName, DigitalTwinsTestUtilities.DefaultInstanceName); + Assert.True(deleteOp.ProvisioningState == ProvisioningState.Deleting); + + } + } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/ScenarioTests/DigitalTwinsTestBase.cs b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/ScenarioTests/DigitalTwinsTestBase.cs new file mode 100644 index 000000000000..0a4454676800 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/ScenarioTests/DigitalTwinsTestBase.cs @@ -0,0 +1,92 @@ +namespace DigitalTwins.Tests.ScenarioTests +{ + using DigitalTwins.Tests.Helpers; + using Microsoft.Azure.Management.ResourceManager; + using Microsoft.Azure.Management.ResourceManager.Models; + using Microsoft.Azure.Management.DigitalTwins; + using Microsoft.Azure.Management.DigitalTwins.Models; + using Microsoft.Rest.ClientRuntime.Azure.TestFramework; + using System; + using System.Reflection; + using System.Net; + public class DigitalTwinsTestBase + { + protected ResourceManagementClient resourcesClient; + protected AzureDigitalTwinsManagementClient digitalTwinsClient; + + protected bool initialized = false; + protected object locker = new object(); + protected string location; + protected TestEnvironment testEnv; + + protected void Initialize(MockContext context) + { + if (!initialized) + { + lock (locker) + { + if (!initialized) + { + testEnv = TestEnvironmentFactory.GetTestEnvironment(); + resourcesClient = DigitalTwinsTestUtilities.GetResourceManagementClient(context, new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }); + digitalTwinsClient = DigitalTwinsTestUtilities.GetDigitalTwinsClient(context, new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }); + + if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("AZURE_VM_TEST_LOCATION"))) + { + location = DigitalTwinsTestUtilities.DefaultLocation; + } + else + { + location = Environment.GetEnvironmentVariable("AZURE_VM_TEST_LOCATION").Replace(" ", "").ToLower(); + } + + this.initialized = true; + } + } + } + } + + protected DigitalTwinsDescription CreateDigitalTwinsInstance(ResourceGroup resourceGroup, string location, string digitalTwinsInstanceName) + { + var digitalTwinsDescription = new DigitalTwinsDescription() + { + Location = location, + }; + + PropertyInfo sku = digitalTwinsDescription.GetType().BaseType.GetProperty("Sku"); + DigitalTwinsSkuInfo newSku = new DigitalTwinsSkuInfo(); + newSku.GetType().GetProperty("Name").SetValue(newSku, "S1"); + sku.SetValue(digitalTwinsDescription, newSku); + + return this.digitalTwinsClient.DigitalTwins.CreateOrUpdate( + resourceGroup.Name, + digitalTwinsInstanceName, + digitalTwinsDescription + ); + } + protected DigitalTwinsDescription UpdateDigitalTwinsInstance(ResourceGroup resourceGroup, DigitalTwinsDescription digitalTwinsDescription, string digitalTwinsInstanceName) + { + return this.digitalTwinsClient.DigitalTwins.CreateOrUpdate( + resourceGroup.Name, + digitalTwinsInstanceName, + digitalTwinsDescription + ); + } + + + protected ResourceGroup CreateResourceGroup(string resourceGroupName) + { + return this.resourcesClient.ResourceGroups.CreateOrUpdate(resourceGroupName, + new ResourceGroup + { + Location = DigitalTwinsTestUtilities.DefaultLocation + }); + } + + protected void DeleteResourceGroup(string resourceGroupName) + { + this.resourcesClient.ResourceGroups.Delete(resourceGroupName); + } + + } +} diff --git a/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/SessionRecords/DigitalTwinsLifecycleTests/TestDigitalTwinsLifecycle.json b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/SessionRecords/DigitalTwinsLifecycleTests/TestDigitalTwinsLifecycle.json new file mode 100644 index 000000000000..6a14f072c1a2 --- /dev/null +++ b/sdk/digitaltwins/Microsoft.Azure.Management.DigitalTwins/tests/SessionRecords/DigitalTwinsLifecycleTests/TestDigitalTwinsLifecycle.json @@ -0,0 +1,602 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/resourcegroups/DigitalTwinsSDKResourceGroup?api-version=2019-10-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMDBmODc1NzktNzMyMy00OTliLWJjNzItYzFmZWRkNDM5OTNkL3Jlc291cmNlZ3JvdXBzL0RpZ2l0YWxUd2luc1NES1Jlc291cmNlR3JvdXA/YXBpLXZlcnNpb249MjAxOS0xMC0wMQ==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"westus2\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "22c89b7b-4cdb-48ce-803e-552c69b42b85" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28516.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19635.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.7.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "29" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "55422f38-1d17-46ec-a858-a2c96db698ad" + ], + "x-ms-correlation-request-id": [ + "55422f38-1d17-46ec-a858-a2c96db698ad" + ], + "x-ms-routing-request-id": [ + "CANADAEAST:20200605T024053Z:55422f38-1d17-46ec-a858-a2c96db698ad" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 05 Jun 2020 02:40:53 GMT" + ], + "Content-Length": [ + "254" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/resourceGroups/DigitalTwinsSDKResourceGroup\",\r\n \"name\": \"DigitalTwinsSDKResourceGroup\",\r\n \"type\": \"Microsoft.Resources/resourceGroups\",\r\n \"location\": \"westus2\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/providers/Microsoft.DigitalTwins/locations/westus2/checkNameAvailability?api-version=2020-03-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMDBmODc1NzktNzMyMy00OTliLWJjNzItYzFmZWRkNDM5OTNkL3Byb3ZpZGVycy9NaWNyb3NvZnQuRGlnaXRhbFR3aW5zL2xvY2F0aW9ucy93ZXN0dXMyL2NoZWNrTmFtZUF2YWlsYWJpbGl0eT9hcGktdmVyc2lvbj0yMDIwLTAzLTAxLXByZXZpZXc=", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"name\": \"DigitalTwinsSDK\",\r\n \"type\": \"Microsoft.DigitalTwins/digitalTwinsInstances\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "7cab2081-4bb0-484c-ae39-7c8b6303cb5a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28516.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19635.", + "Microsoft.Azure.Management.DigitalTwins.AzureDigitalTwinsManagementClient/0.1.0.preview" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "92" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "358219a0-7d18-48cf-9969-89f7261c63a3" + ], + "x-ms-correlation-request-id": [ + "358219a0-7d18-48cf-9969-89f7261c63a3" + ], + "x-ms-routing-request-id": [ + "CANADAEAST:20200605T024054Z:358219a0-7d18-48cf-9969-89f7261c63a3" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 05 Jun 2020 02:40:54 GMT" + ], + "Content-Length": [ + "91" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"nameAvailable\": true,\r\n \"reason\": \"NameIsAvailable\",\r\n \"message\": \"DigitalTwinsSDK is available.\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/resourceGroups/DigitalTwinsSDKResourceGroup/providers/Microsoft.DigitalTwins/digitalTwinsInstances/DigitalTwinsSDK?api-version=2020-03-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMDBmODc1NzktNzMyMy00OTliLWJjNzItYzFmZWRkNDM5OTNkL3Jlc291cmNlR3JvdXBzL0RpZ2l0YWxUd2luc1NES1Jlc291cmNlR3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EaWdpdGFsVHdpbnMvZGlnaXRhbFR3aW5zSW5zdGFuY2VzL0RpZ2l0YWxUd2luc1NESz9hcGktdmVyc2lvbj0yMDIwLTAzLTAxLXByZXZpZXc=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"sku\": {\r\n \"name\": \"S1\"\r\n },\r\n \"location\": \"westus2\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "21501295-45db-4fb8-9441-4453e569fcfb" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28516.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19635.", + "Microsoft.Azure.Management.DigitalTwins.AzureDigitalTwinsManagementClient/0.1.0.preview" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "65" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/resourceGroups/DigitalTwinsSDKResourceGroup/providers/Microsoft.DigitalTwins/digitalTwinsInstances/DigitalTwinsSDK?api-version=2020-03-01-preview" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/resourceGroups/DigitalTwinsSDKResourceGroup/providers/Microsoft.DigitalTwins/digitalTwinsInstances/DigitalTwinsSDK/operationresults/Create?api-version=2020-03-01-preview" + ], + "RetryAfter": [ + "5" + ], + "Server": [ + "Kestrel" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "8b6861d4-0f7c-42ba-a5c5-3c16c567fe84" + ], + "x-ms-correlation-request-id": [ + "8b6861d4-0f7c-42ba-a5c5-3c16c567fe84" + ], + "x-ms-routing-request-id": [ + "CANADAEAST:20200605T024057Z:8b6861d4-0f7c-42ba-a5c5-3c16c567fe84" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 05 Jun 2020 02:40:57 GMT" + ], + "Content-Length": [ + "446" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/resourceGroups/DigitalTwinsSDKResourceGroup/providers/Microsoft.DigitalTwins/digitalTwinsInstances/DigitalTwinsSDK\",\r\n \"name\": \"DigitalTwinsSDK\",\r\n \"type\": \"Microsoft.DigitalTwins/digitalTwinsInstances\",\r\n \"properties\": {\r\n \"provisioningState\": \"Provisioning\",\r\n \"createdTime\": \"2020-06-05T02:40:56.580726Z\",\r\n \"lastUpdatedTime\": \"2020-06-05T02:40:57.1613518Z\",\r\n \"hostName\": null\r\n },\r\n \"location\": \"westus2\",\r\n \"tags\": null\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/resourceGroups/DigitalTwinsSDKResourceGroup/providers/Microsoft.DigitalTwins/digitalTwinsInstances/DigitalTwinsSDK/operationresults/Create?api-version=2020-03-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMDBmODc1NzktNzMyMy00OTliLWJjNzItYzFmZWRkNDM5OTNkL3Jlc291cmNlR3JvdXBzL0RpZ2l0YWxUd2luc1NES1Jlc291cmNlR3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EaWdpdGFsVHdpbnMvZGlnaXRhbFR3aW5zSW5zdGFuY2VzL0RpZ2l0YWxUd2luc1NESy9vcGVyYXRpb25yZXN1bHRzL0NyZWF0ZT9hcGktdmVyc2lvbj0yMDIwLTAzLTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28516.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19635.", + "Microsoft.Azure.Management.DigitalTwins.AzureDigitalTwinsManagementClient/0.1.0.preview" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-request-id": [ + "7dfa6f81-a5c5-4370-b5b9-d09e809f1c79" + ], + "x-ms-correlation-request-id": [ + "7dfa6f81-a5c5-4370-b5b9-d09e809f1c79" + ], + "x-ms-routing-request-id": [ + "CANADAEAST:20200605T024128Z:7dfa6f81-a5c5-4370-b5b9-d09e809f1c79" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 05 Jun 2020 02:41:27 GMT" + ], + "Content-Length": [ + "236" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/resourceGroups/DigitalTwinsSDKResourceGroup/providers/Microsoft.DigitalTwins/digitalTwinsInstances/DigitalTwinsSDK/operationresults/Create\",\r\n \"name\": \"Create\",\r\n \"status\": \"Succeeded\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/resourceGroups/DigitalTwinsSDKResourceGroup/providers/Microsoft.DigitalTwins/digitalTwinsInstances/DigitalTwinsSDK?api-version=2020-03-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMDBmODc1NzktNzMyMy00OTliLWJjNzItYzFmZWRkNDM5OTNkL3Jlc291cmNlR3JvdXBzL0RpZ2l0YWxUd2luc1NES1Jlc291cmNlR3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EaWdpdGFsVHdpbnMvZGlnaXRhbFR3aW5zSW5zdGFuY2VzL0RpZ2l0YWxUd2luc1NESz9hcGktdmVyc2lvbj0yMDIwLTAzLTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28516.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19635.", + "Microsoft.Azure.Management.DigitalTwins.AzureDigitalTwinsManagementClient/0.1.0.preview" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11998" + ], + "x-ms-request-id": [ + "4bcff622-2057-47b8-89b1-bc2919967dcb" + ], + "x-ms-correlation-request-id": [ + "4bcff622-2057-47b8-89b1-bc2919967dcb" + ], + "x-ms-routing-request-id": [ + "CANADAEAST:20200605T024128Z:4bcff622-2057-47b8-89b1-bc2919967dcb" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 05 Jun 2020 02:41:28 GMT" + ], + "Content-Length": [ + "488" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/resourceGroups/DigitalTwinsSDKResourceGroup/providers/Microsoft.DigitalTwins/digitalTwinsInstances/DigitalTwinsSDK\",\r\n \"name\": \"DigitalTwinsSDK\",\r\n \"type\": \"Microsoft.DigitalTwins/digitalTwinsInstances\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"createdTime\": \"2020-06-05T02:40:56.580726Z\",\r\n \"lastUpdatedTime\": \"2020-06-05T02:41:06.7326549Z\",\r\n \"hostName\": \"DigitalTwinsSDK.api.wus2.digitaltwins.azure.net\"\r\n },\r\n \"location\": \"westus2\",\r\n \"tags\": null\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/resourceGroups/DigitalTwinsSDKResourceGroup/providers/Microsoft.DigitalTwins/digitalTwinsInstances/DigitalTwinsSDK?api-version=2020-03-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMDBmODc1NzktNzMyMy00OTliLWJjNzItYzFmZWRkNDM5OTNkL3Jlc291cmNlR3JvdXBzL0RpZ2l0YWxUd2luc1NES1Jlc291cmNlR3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EaWdpdGFsVHdpbnMvZGlnaXRhbFR3aW5zSW5zdGFuY2VzL0RpZ2l0YWxUd2luc1NESz9hcGktdmVyc2lvbj0yMDIwLTAzLTAxLXByZXZpZXc=", + "RequestMethod": "PATCH", + "RequestBody": "{\r\n \"tags\": {\r\n \"key1\": \"value1\",\r\n \"key2\": \"value2\"\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "cdf63100-9505-4e59-a2b5-e6cd6ed771c3" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28516.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19635.", + "Microsoft.Azure.Management.DigitalTwins.AzureDigitalTwinsManagementClient/0.1.0.preview" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "67" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "x-ms-request-id": [ + "a2aadfa1-c86f-46fa-a89f-69ba9d04417c" + ], + "x-ms-correlation-request-id": [ + "a2aadfa1-c86f-46fa-a89f-69ba9d04417c" + ], + "x-ms-routing-request-id": [ + "CANADAEAST:20200605T024129Z:a2aadfa1-c86f-46fa-a89f-69ba9d04417c" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 05 Jun 2020 02:41:29 GMT" + ], + "Content-Length": [ + "517" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/resourceGroups/DigitalTwinsSDKResourceGroup/providers/Microsoft.DigitalTwins/digitalTwinsInstances/DigitalTwinsSDK\",\r\n \"name\": \"DigitalTwinsSDK\",\r\n \"type\": \"Microsoft.DigitalTwins/digitalTwinsInstances\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"createdTime\": \"2020-06-05T02:40:56.580726Z\",\r\n \"lastUpdatedTime\": \"2020-06-05T02:41:29.0335811Z\",\r\n \"hostName\": \"DigitalTwinsSDK.api.wus2.digitaltwins.azure.net\"\r\n },\r\n \"location\": \"westus2\",\r\n \"tags\": {\r\n \"key1\": \"value1\",\r\n \"key2\": \"value2\"\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/resourceGroups/DigitalTwinsSDKResourceGroup/providers/Microsoft.DigitalTwins/digitalTwinsInstances?api-version=2020-03-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMDBmODc1NzktNzMyMy00OTliLWJjNzItYzFmZWRkNDM5OTNkL3Jlc291cmNlR3JvdXBzL0RpZ2l0YWxUd2luc1NES1Jlc291cmNlR3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EaWdpdGFsVHdpbnMvZGlnaXRhbFR3aW5zSW5zdGFuY2VzP2FwaS12ZXJzaW9uPTIwMjAtMDMtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "77f9b83a-ec74-46a1-a14c-b7986a193e06" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28516.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19635.", + "Microsoft.Azure.Management.DigitalTwins.AzureDigitalTwinsManagementClient/0.1.0.preview" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11997" + ], + "x-ms-request-id": [ + "63f384a7-9806-4c8f-9406-f79da9d0a5bf" + ], + "x-ms-correlation-request-id": [ + "63f384a7-9806-4c8f-9406-f79da9d0a5bf" + ], + "x-ms-routing-request-id": [ + "CANADAEAST:20200605T024129Z:63f384a7-9806-4c8f-9406-f79da9d0a5bf" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 05 Jun 2020 02:41:29 GMT" + ], + "Content-Length": [ + "529" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/resourceGroups/DigitalTwinsSDKResourceGroup/providers/Microsoft.DigitalTwins/digitalTwinsInstances/DigitalTwinsSDK\",\r\n \"name\": \"DigitalTwinsSDK\",\r\n \"type\": \"Microsoft.DigitalTwins/digitalTwinsInstances\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"createdTime\": \"2020-06-05T02:40:56.580726Z\",\r\n \"lastUpdatedTime\": \"2020-06-05T02:41:29.0335811Z\",\r\n \"hostName\": \"DigitalTwinsSDK.api.wus2.digitaltwins.azure.net\"\r\n },\r\n \"location\": \"westus2\",\r\n \"tags\": {\r\n \"key1\": \"value1\",\r\n \"key2\": \"value2\"\r\n }\r\n }\r\n ]\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/providers/Microsoft.DigitalTwins/operations?api-version=2020-03-01-preview", + "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuRGlnaXRhbFR3aW5zL29wZXJhdGlvbnM/YXBpLXZlcnNpb249MjAyMC0wMy0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "0db781ac-47cf-45af-aa6c-79fc9ea782af" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28516.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19635.", + "Microsoft.Azure.Management.DigitalTwins.AzureDigitalTwinsManagementClient/0.1.0.preview" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "11999" + ], + "x-ms-request-id": [ + "1f188c88-a10c-460e-a5ab-476a59d80096" + ], + "x-ms-correlation-request-id": [ + "1f188c88-a10c-460e-a5ab-476a59d80096" + ], + "x-ms-routing-request-id": [ + "CANADAEAST:20200605T024130Z:1f188c88-a10c-460e-a5ab-476a59d80096" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 05 Jun 2020 02:41:29 GMT" + ], + "Content-Length": [ + "10446" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/register/action\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"Digital Twins Resource Provider\",\r\n \"operation\": \"Register the Digital Twins Resource Provider\",\r\n \"description\": \"Register the Subscription for the Digital Twins resource provider and enable the creation of Digital Twins instances.\"\r\n },\r\n \"isDataAction\": false,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/digitalTwinsInstances/read\",\r\n \"display\": {\r\n \"provider\": \"Microsoft.DigitalTwins\",\r\n \"resource\": \"digitalTwinsInstances\",\r\n \"operation\": \"Read Azure Digital Twins resource\",\r\n \"description\": \"Read any Microsoft.DigitalTwins/digitalTwinsInstances resource\"\r\n },\r\n \"isDataAction\": false,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/digitalTwinsInstances/write\",\r\n \"display\": {\r\n \"provider\": \"Microsoft.DigitalTwins\",\r\n \"resource\": \"digitalTwinsInstances\",\r\n \"operation\": \"Create or Update Azure Digital Twins resource\",\r\n \"description\": \"Create or update any Microsoft.DigitalTwins/digitalTwinsInstances resource\"\r\n },\r\n \"isDataAction\": false,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/digitalTwinsInstances/delete\",\r\n \"display\": {\r\n \"provider\": \"Microsoft.DigitalTwins\",\r\n \"resource\": \"digitalTwinsInstances\",\r\n \"operation\": \"Delete Azure Digital Twins resource\",\r\n \"description\": \"Delete an Microsoft.DigitalTwins/digitalTwinsInstances resource\"\r\n },\r\n \"isDataAction\": false,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/digitaltwins/read\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"Digital Twin\",\r\n \"operation\": \"Read Digital Twin\",\r\n \"description\": \"Read any Digital Twin\"\r\n },\r\n \"isDataAction\": true,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/digitaltwins/write\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"Digital Twin\",\r\n \"operation\": \"Create Digital Twin\",\r\n \"description\": \"Create or Update any Digital Twin\"\r\n },\r\n \"isDataAction\": true,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/digitaltwins/delete\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"Digital Twin\",\r\n \"operation\": \"Delete Digital Twin\",\r\n \"description\": \"Delete any Digital Twin\"\r\n },\r\n \"isDataAction\": true,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/digitaltwins/commands/action\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"Digital Twin Command\",\r\n \"operation\": \"Invoke Command on Digital Twin\",\r\n \"description\": \"Invoke any Command on a Digital Twin\"\r\n },\r\n \"isDataAction\": true,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/digitaltwins/relationships/read\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"Digital Twin Relationship\",\r\n \"operation\": \"Read Digital Twin Relationship\",\r\n \"description\": \"Read any Digital Twin Relationship\"\r\n },\r\n \"isDataAction\": true,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/digitaltwins/relationships/write\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"Digital Twin Relationship\",\r\n \"operation\": \"Create Digital Twin Relationship\",\r\n \"description\": \"Create or Update any Digital Twin Relationship\"\r\n },\r\n \"isDataAction\": true,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/digitaltwins/relationships/delete\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"Digital Twin Relationship\",\r\n \"operation\": \"Delete Digital Twin Relationship\",\r\n \"description\": \"Delete any Digital Twin Relationship\"\r\n },\r\n \"isDataAction\": true,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/eventroutes/read\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"Event Route\",\r\n \"operation\": \"Read Event Route\",\r\n \"description\": \"Read any Event Route\"\r\n },\r\n \"isDataAction\": true,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/eventroutes/delete\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"Event Route\",\r\n \"operation\": \"Delete Event Route\",\r\n \"description\": \"Delete any Event Route\"\r\n },\r\n \"isDataAction\": true,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/eventroutes/write\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"Event Route\",\r\n \"operation\": \"Create Event Route\",\r\n \"description\": \"Create or Update any Event Route\"\r\n },\r\n \"isDataAction\": true,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/models/read\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"Model\",\r\n \"operation\": \"Read Model\",\r\n \"description\": \"Read any Model\"\r\n },\r\n \"isDataAction\": true,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/models/write\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"Model\",\r\n \"operation\": \"Create Model\",\r\n \"description\": \"Create or Update any Model\"\r\n },\r\n \"isDataAction\": true,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/models/delete\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"Model\",\r\n \"operation\": \"Delete Model\",\r\n \"description\": \"Delete any Model\"\r\n },\r\n \"isDataAction\": true,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/query/action\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"Digital Twins Graph\",\r\n \"operation\": \"Query Digital Twins Graph\",\r\n \"description\": \"Query any Digital Twins Graph\"\r\n },\r\n \"isDataAction\": true,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/digitalTwinsInstances/diagnosticSettings/read\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"digitalTwinsInstances\",\r\n \"operation\": \"Get Diagnostic Settings\",\r\n \"description\": \"Gets the diagnostic settings for the resource\"\r\n },\r\n \"isDataAction\": false,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/digitalTwinsInstances/diagnosticSettings/write\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"digitalTwinsInstances\",\r\n \"operation\": \"Set Diagnostic Settings\",\r\n \"description\": \"Sets the diagnostic settings for the resource\"\r\n },\r\n \"isDataAction\": false,\r\n \"properties\": null\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/digitalTwinsInstances/metricDefinitions/read\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"digitalTwinsInstances\",\r\n \"operation\": \"Get Azure Monitor Metric Settings\",\r\n \"description\": \"Gets the metric settings for the resource's Azure Monitor\"\r\n },\r\n \"isDataAction\": false,\r\n \"properties\": {\r\n \"serviceSpecification\": {\r\n \"metricSpecifications\": [\r\n {\r\n \"name\": \"Routing\",\r\n \"displayName\": \"Routing\",\r\n \"displayDescription\": \"Routing\",\r\n \"fillGapWithZero\": true,\r\n \"unit\": \"Count\",\r\n \"aggregationType\": \"Total\",\r\n \"supportedAggregationTypes\": [\r\n \"Average\",\r\n \"Minimum\",\r\n \"Maximum\",\r\n \"Total\"\r\n ],\r\n \"dimensions\": [\r\n {\r\n \"name\": \"Operation\",\r\n \"displayName\": \"Operation\"\r\n },\r\n {\r\n \"name\": \"Result\",\r\n \"displayName\": \"Result\"\r\n }\r\n ],\r\n \"availabilities\": [\r\n {\r\n \"timeGrain\": \"PT1M\",\r\n \"blobDuration\": \"PT1H\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"RoutingFailureRate\",\r\n \"displayName\": \"RoutingFailureRate\",\r\n \"displayDescription\": \"RoutingFailureRate\",\r\n \"fillGapWithZero\": true,\r\n \"unit\": \"Count\",\r\n \"aggregationType\": \"Average\",\r\n \"supportedAggregationTypes\": [\r\n \"Average\",\r\n \"Minimum\",\r\n \"Maximum\",\r\n \"Total\"\r\n ],\r\n \"dimensions\": [\r\n {\r\n \"name\": \"Operation\",\r\n \"displayName\": \"Operation\"\r\n },\r\n {\r\n \"name\": \"Result\",\r\n \"displayName\": \"Result\"\r\n }\r\n ],\r\n \"availabilities\": [\r\n {\r\n \"timeGrain\": \"PT1M\",\r\n \"blobDuration\": \"PT1H\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"RoutingLatency\",\r\n \"displayName\": \"RoutingLatency\",\r\n \"displayDescription\": \"RoutingLatency\",\r\n \"fillGapWithZero\": true,\r\n \"unit\": \"Milliseconds\",\r\n \"aggregationType\": \"Average\",\r\n \"supportedAggregationTypes\": [\r\n \"Average\",\r\n \"Minimum\",\r\n \"Maximum\",\r\n \"Total\"\r\n ],\r\n \"dimensions\": [\r\n {\r\n \"name\": \"Operation\",\r\n \"displayName\": \"Operation\"\r\n },\r\n {\r\n \"name\": \"Result\",\r\n \"displayName\": \"Result\"\r\n }\r\n ],\r\n \"availabilities\": [\r\n {\r\n \"timeGrain\": \"PT1M\",\r\n \"blobDuration\": \"PT1H\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"ApiRequests\",\r\n \"displayName\": \"ApiRequests\",\r\n \"displayDescription\": \"ApiRequests\",\r\n \"fillGapWithZero\": true,\r\n \"unit\": \"Count\",\r\n \"aggregationType\": \"Total\",\r\n \"supportedAggregationTypes\": [\r\n \"Average\",\r\n \"Minimum\",\r\n \"Maximum\",\r\n \"Total\"\r\n ],\r\n \"dimensions\": [\r\n {\r\n \"name\": \"Operation\",\r\n \"displayName\": \"Operation\"\r\n },\r\n {\r\n \"name\": \"Authentication\",\r\n \"displayName\": \"Authentication\"\r\n },\r\n {\r\n \"name\": \"Protocol\",\r\n \"displayName\": \"Protocol\"\r\n },\r\n {\r\n \"name\": \"StatusCode\",\r\n \"displayName\": \"Status Code\"\r\n },\r\n {\r\n \"name\": \"StatusCodeClass\",\r\n \"displayName\": \"Status Code Class\"\r\n },\r\n {\r\n \"name\": \"StatusText\",\r\n \"displayName\": \"Status Text\"\r\n }\r\n ],\r\n \"availabilities\": [\r\n {\r\n \"timeGrain\": \"PT1M\",\r\n \"blobDuration\": \"PT1H\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"ApiRequestsFailureRate\",\r\n \"displayName\": \"ApiRequestsFailureRate\",\r\n \"displayDescription\": \"ApiRequestsFailureRate\",\r\n \"fillGapWithZero\": true,\r\n \"unit\": \"Count\",\r\n \"aggregationType\": \"Average\",\r\n \"supportedAggregationTypes\": [\r\n \"Average\",\r\n \"Minimum\",\r\n \"Maximum\",\r\n \"Total\"\r\n ],\r\n \"dimensions\": [\r\n {\r\n \"name\": \"Operation\",\r\n \"displayName\": \"Operation\"\r\n },\r\n {\r\n \"name\": \"Authentication\",\r\n \"displayName\": \"Authentication\"\r\n },\r\n {\r\n \"name\": \"Protocol\",\r\n \"displayName\": \"Protocol\"\r\n },\r\n {\r\n \"name\": \"StatusCode\",\r\n \"displayName\": \"Status Code\"\r\n },\r\n {\r\n \"name\": \"StatusCodeClass\",\r\n \"displayName\": \"Status Code Class\"\r\n },\r\n {\r\n \"name\": \"StatusText\",\r\n \"displayName\": \"Status Text\"\r\n }\r\n ],\r\n \"availabilities\": [\r\n {\r\n \"timeGrain\": \"PT1M\",\r\n \"blobDuration\": \"PT1H\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"ApiRequestsLatency\",\r\n \"displayName\": \"ApiRequestsLatency\",\r\n \"displayDescription\": \"ApiRequestsLatency\",\r\n \"fillGapWithZero\": true,\r\n \"unit\": \"Milliseconds\",\r\n \"aggregationType\": \"Average\",\r\n \"supportedAggregationTypes\": [\r\n \"Average\",\r\n \"Minimum\",\r\n \"Maximum\",\r\n \"Total\"\r\n ],\r\n \"dimensions\": [\r\n {\r\n \"name\": \"Operation\",\r\n \"displayName\": \"Operation\"\r\n },\r\n {\r\n \"name\": \"Authentication\",\r\n \"displayName\": \"Authentication\"\r\n },\r\n {\r\n \"name\": \"Protocol\",\r\n \"displayName\": \"Protocol\"\r\n }\r\n ],\r\n \"availabilities\": [\r\n {\r\n \"timeGrain\": \"PT1M\",\r\n \"blobDuration\": \"PT1H\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"BillingApiOperations\",\r\n \"displayName\": \"BillingApiOperations\",\r\n \"displayDescription\": \"BillingApiOperations\",\r\n \"fillGapWithZero\": true,\r\n \"unit\": \"Count\",\r\n \"aggregationType\": \"Total\",\r\n \"supportedAggregationTypes\": [\r\n \"Average\",\r\n \"Minimum\",\r\n \"Maximum\",\r\n \"Total\"\r\n ],\r\n \"dimensions\": [\r\n {\r\n \"name\": \"MeterId\",\r\n \"displayName\": \"MeterId\"\r\n }\r\n ],\r\n \"availabilities\": [\r\n {\r\n \"timeGrain\": \"PT1M\",\r\n \"blobDuration\": \"PT1H\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"BillingEventsProcessed\",\r\n \"displayName\": \"BillingEventsProcessed\",\r\n \"displayDescription\": \"BillingEventsProcessed\",\r\n \"fillGapWithZero\": true,\r\n \"unit\": \"Count\",\r\n \"aggregationType\": \"Total\",\r\n \"supportedAggregationTypes\": [\r\n \"Average\",\r\n \"Minimum\",\r\n \"Maximum\",\r\n \"Total\"\r\n ],\r\n \"dimensions\": [\r\n {\r\n \"name\": \"MeterId\",\r\n \"displayName\": \"MeterId\"\r\n }\r\n ],\r\n \"availabilities\": [\r\n {\r\n \"timeGrain\": \"PT1M\",\r\n \"blobDuration\": \"PT1H\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"BillingQueryUnits\",\r\n \"displayName\": \"BillingQueryUnits\",\r\n \"displayDescription\": \"BillingQueryUnits\",\r\n \"fillGapWithZero\": true,\r\n \"unit\": \"Count\",\r\n \"aggregationType\": \"Total\",\r\n \"supportedAggregationTypes\": [\r\n \"Average\",\r\n \"Minimum\",\r\n \"Maximum\",\r\n \"Total\"\r\n ],\r\n \"dimensions\": [\r\n {\r\n \"name\": \"MeterId\",\r\n \"displayName\": \"MeterId\"\r\n }\r\n ],\r\n \"availabilities\": [\r\n {\r\n \"timeGrain\": \"PT1M\",\r\n \"blobDuration\": \"PT1H\"\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n }\r\n },\r\n {\r\n \"name\": \"Microsoft.DigitalTwins/digitalTwinsInstances/logDefinitions/read\",\r\n \"display\": {\r\n \"provider\": \"Azure Digital Twins\",\r\n \"resource\": \"digitalTwinsInstances\",\r\n \"operation\": \"Get Azure Monitor Log Settings\",\r\n \"description\": \"Gets the log settings for the resource's Azure Monitor\"\r\n },\r\n \"isDataAction\": false,\r\n \"properties\": {\r\n \"serviceSpecification\": {\r\n \"logSpecifications\": [\r\n {\r\n \"name\": \"DigitalTwinsOperation\",\r\n \"displayName\": \"DigitalTwinsOperation\",\r\n \"blobDuration\": \"PT1H\"\r\n },\r\n {\r\n \"name\": \"EventRoutesOperation\",\r\n \"displayName\": \"EventRoutesOperation\",\r\n \"blobDuration\": \"PT1H\"\r\n },\r\n {\r\n \"name\": \"ModelsOperation\",\r\n \"displayName\": \"ModelsOperation\",\r\n \"blobDuration\": \"PT1H\"\r\n },\r\n {\r\n \"name\": \"QueryOperation\",\r\n \"displayName\": \"QueryOperation\",\r\n \"blobDuration\": \"PT1H\"\r\n }\r\n ]\r\n }\r\n }\r\n }\r\n ]\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/resourceGroups/DigitalTwinsSDKResourceGroup/providers/Microsoft.DigitalTwins/digitalTwinsInstances/DigitalTwinsSDK?api-version=2020-03-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMDBmODc1NzktNzMyMy00OTliLWJjNzItYzFmZWRkNDM5OTNkL3Jlc291cmNlR3JvdXBzL0RpZ2l0YWxUd2luc1NES1Jlc291cmNlR3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EaWdpdGFsVHdpbnMvZGlnaXRhbFR3aW5zSW5zdGFuY2VzL0RpZ2l0YWxUd2luc1NESz9hcGktdmVyc2lvbj0yMDIwLTAzLTAxLXByZXZpZXc=", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "460509fb-baed-4019-a69c-6a7f8983f4ce" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28516.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19635.", + "Microsoft.Azure.Management.DigitalTwins.AzureDigitalTwinsManagementClient/0.1.0.preview" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/resourceGroups/DigitalTwinsSDKResourceGroup/providers/Microsoft.DigitalTwins/digitalTwinsInstances/DigitalTwinsSDK?api-version=2020-03-01-preview" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/resourceGroups/DigitalTwinsSDKResourceGroup/providers/Microsoft.DigitalTwins/digitalTwinsInstances/DigitalTwinsSDK/operationresults/Delete?api-version=2020-03-01-preview" + ], + "RetryAfter": [ + "5" + ], + "Server": [ + "Kestrel" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14999" + ], + "x-ms-request-id": [ + "e2a2f93c-fcfa-4777-a871-bf3b06c2440c" + ], + "x-ms-correlation-request-id": [ + "e2a2f93c-fcfa-4777-a871-bf3b06c2440c" + ], + "x-ms-routing-request-id": [ + "CANADAEAST:20200605T024131Z:e2a2f93c-fcfa-4777-a871-bf3b06c2440c" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 05 Jun 2020 02:41:30 GMT" + ], + "Content-Length": [ + "420" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/00f87579-7323-499b-bc72-c1fedd43993d/resourceGroups/DigitalTwinsSDKResourceGroup/providers/Microsoft.DigitalTwins/digitalTwinsInstances/DigitalTwinsSDK\",\r\n \"name\": \"DigitalTwinsSDK\",\r\n \"type\": \"Microsoft.DigitalTwins/digitalTwinsInstances\",\r\n \"properties\": {\r\n \"provisioningState\": \"Deleting\",\r\n \"createdTime\": \"0001-01-01T00:00:00\",\r\n \"lastUpdatedTime\": \"0001-01-01T00:00:00\",\r\n \"hostName\": null\r\n },\r\n \"location\": null,\r\n \"tags\": null\r\n}", + "StatusCode": 202 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "00f87579-7323-499b-bc72-c1fedd43993d" + } +} \ No newline at end of file