diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/EnvironmentSettingsOperationsExtensions.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/EnvironmentSettingsOperationsExtensions.cs
deleted file mode 100644
index 0ff6be40f638..000000000000
--- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/EnvironmentSettingsOperationsExtensions.cs
+++ /dev/null
@@ -1,762 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.LabServices
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Microsoft.Rest.Azure.OData;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for EnvironmentSettingsOperations.
- ///
- public static partial class EnvironmentSettingsOperationsExtensions
- {
- ///
- /// List environment setting in a given lab.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// OData parameters to apply to the operation.
- ///
- public static IPage List(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, ODataQuery odataQuery = default(ODataQuery))
- {
- return operations.ListAsync(resourceGroupName, labAccountName, labName, odataQuery).GetAwaiter().GetResult();
- }
-
- ///
- /// List environment setting in a given lab.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// OData parameters to apply to the operation.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task> ListAsync(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Get environment setting
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// Specify the $expand query. Example: 'properties($select=publishingState)'
- ///
- public static EnvironmentSetting Get(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string expand = default(string))
- {
- return operations.GetAsync(resourceGroupName, labAccountName, labName, environmentSettingName, expand).GetAwaiter().GetResult();
- }
-
- ///
- /// Get environment setting
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// Specify the $expand query. Example: 'properties($select=publishingState)'
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task GetAsync(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, expand, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Create or replace an existing Environment Setting. This operation can take
- /// a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// Represents settings of an environment, from which environment instances
- /// would be created
- ///
- public static EnvironmentSetting CreateOrUpdate(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, EnvironmentSetting environmentSetting)
- {
- return operations.CreateOrUpdateAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting).GetAwaiter().GetResult();
- }
-
- ///
- /// Create or replace an existing Environment Setting. This operation can take
- /// a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// Represents settings of an environment, from which environment instances
- /// would be created
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task CreateOrUpdateAsync(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, EnvironmentSetting environmentSetting, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Delete environment setting. This operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- public static void Delete(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName)
- {
- operations.DeleteAsync(resourceGroupName, labAccountName, labName, environmentSettingName).GetAwaiter().GetResult();
- }
-
- ///
- /// Delete environment setting. This operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task DeleteAsync(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Modify properties of environment setting.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// Represents settings of an environment, from which environment instances
- /// would be created
- ///
- public static EnvironmentSetting Update(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, EnvironmentSettingFragment environmentSetting)
- {
- return operations.UpdateAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting).GetAwaiter().GetResult();
- }
-
- ///
- /// Modify properties of environment setting.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// Represents settings of an environment, from which environment instances
- /// would be created
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task UpdateAsync(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, EnvironmentSettingFragment environmentSetting, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Claims a random environment for a user in an environment settings
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- public static void ClaimAny(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName)
- {
- operations.ClaimAnyAsync(resourceGroupName, labAccountName, labName, environmentSettingName).GetAwaiter().GetResult();
- }
-
- ///
- /// Claims a random environment for a user in an environment settings
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ClaimAnyAsync(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.ClaimAnyWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Provisions/deprovisions required resources for an environment setting based
- /// on current state of the lab/environment setting.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// Payload for Publish operation on EnvironmentSetting.
- ///
- public static void Publish(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, PublishPayload publishPayload)
- {
- operations.PublishAsync(resourceGroupName, labAccountName, labName, environmentSettingName, publishPayload).GetAwaiter().GetResult();
- }
-
- ///
- /// Provisions/deprovisions required resources for an environment setting based
- /// on current state of the lab/environment setting.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// Payload for Publish operation on EnvironmentSetting.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task PublishAsync(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, PublishPayload publishPayload, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.PublishWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, publishPayload, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Starts a template by starting all resources inside the template. This
- /// operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- public static void Start(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName)
- {
- operations.StartAsync(resourceGroupName, labAccountName, labName, environmentSettingName).GetAwaiter().GetResult();
- }
-
- ///
- /// Starts a template by starting all resources inside the template. This
- /// operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task StartAsync(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.StartWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Starts a template by starting all resources inside the template. This
- /// operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- public static void Stop(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName)
- {
- operations.StopAsync(resourceGroupName, labAccountName, labName, environmentSettingName).GetAwaiter().GetResult();
- }
-
- ///
- /// Starts a template by starting all resources inside the template. This
- /// operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task StopAsync(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.StopWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Create or replace an existing Environment Setting. This operation can take
- /// a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// Represents settings of an environment, from which environment instances
- /// would be created
- ///
- public static EnvironmentSetting BeginCreateOrUpdate(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, EnvironmentSetting environmentSetting)
- {
- return operations.BeginCreateOrUpdateAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting).GetAwaiter().GetResult();
- }
-
- ///
- /// Create or replace an existing Environment Setting. This operation can take
- /// a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// Represents settings of an environment, from which environment instances
- /// would be created
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task BeginCreateOrUpdateAsync(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, EnvironmentSetting environmentSetting, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Delete environment setting. This operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- public static void BeginDelete(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName)
- {
- operations.BeginDeleteAsync(resourceGroupName, labAccountName, labName, environmentSettingName).GetAwaiter().GetResult();
- }
-
- ///
- /// Delete environment setting. This operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task BeginDeleteAsync(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Starts a template by starting all resources inside the template. This
- /// operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- public static void BeginStart(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName)
- {
- operations.BeginStartAsync(resourceGroupName, labAccountName, labName, environmentSettingName).GetAwaiter().GetResult();
- }
-
- ///
- /// Starts a template by starting all resources inside the template. This
- /// operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task BeginStartAsync(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Starts a template by starting all resources inside the template. This
- /// operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- public static void BeginStop(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName)
- {
- operations.BeginStopAsync(resourceGroupName, labAccountName, labName, environmentSettingName).GetAwaiter().GetResult();
- }
-
- ///
- /// Starts a template by starting all resources inside the template. This
- /// operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task BeginStopAsync(this IEnvironmentSettingsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.BeginStopWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// List environment setting in a given lab.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The NextLink from the previous successful call to List operation.
- ///
- public static IPage ListNext(this IEnvironmentSettingsOperations operations, string nextPageLink)
- {
- return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
- }
-
- ///
- /// List environment setting in a given lab.
- ///
- ///
- /// 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 IEnvironmentSettingsOperations 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/labservices/Microsoft.Azure.Management.LabServices/src/Generated/EnvironmentsOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/EnvironmentsOperations.cs
deleted file mode 100644
index 021da5a6267a..000000000000
--- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/EnvironmentsOperations.cs
+++ /dev/null
@@ -1,2338 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.LabServices
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Microsoft.Rest.Azure.OData;
- 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;
-
- ///
- /// EnvironmentsOperations operations.
- ///
- internal partial class EnvironmentsOperations : IServiceOperations, IEnvironmentsOperations
- {
- ///
- /// Initializes a new instance of the EnvironmentsOperations class.
- ///
- ///
- /// Reference to the service client.
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- internal EnvironmentsOperations(ManagedLabsClient client)
- {
- if (client == null)
- {
- throw new System.ArgumentNullException("client");
- }
- Client = client;
- }
-
- ///
- /// Gets a reference to the ManagedLabsClient
- ///
- public ManagedLabsClient Client { get; private set; }
-
- ///
- /// List environments in a given environment setting.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// OData parameters to apply to the 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, ODataQuery odataQuery = default(ODataQuery), 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 (labAccountName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName");
- }
- if (labName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "labName");
- }
- if (environmentSettingName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentSettingName");
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("odataQuery", odataQuery);
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("labAccountName", labAccountName);
- tracingParameters.Add("labName", labName);
- tracingParameters.Add("environmentSettingName", environmentSettingName);
- 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.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{labAccountName}", System.Uri.EscapeDataString(labAccountName));
- _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName));
- _url = _url.Replace("{environmentSettingName}", System.Uri.EscapeDataString(environmentSettingName));
- List _queryParameters = new List();
- if (odataQuery != null)
- {
- var _odataFilter = odataQuery.ToString();
- if (!string.IsNullOrEmpty(_odataFilter))
- {
- _queryParameters.Add(_odataFilter);
- }
- }
- 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse>();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Get environment
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Specify the $expand query. Example: 'properties($expand=networkInterface)'
- ///
- ///
- /// 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 labAccountName, string labName, string environmentSettingName, string environmentName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (Client.SubscriptionId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
- }
- if (resourceGroupName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
- }
- if (labAccountName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName");
- }
- if (labName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "labName");
- }
- if (environmentSettingName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentSettingName");
- }
- if (environmentName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentName");
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("labAccountName", labAccountName);
- tracingParameters.Add("labName", labName);
- tracingParameters.Add("environmentSettingName", environmentSettingName);
- tracingParameters.Add("environmentName", environmentName);
- tracingParameters.Add("expand", expand);
- 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.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{labAccountName}", System.Uri.EscapeDataString(labAccountName));
- _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName));
- _url = _url.Replace("{environmentSettingName}", System.Uri.EscapeDataString(environmentSettingName));
- _url = _url.Replace("{environmentName}", System.Uri.EscapeDataString(environmentName));
- List _queryParameters = new List();
- if (expand != null)
- {
- _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand)));
- }
- 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Create or replace an existing Environment.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Represents an environment instance
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, Environment environment, 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 (labAccountName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName");
- }
- if (labName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "labName");
- }
- if (environmentSettingName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentSettingName");
- }
- if (environmentName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentName");
- }
- if (environment == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environment");
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("labAccountName", labAccountName);
- tracingParameters.Add("labName", labName);
- tracingParameters.Add("environmentSettingName", environmentSettingName);
- tracingParameters.Add("environmentName", environmentName);
- tracingParameters.Add("environment", environment);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{labAccountName}", System.Uri.EscapeDataString(labAccountName));
- _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName));
- _url = _url.Replace("{environmentSettingName}", System.Uri.EscapeDataString(environmentSettingName));
- _url = _url.Replace("{environmentName}", System.Uri.EscapeDataString(environmentName));
- 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(environment != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(environment, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- // 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 environment. This operation can take a while to complete
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send request
- AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Modify properties of environments.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Represents an environment instance
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, EnvironmentFragment environment, 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 (labAccountName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName");
- }
- if (labName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "labName");
- }
- if (environmentSettingName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentSettingName");
- }
- if (environmentName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentName");
- }
- if (environment == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environment");
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("labAccountName", labAccountName);
- tracingParameters.Add("labName", labName);
- tracingParameters.Add("environmentSettingName", environmentSettingName);
- tracingParameters.Add("environmentName", environmentName);
- tracingParameters.Add("environment", environment);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{labAccountName}", System.Uri.EscapeDataString(labAccountName));
- _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName));
- _url = _url.Replace("{environmentSettingName}", System.Uri.EscapeDataString(environmentSettingName));
- _url = _url.Replace("{environmentName}", System.Uri.EscapeDataString(environmentName));
- 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(environment != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(environment, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Claims the environment and assigns it to the user
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task ClaimWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, 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 (labAccountName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName");
- }
- if (labName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "labName");
- }
- if (environmentSettingName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentSettingName");
- }
- if (environmentName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentName");
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("labAccountName", labAccountName);
- tracingParameters.Add("labName", labName);
- tracingParameters.Add("environmentSettingName", environmentSettingName);
- tracingParameters.Add("environmentName", environmentName);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "Claim", 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.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/claim").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{labAccountName}", System.Uri.EscapeDataString(labAccountName));
- _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName));
- _url = _url.Replace("{environmentSettingName}", System.Uri.EscapeDataString(environmentSettingName));
- _url = _url.Replace("{environmentName}", System.Uri.EscapeDataString(environmentName));
- List _queryParameters = new List();
- if (Client.ApiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("POST");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Resets the user password on an environment This operation can take a while
- /// to complete
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Represents the payload for resetting passwords.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task ResetPasswordWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, ResetPasswordPayload resetPasswordPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send request
- AzureOperationResponse _response = await BeginResetPasswordWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Starts an environment by starting all resources inside the environment.
- /// This operation can take a while to complete
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task StartWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send request
- AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Stops an environment by stopping all resources inside the environment This
- /// operation can take a while to complete
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task StopWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send request
- AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Delete environment. This operation can take a while to complete
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, 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 (labAccountName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName");
- }
- if (labName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "labName");
- }
- if (environmentSettingName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentSettingName");
- }
- if (environmentName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentName");
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("labAccountName", labAccountName);
- tracingParameters.Add("labName", labName);
- tracingParameters.Add("environmentSettingName", environmentSettingName);
- tracingParameters.Add("environmentName", environmentName);
- 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.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{labAccountName}", System.Uri.EscapeDataString(labAccountName));
- _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName));
- _url = _url.Replace("{environmentSettingName}", System.Uri.EscapeDataString(environmentSettingName));
- _url = _url.Replace("{environmentName}", System.Uri.EscapeDataString(environmentName));
- List _queryParameters = new List();
- if (Client.ApiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("DELETE");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 202 && (int)_statusCode != 204)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Resets the user password on an environment This operation can take a while
- /// to complete
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Represents the payload for resetting passwords.
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task BeginResetPasswordWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, ResetPasswordPayload resetPasswordPayload, 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 (labAccountName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName");
- }
- if (labName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "labName");
- }
- if (environmentSettingName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentSettingName");
- }
- if (environmentName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentName");
- }
- if (resetPasswordPayload == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "resetPasswordPayload");
- }
- if (resetPasswordPayload != null)
- {
- resetPasswordPayload.Validate();
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("labAccountName", labAccountName);
- tracingParameters.Add("labName", labName);
- tracingParameters.Add("environmentSettingName", environmentSettingName);
- tracingParameters.Add("environmentName", environmentName);
- tracingParameters.Add("resetPasswordPayload", resetPasswordPayload);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginResetPassword", 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.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/resetPassword").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{labAccountName}", System.Uri.EscapeDataString(labAccountName));
- _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName));
- _url = _url.Replace("{environmentSettingName}", System.Uri.EscapeDataString(environmentSettingName));
- _url = _url.Replace("{environmentName}", System.Uri.EscapeDataString(environmentName));
- 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(resetPasswordPayload != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(resetPasswordPayload, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 202)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Starts an environment by starting all resources inside the environment.
- /// This operation can take a while to complete
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, 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 (labAccountName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName");
- }
- if (labName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "labName");
- }
- if (environmentSettingName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentSettingName");
- }
- if (environmentName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentName");
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("labAccountName", labAccountName);
- tracingParameters.Add("labName", labName);
- tracingParameters.Add("environmentSettingName", environmentSettingName);
- tracingParameters.Add("environmentName", environmentName);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginStart", 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.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/start").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{labAccountName}", System.Uri.EscapeDataString(labAccountName));
- _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName));
- _url = _url.Replace("{environmentSettingName}", System.Uri.EscapeDataString(environmentSettingName));
- _url = _url.Replace("{environmentName}", System.Uri.EscapeDataString(environmentName));
- List _queryParameters = new List();
- if (Client.ApiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("POST");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 202)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Stops an environment by stopping all resources inside the environment This
- /// operation can take a while to complete
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task BeginStopWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, 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 (labAccountName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName");
- }
- if (labName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "labName");
- }
- if (environmentSettingName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentSettingName");
- }
- if (environmentName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentName");
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("labAccountName", labAccountName);
- tracingParameters.Add("labName", labName);
- tracingParameters.Add("environmentSettingName", environmentSettingName);
- tracingParameters.Add("environmentName", environmentName);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginStop", 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.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/stop").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{labAccountName}", System.Uri.EscapeDataString(labAccountName));
- _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName));
- _url = _url.Replace("{environmentSettingName}", System.Uri.EscapeDataString(environmentSettingName));
- _url = _url.Replace("{environmentName}", System.Uri.EscapeDataString(environmentName));
- List _queryParameters = new List();
- if (Client.ApiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("POST");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 202)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// List environments in a given environment setting.
- ///
- ///
- /// 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse>();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- }
-}
diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/EnvironmentsOperationsExtensions.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/EnvironmentsOperationsExtensions.cs
deleted file mode 100644
index bc5b22bac39a..000000000000
--- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/EnvironmentsOperationsExtensions.cs
+++ /dev/null
@@ -1,829 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.LabServices
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Microsoft.Rest.Azure.OData;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for EnvironmentsOperations.
- ///
- public static partial class EnvironmentsOperationsExtensions
- {
- ///
- /// List environments in a given environment setting.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// OData parameters to apply to the operation.
- ///
- public static IPage List(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, ODataQuery odataQuery = default(ODataQuery))
- {
- return operations.ListAsync(resourceGroupName, labAccountName, labName, environmentSettingName, odataQuery).GetAwaiter().GetResult();
- }
-
- ///
- /// List environments in a given environment setting.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// OData parameters to apply to the operation.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task> ListAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, odataQuery, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Get environment
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Specify the $expand query. Example: 'properties($expand=networkInterface)'
- ///
- public static Environment Get(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, string expand = default(string))
- {
- return operations.GetAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, expand).GetAwaiter().GetResult();
- }
-
- ///
- /// Get environment
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Specify the $expand query. Example: 'properties($expand=networkInterface)'
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task GetAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, expand, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Create or replace an existing Environment.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Represents an environment instance
- ///
- public static Environment CreateOrUpdate(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, Environment environment)
- {
- return operations.CreateOrUpdateAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment).GetAwaiter().GetResult();
- }
-
- ///
- /// Create or replace an existing Environment.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Represents an environment instance
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task CreateOrUpdateAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, Environment environment, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Delete environment. This operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- public static void Delete(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName)
- {
- operations.DeleteAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName).GetAwaiter().GetResult();
- }
-
- ///
- /// Delete environment. This operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task DeleteAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Modify properties of environments.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Represents an environment instance
- ///
- public static Environment Update(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, EnvironmentFragment environment)
- {
- return operations.UpdateAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment).GetAwaiter().GetResult();
- }
-
- ///
- /// Modify properties of environments.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Represents an environment instance
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task UpdateAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, EnvironmentFragment environment, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Claims the environment and assigns it to the user
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- public static void Claim(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName)
- {
- operations.ClaimAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName).GetAwaiter().GetResult();
- }
-
- ///
- /// Claims the environment and assigns it to the user
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ClaimAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.ClaimWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Resets the user password on an environment This operation can take a while
- /// to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Represents the payload for resetting passwords.
- ///
- public static void ResetPassword(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, ResetPasswordPayload resetPasswordPayload)
- {
- operations.ResetPasswordAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload).GetAwaiter().GetResult();
- }
-
- ///
- /// Resets the user password on an environment This operation can take a while
- /// to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Represents the payload for resetting passwords.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ResetPasswordAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, ResetPasswordPayload resetPasswordPayload, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.ResetPasswordWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Starts an environment by starting all resources inside the environment.
- /// This operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- public static void Start(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName)
- {
- operations.StartAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName).GetAwaiter().GetResult();
- }
-
- ///
- /// Starts an environment by starting all resources inside the environment.
- /// This operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task StartAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.StartWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Stops an environment by stopping all resources inside the environment This
- /// operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- public static void Stop(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName)
- {
- operations.StopAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName).GetAwaiter().GetResult();
- }
-
- ///
- /// Stops an environment by stopping all resources inside the environment This
- /// operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task StopAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.StopWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Delete environment. This operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- public static void BeginDelete(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName)
- {
- operations.BeginDeleteAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName).GetAwaiter().GetResult();
- }
-
- ///
- /// Delete environment. This operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task BeginDeleteAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Resets the user password on an environment This operation can take a while
- /// to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Represents the payload for resetting passwords.
- ///
- public static void BeginResetPassword(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, ResetPasswordPayload resetPasswordPayload)
- {
- operations.BeginResetPasswordAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload).GetAwaiter().GetResult();
- }
-
- ///
- /// Resets the user password on an environment This operation can take a while
- /// to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// Represents the payload for resetting passwords.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task BeginResetPasswordAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, ResetPasswordPayload resetPasswordPayload, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.BeginResetPasswordWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Starts an environment by starting all resources inside the environment.
- /// This operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- public static void BeginStart(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName)
- {
- operations.BeginStartAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName).GetAwaiter().GetResult();
- }
-
- ///
- /// Starts an environment by starting all resources inside the environment.
- /// This operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task BeginStartAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Stops an environment by stopping all resources inside the environment This
- /// operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- public static void BeginStop(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName)
- {
- operations.BeginStopAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName).GetAwaiter().GetResult();
- }
-
- ///
- /// Stops an environment by stopping all resources inside the environment This
- /// operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The name of the environment.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task BeginStopAsync(this IEnvironmentsOperations operations, string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.BeginStopWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// List environments in a given environment setting.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The NextLink from the previous successful call to List operation.
- ///
- public static IPage ListNext(this IEnvironmentsOperations operations, string nextPageLink)
- {
- return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
- }
-
- ///
- /// List environments in a given environment setting.
- ///
- ///
- /// 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 IEnvironmentsOperations 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/labservices/Microsoft.Azure.Management.LabServices/src/Generated/GalleryImagesOperationsExtensions.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/GalleryImagesOperationsExtensions.cs
deleted file mode 100644
index 69f0f6af1248..000000000000
--- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/GalleryImagesOperationsExtensions.cs
+++ /dev/null
@@ -1,305 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.LabServices
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Microsoft.Rest.Azure.OData;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for GalleryImagesOperations.
- ///
- public static partial class GalleryImagesOperationsExtensions
- {
- ///
- /// List gallery images in a given lab account.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// OData parameters to apply to the operation.
- ///
- public static IPage List(this IGalleryImagesOperations operations, string resourceGroupName, string labAccountName, ODataQuery odataQuery = default(ODataQuery))
- {
- return operations.ListAsync(resourceGroupName, labAccountName, odataQuery).GetAwaiter().GetResult();
- }
-
- ///
- /// List gallery images in a given lab account.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// OData parameters to apply to the operation.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task> ListAsync(this IGalleryImagesOperations operations, string resourceGroupName, string labAccountName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labAccountName, odataQuery, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Get gallery image
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the gallery Image.
- ///
- ///
- /// Specify the $expand query. Example: 'properties($select=author)'
- ///
- public static GalleryImage Get(this IGalleryImagesOperations operations, string resourceGroupName, string labAccountName, string galleryImageName, string expand = default(string))
- {
- return operations.GetAsync(resourceGroupName, labAccountName, galleryImageName, expand).GetAwaiter().GetResult();
- }
-
- ///
- /// Get gallery image
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the gallery Image.
- ///
- ///
- /// Specify the $expand query. Example: 'properties($select=author)'
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task GetAsync(this IGalleryImagesOperations operations, string resourceGroupName, string labAccountName, string galleryImageName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labAccountName, galleryImageName, expand, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Create or replace an existing Gallery Image.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the gallery Image.
- ///
- ///
- /// Represents an image from the Azure Marketplace
- ///
- public static GalleryImage CreateOrUpdate(this IGalleryImagesOperations operations, string resourceGroupName, string labAccountName, string galleryImageName, GalleryImage galleryImage)
- {
- return operations.CreateOrUpdateAsync(resourceGroupName, labAccountName, galleryImageName, galleryImage).GetAwaiter().GetResult();
- }
-
- ///
- /// Create or replace an existing Gallery Image.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the gallery Image.
- ///
- ///
- /// Represents an image from the Azure Marketplace
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task CreateOrUpdateAsync(this IGalleryImagesOperations operations, string resourceGroupName, string labAccountName, string galleryImageName, GalleryImage galleryImage, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labAccountName, galleryImageName, galleryImage, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Delete gallery image.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the gallery Image.
- ///
- public static void Delete(this IGalleryImagesOperations operations, string resourceGroupName, string labAccountName, string galleryImageName)
- {
- operations.DeleteAsync(resourceGroupName, labAccountName, galleryImageName).GetAwaiter().GetResult();
- }
-
- ///
- /// Delete gallery image.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the gallery Image.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task DeleteAsync(this IGalleryImagesOperations operations, string resourceGroupName, string labAccountName, string galleryImageName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labAccountName, galleryImageName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Modify properties of gallery images.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the gallery Image.
- ///
- ///
- /// Represents an image from the Azure Marketplace
- ///
- public static GalleryImage Update(this IGalleryImagesOperations operations, string resourceGroupName, string labAccountName, string galleryImageName, GalleryImageFragment galleryImage)
- {
- return operations.UpdateAsync(resourceGroupName, labAccountName, galleryImageName, galleryImage).GetAwaiter().GetResult();
- }
-
- ///
- /// Modify properties of gallery images.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the gallery Image.
- ///
- ///
- /// Represents an image from the Azure Marketplace
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task UpdateAsync(this IGalleryImagesOperations operations, string resourceGroupName, string labAccountName, string galleryImageName, GalleryImageFragment galleryImage, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labAccountName, galleryImageName, galleryImage, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// List gallery images in a given lab account.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The NextLink from the previous successful call to List operation.
- ///
- public static IPage ListNext(this IGalleryImagesOperations operations, string nextPageLink)
- {
- return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
- }
-
- ///
- /// List gallery images in a given lab account.
- ///
- ///
- /// 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 IGalleryImagesOperations 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/labservices/Microsoft.Azure.Management.LabServices/src/Generated/GlobalUsersOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/GlobalUsersOperations.cs
deleted file mode 100644
index 259c3b95e5ed..000000000000
--- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/GlobalUsersOperations.cs
+++ /dev/null
@@ -1,2026 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.LabServices
-{
- 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;
-
- ///
- /// GlobalUsersOperations operations.
- ///
- internal partial class GlobalUsersOperations : IServiceOperations, IGlobalUsersOperations
- {
- ///
- /// Initializes a new instance of the GlobalUsersOperations class.
- ///
- ///
- /// Reference to the service client.
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- internal GlobalUsersOperations(ManagedLabsClient client)
- {
- if (client == null)
- {
- throw new System.ArgumentNullException("client");
- }
- Client = client;
- }
-
- ///
- /// Gets a reference to the ManagedLabsClient
- ///
- public ManagedLabsClient Client { get; private set; }
-
- ///
- /// Gets the virtual machine details
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for any Environment operations like get, start, stop,
- /// connect
- ///
- ///
- /// Specify the $expand query. Example: 'properties($expand=environment)'
- ///
- ///
- /// 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> GetEnvironmentWithHttpMessagesAsync(string userName, EnvironmentOperationsPayload environmentOperationsPayload, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (userName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "userName");
- }
- if (environmentOperationsPayload == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentOperationsPayload");
- }
- if (environmentOperationsPayload != null)
- {
- environmentOperationsPayload.Validate();
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("userName", userName);
- tracingParameters.Add("environmentOperationsPayload", environmentOperationsPayload);
- tracingParameters.Add("expand", expand);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "GetEnvironment", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.LabServices/users/{userName}/getEnvironment").ToString();
- _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName));
- List _queryParameters = new List();
- if (expand != null)
- {
- _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand)));
- }
- 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(environmentOperationsPayload != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(environmentOperationsPayload, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Get batch operation status
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Payload to get the status of an 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> GetOperationBatchStatusWithHttpMessagesAsync(string userName, OperationBatchStatusPayload operationBatchStatusPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (userName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "userName");
- }
- if (operationBatchStatusPayload == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "operationBatchStatusPayload");
- }
- if (operationBatchStatusPayload != null)
- {
- operationBatchStatusPayload.Validate();
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("userName", userName);
- tracingParameters.Add("operationBatchStatusPayload", operationBatchStatusPayload);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "GetOperationBatchStatus", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.LabServices/users/{userName}/getOperationBatchStatus").ToString();
- _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName));
- 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(operationBatchStatusPayload != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(operationBatchStatusPayload, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Gets the status of long running operation
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Payload to get the status of an 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> GetOperationStatusWithHttpMessagesAsync(string userName, OperationStatusPayload operationStatusPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (userName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "userName");
- }
- if (operationStatusPayload == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "operationStatusPayload");
- }
- if (operationStatusPayload != null)
- {
- operationStatusPayload.Validate();
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("userName", userName);
- tracingParameters.Add("operationStatusPayload", operationStatusPayload);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "GetOperationStatus", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.LabServices/users/{userName}/getOperationStatus").ToString();
- _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName));
- 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(operationStatusPayload != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(operationStatusPayload, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Get personal preferences for a user
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for any Environment operations like get, start, stop,
- /// connect
- ///
- ///
- /// 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> GetPersonalPreferencesWithHttpMessagesAsync(string userName, PersonalPerferencesOperationsPayload personalPerferencesOperationsPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (userName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "userName");
- }
- if (personalPerferencesOperationsPayload == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "personalPerferencesOperationsPayload");
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("userName", userName);
- tracingParameters.Add("personalPerferencesOperationsPayload", personalPerferencesOperationsPayload);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "GetPersonalPreferences", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.LabServices/users/{userName}/getPersonalPreferences").ToString();
- _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName));
- 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(personalPerferencesOperationsPayload != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(personalPerferencesOperationsPayload, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// List Environments for the user
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents the payload to list environments owned by a user
- ///
- ///
- /// 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> ListEnvironmentsWithHttpMessagesAsync(string userName, ListEnvironmentsPayload listEnvironmentsPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (userName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "userName");
- }
- if (listEnvironmentsPayload == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "listEnvironmentsPayload");
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("userName", userName);
- tracingParameters.Add("listEnvironmentsPayload", listEnvironmentsPayload);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "ListEnvironments", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.LabServices/users/{userName}/listEnvironments").ToString();
- _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName));
- 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(listEnvironmentsPayload != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(listEnvironmentsPayload, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// List labs for the user.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// 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> ListLabsWithHttpMessagesAsync(string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (userName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "userName");
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("userName", userName);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "ListLabs", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.LabServices/users/{userName}/listLabs").ToString();
- _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName));
- List _queryParameters = new List();
- if (Client.ApiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("POST");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Register a user to a managed lab
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for Register action.
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task RegisterWithHttpMessagesAsync(string userName, RegisterPayload registerPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (userName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "userName");
- }
- if (registerPayload == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "registerPayload");
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("userName", userName);
- tracingParameters.Add("registerPayload", registerPayload);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "Register", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.LabServices/users/{userName}/register").ToString();
- _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName));
- 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(registerPayload != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(registerPayload, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Resets the user password on an environment This operation can take a while
- /// to complete
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents the payload for resetting passwords.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task ResetPasswordWithHttpMessagesAsync(string userName, ResetPasswordPayload resetPasswordPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send request
- AzureOperationResponse _response = await BeginResetPasswordWithHttpMessagesAsync(userName, resetPasswordPayload, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Starts an environment by starting all resources inside the environment.
- /// This operation can take a while to complete
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for any Environment operations like get, start, stop,
- /// connect
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task StartEnvironmentWithHttpMessagesAsync(string userName, EnvironmentOperationsPayload environmentOperationsPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send request
- AzureOperationResponse _response = await BeginStartEnvironmentWithHttpMessagesAsync(userName, environmentOperationsPayload, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Stops an environment by stopping all resources inside the environment This
- /// operation can take a while to complete
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for any Environment operations like get, start, stop,
- /// connect
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task StopEnvironmentWithHttpMessagesAsync(string userName, EnvironmentOperationsPayload environmentOperationsPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send request
- AzureOperationResponse _response = await BeginStopEnvironmentWithHttpMessagesAsync(userName, environmentOperationsPayload, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Resets the user password on an environment This operation can take a while
- /// to complete
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents the payload for resetting passwords.
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task BeginResetPasswordWithHttpMessagesAsync(string userName, ResetPasswordPayload resetPasswordPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (userName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "userName");
- }
- if (resetPasswordPayload == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "resetPasswordPayload");
- }
- if (resetPasswordPayload != null)
- {
- resetPasswordPayload.Validate();
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("userName", userName);
- tracingParameters.Add("resetPasswordPayload", resetPasswordPayload);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginResetPassword", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.LabServices/users/{userName}/resetPassword").ToString();
- _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName));
- 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(resetPasswordPayload != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(resetPasswordPayload, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 202)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Starts an environment by starting all resources inside the environment.
- /// This operation can take a while to complete
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for any Environment operations like get, start, stop,
- /// connect
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task BeginStartEnvironmentWithHttpMessagesAsync(string userName, EnvironmentOperationsPayload environmentOperationsPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (userName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "userName");
- }
- if (environmentOperationsPayload == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentOperationsPayload");
- }
- if (environmentOperationsPayload != null)
- {
- environmentOperationsPayload.Validate();
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("userName", userName);
- tracingParameters.Add("environmentOperationsPayload", environmentOperationsPayload);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginStartEnvironment", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.LabServices/users/{userName}/startEnvironment").ToString();
- _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName));
- 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(environmentOperationsPayload != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(environmentOperationsPayload, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 202)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Stops an environment by stopping all resources inside the environment This
- /// operation can take a while to complete
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for any Environment operations like get, start, stop,
- /// connect
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task BeginStopEnvironmentWithHttpMessagesAsync(string userName, EnvironmentOperationsPayload environmentOperationsPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (userName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "userName");
- }
- if (environmentOperationsPayload == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "environmentOperationsPayload");
- }
- if (environmentOperationsPayload != null)
- {
- environmentOperationsPayload.Validate();
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("userName", userName);
- tracingParameters.Add("environmentOperationsPayload", environmentOperationsPayload);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginStopEnvironment", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.LabServices/users/{userName}/stopEnvironment").ToString();
- _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName));
- 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(environmentOperationsPayload != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(environmentOperationsPayload, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 202)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- }
-}
diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/GlobalUsersOperationsExtensions.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/GlobalUsersOperationsExtensions.cs
deleted file mode 100644
index 684e85ecd37d..000000000000
--- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/GlobalUsersOperationsExtensions.cs
+++ /dev/null
@@ -1,548 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.LabServices
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for GlobalUsersOperations.
- ///
- public static partial class GlobalUsersOperationsExtensions
- {
- ///
- /// Gets the virtual machine details
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for any Environment operations like get, start, stop,
- /// connect
- ///
- ///
- /// Specify the $expand query. Example: 'properties($expand=environment)'
- ///
- public static GetEnvironmentResponse GetEnvironment(this IGlobalUsersOperations operations, string userName, EnvironmentOperationsPayload environmentOperationsPayload, string expand = default(string))
- {
- return operations.GetEnvironmentAsync(userName, environmentOperationsPayload, expand).GetAwaiter().GetResult();
- }
-
- ///
- /// Gets the virtual machine details
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for any Environment operations like get, start, stop,
- /// connect
- ///
- ///
- /// Specify the $expand query. Example: 'properties($expand=environment)'
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task GetEnvironmentAsync(this IGlobalUsersOperations operations, string userName, EnvironmentOperationsPayload environmentOperationsPayload, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.GetEnvironmentWithHttpMessagesAsync(userName, environmentOperationsPayload, expand, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Get batch operation status
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Payload to get the status of an operation
- ///
- public static OperationBatchStatusResponse GetOperationBatchStatus(this IGlobalUsersOperations operations, string userName, OperationBatchStatusPayload operationBatchStatusPayload)
- {
- return operations.GetOperationBatchStatusAsync(userName, operationBatchStatusPayload).GetAwaiter().GetResult();
- }
-
- ///
- /// Get batch operation status
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Payload to get the status of an operation
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task GetOperationBatchStatusAsync(this IGlobalUsersOperations operations, string userName, OperationBatchStatusPayload operationBatchStatusPayload, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.GetOperationBatchStatusWithHttpMessagesAsync(userName, operationBatchStatusPayload, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Gets the status of long running operation
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Payload to get the status of an operation
- ///
- public static OperationStatusResponse GetOperationStatus(this IGlobalUsersOperations operations, string userName, OperationStatusPayload operationStatusPayload)
- {
- return operations.GetOperationStatusAsync(userName, operationStatusPayload).GetAwaiter().GetResult();
- }
-
- ///
- /// Gets the status of long running operation
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Payload to get the status of an operation
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task GetOperationStatusAsync(this IGlobalUsersOperations operations, string userName, OperationStatusPayload operationStatusPayload, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.GetOperationStatusWithHttpMessagesAsync(userName, operationStatusPayload, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Get personal preferences for a user
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for any Environment operations like get, start, stop,
- /// connect
- ///
- public static GetPersonalPreferencesResponse GetPersonalPreferences(this IGlobalUsersOperations operations, string userName, PersonalPerferencesOperationsPayload personalPerferencesOperationsPayload)
- {
- return operations.GetPersonalPreferencesAsync(userName, personalPerferencesOperationsPayload).GetAwaiter().GetResult();
- }
-
- ///
- /// Get personal preferences for a user
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for any Environment operations like get, start, stop,
- /// connect
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task GetPersonalPreferencesAsync(this IGlobalUsersOperations operations, string userName, PersonalPerferencesOperationsPayload personalPerferencesOperationsPayload, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.GetPersonalPreferencesWithHttpMessagesAsync(userName, personalPerferencesOperationsPayload, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// List Environments for the user
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents the payload to list environments owned by a user
- ///
- public static ListEnvironmentsResponse ListEnvironments(this IGlobalUsersOperations operations, string userName, ListEnvironmentsPayload listEnvironmentsPayload)
- {
- return operations.ListEnvironmentsAsync(userName, listEnvironmentsPayload).GetAwaiter().GetResult();
- }
-
- ///
- /// List Environments for the user
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents the payload to list environments owned by a user
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ListEnvironmentsAsync(this IGlobalUsersOperations operations, string userName, ListEnvironmentsPayload listEnvironmentsPayload, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListEnvironmentsWithHttpMessagesAsync(userName, listEnvironmentsPayload, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// List labs for the user.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- public static ListLabsResponse ListLabs(this IGlobalUsersOperations operations, string userName)
- {
- return operations.ListLabsAsync(userName).GetAwaiter().GetResult();
- }
-
- ///
- /// List labs for the user.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ListLabsAsync(this IGlobalUsersOperations operations, string userName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListLabsWithHttpMessagesAsync(userName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Register a user to a managed lab
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for Register action.
- ///
- public static void Register(this IGlobalUsersOperations operations, string userName, RegisterPayload registerPayload)
- {
- operations.RegisterAsync(userName, registerPayload).GetAwaiter().GetResult();
- }
-
- ///
- /// Register a user to a managed lab
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for Register action.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task RegisterAsync(this IGlobalUsersOperations operations, string userName, RegisterPayload registerPayload, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.RegisterWithHttpMessagesAsync(userName, registerPayload, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Resets the user password on an environment This operation can take a while
- /// to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents the payload for resetting passwords.
- ///
- public static void ResetPassword(this IGlobalUsersOperations operations, string userName, ResetPasswordPayload resetPasswordPayload)
- {
- operations.ResetPasswordAsync(userName, resetPasswordPayload).GetAwaiter().GetResult();
- }
-
- ///
- /// Resets the user password on an environment This operation can take a while
- /// to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents the payload for resetting passwords.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ResetPasswordAsync(this IGlobalUsersOperations operations, string userName, ResetPasswordPayload resetPasswordPayload, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.ResetPasswordWithHttpMessagesAsync(userName, resetPasswordPayload, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Starts an environment by starting all resources inside the environment.
- /// This operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for any Environment operations like get, start, stop,
- /// connect
- ///
- public static void StartEnvironment(this IGlobalUsersOperations operations, string userName, EnvironmentOperationsPayload environmentOperationsPayload)
- {
- operations.StartEnvironmentAsync(userName, environmentOperationsPayload).GetAwaiter().GetResult();
- }
-
- ///
- /// Starts an environment by starting all resources inside the environment.
- /// This operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for any Environment operations like get, start, stop,
- /// connect
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task StartEnvironmentAsync(this IGlobalUsersOperations operations, string userName, EnvironmentOperationsPayload environmentOperationsPayload, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.StartEnvironmentWithHttpMessagesAsync(userName, environmentOperationsPayload, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Stops an environment by stopping all resources inside the environment This
- /// operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for any Environment operations like get, start, stop,
- /// connect
- ///
- public static void StopEnvironment(this IGlobalUsersOperations operations, string userName, EnvironmentOperationsPayload environmentOperationsPayload)
- {
- operations.StopEnvironmentAsync(userName, environmentOperationsPayload).GetAwaiter().GetResult();
- }
-
- ///
- /// Stops an environment by stopping all resources inside the environment This
- /// operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for any Environment operations like get, start, stop,
- /// connect
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task StopEnvironmentAsync(this IGlobalUsersOperations operations, string userName, EnvironmentOperationsPayload environmentOperationsPayload, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.StopEnvironmentWithHttpMessagesAsync(userName, environmentOperationsPayload, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Resets the user password on an environment This operation can take a while
- /// to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents the payload for resetting passwords.
- ///
- public static void BeginResetPassword(this IGlobalUsersOperations operations, string userName, ResetPasswordPayload resetPasswordPayload)
- {
- operations.BeginResetPasswordAsync(userName, resetPasswordPayload).GetAwaiter().GetResult();
- }
-
- ///
- /// Resets the user password on an environment This operation can take a while
- /// to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents the payload for resetting passwords.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task BeginResetPasswordAsync(this IGlobalUsersOperations operations, string userName, ResetPasswordPayload resetPasswordPayload, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.BeginResetPasswordWithHttpMessagesAsync(userName, resetPasswordPayload, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Starts an environment by starting all resources inside the environment.
- /// This operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for any Environment operations like get, start, stop,
- /// connect
- ///
- public static void BeginStartEnvironment(this IGlobalUsersOperations operations, string userName, EnvironmentOperationsPayload environmentOperationsPayload)
- {
- operations.BeginStartEnvironmentAsync(userName, environmentOperationsPayload).GetAwaiter().GetResult();
- }
-
- ///
- /// Starts an environment by starting all resources inside the environment.
- /// This operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for any Environment operations like get, start, stop,
- /// connect
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task BeginStartEnvironmentAsync(this IGlobalUsersOperations operations, string userName, EnvironmentOperationsPayload environmentOperationsPayload, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.BeginStartEnvironmentWithHttpMessagesAsync(userName, environmentOperationsPayload, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Stops an environment by stopping all resources inside the environment This
- /// operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for any Environment operations like get, start, stop,
- /// connect
- ///
- public static void BeginStopEnvironment(this IGlobalUsersOperations operations, string userName, EnvironmentOperationsPayload environmentOperationsPayload)
- {
- operations.BeginStopEnvironmentAsync(userName, environmentOperationsPayload).GetAwaiter().GetResult();
- }
-
- ///
- /// Stops an environment by stopping all resources inside the environment This
- /// operation can take a while to complete
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the user.
- ///
- ///
- /// Represents payload for any Environment operations like get, start, stop,
- /// connect
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task BeginStopEnvironmentAsync(this IGlobalUsersOperations operations, string userName, EnvironmentOperationsPayload environmentOperationsPayload, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.BeginStopEnvironmentWithHttpMessagesAsync(userName, environmentOperationsPayload, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- }
-}
diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IEnvironmentSettingsOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IEnvironmentSettingsOperations.cs
deleted file mode 100644
index 20dfaeeb1f2c..000000000000
--- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IEnvironmentSettingsOperations.cs
+++ /dev/null
@@ -1,457 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.LabServices
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Microsoft.Rest.Azure.OData;
- using Models;
- using System.Collections;
- using System.Collections.Generic;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// EnvironmentSettingsOperations operations.
- ///
- public partial interface IEnvironmentSettingsOperations
- {
- ///
- /// List environment setting in a given lab.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// OData parameters to apply to the 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Get environment setting
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// Specify the $expand query. Example:
- /// 'properties($select=publishingState)'
- ///
- ///
- /// 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 labAccountName, string labName, string environmentSettingName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Create or replace an existing Environment Setting. This operation
- /// can take a while to complete
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// Represents settings of an environment, from which environment
- /// instances would be created
- ///
- ///
- /// 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 labAccountName, string labName, string environmentSettingName, EnvironmentSetting environmentSetting, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Delete environment setting. This operation can take a while to
- /// complete
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Modify properties of environment setting.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// Represents settings of an environment, from which environment
- /// instances would be created
- ///
- ///
- /// 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 labAccountName, string labName, string environmentSettingName, EnvironmentSettingFragment environmentSetting, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Claims a random environment for a user in an environment settings
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task ClaimAnyWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Provisions/deprovisions required resources for an environment
- /// setting based on current state of the lab/environment setting.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// Payload for Publish operation on EnvironmentSetting.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task PublishWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, PublishPayload publishPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Starts a template by starting all resources inside the template.
- /// This operation can take a while to complete
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task StartWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Starts a template by starting all resources inside the template.
- /// This operation can take a while to complete
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task StopWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Create or replace an existing Environment Setting. This operation
- /// can take a while to complete
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// Represents settings of an environment, from which environment
- /// instances would be created
- ///
- ///
- /// 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 labAccountName, string labName, string environmentSettingName, EnvironmentSetting environmentSetting, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Delete environment setting. This operation can take a while to
- /// complete
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Starts a template by starting all resources inside the template.
- /// This operation can take a while to complete
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Starts a template by starting all resources inside the template.
- /// This operation can take a while to complete
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task BeginStopWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// List environment setting in a given lab.
- ///
- ///
- /// 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/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IEnvironmentsOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IEnvironmentsOperations.cs
deleted file mode 100644
index d574d435ef9d..000000000000
--- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IEnvironmentsOperations.cs
+++ /dev/null
@@ -1,487 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.LabServices
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Microsoft.Rest.Azure.OData;
- using Models;
- using System.Collections;
- using System.Collections.Generic;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// EnvironmentsOperations operations.
- ///
- public partial interface IEnvironmentsOperations
- {
- ///
- /// List environments in a given environment setting.
- ///
- ///
- /// The name of the resource group.
- ///
- ///
- /// The name of the lab Account.
- ///
- ///
- /// The name of the lab.
- ///
- ///
- /// The name of the environment Setting.
- ///
- ///
- /// OData parameters to apply to the 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>> ListWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, ODataQuery odataQuery = default(ODataQuery), Dictionary