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> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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)' - /// - /// - /// 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 environmentName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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 - /// - /// - /// 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, string environmentName, Environment environment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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. - /// - /// - /// 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, string environmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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 - /// - /// - /// 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, string environmentName, EnvironmentFragment environment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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. - /// - /// - /// 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 ClaimWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task ResetPasswordWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, ResetPasswordPayload resetPasswordPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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. - /// - /// - /// 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, string environmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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. - /// - /// - /// 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, string environmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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. - /// - /// - /// 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, string environmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task BeginResetPasswordWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string environmentName, ResetPasswordPayload resetPasswordPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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. - /// - /// - /// 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, string environmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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. - /// - /// - /// 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, string environmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List environments in a given environment setting. - /// - /// - /// 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/IGalleryImagesOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IGalleryImagesOperations.cs deleted file mode 100644 index 56d7eaace1b3..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IGalleryImagesOperations.cs +++ /dev/null @@ -1,196 +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; - - /// - /// GalleryImagesOperations operations. - /// - public partial interface IGalleryImagesOperations - { - /// - /// List gallery images in a given lab account. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// 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, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get gallery image - /// - /// - /// 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 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 galleryImageName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create or replace an existing Gallery Image. - /// - /// - /// 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 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 galleryImageName, GalleryImage galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete gallery image. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// The name of the gallery Image. - /// - /// - /// 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 galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Modify properties of gallery images. - /// - /// - /// 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 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 galleryImageName, GalleryImageFragment galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List gallery images in a given lab account. - /// - /// - /// 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/IGlobalUsersOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IGlobalUsersOperations.cs deleted file mode 100644 index a69eef11ce71..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IGlobalUsersOperations.cs +++ /dev/null @@ -1,344 +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.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// GlobalUsersOperations operations. - /// - public partial interface IGlobalUsersOperations - { - /// - /// 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)' - /// - /// - /// 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> GetEnvironmentWithHttpMessagesAsync(string userName, EnvironmentOperationsPayload environmentOperationsPayload, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get batch operation status - /// - /// - /// The name of the user. - /// - /// - /// Payload to get the status of an 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> GetOperationBatchStatusWithHttpMessagesAsync(string userName, OperationBatchStatusPayload operationBatchStatusPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the status of long running operation - /// - /// - /// The name of the user. - /// - /// - /// Payload to get the status of an 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> GetOperationStatusWithHttpMessagesAsync(string userName, OperationStatusPayload operationStatusPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get personal preferences for a user - /// - /// - /// 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. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetPersonalPreferencesWithHttpMessagesAsync(string userName, PersonalPerferencesOperationsPayload personalPerferencesOperationsPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List Environments for the user - /// - /// - /// The name of the user. - /// - /// - /// Represents the payload to list environments owned by a user - /// - /// - /// 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> ListEnvironmentsWithHttpMessagesAsync(string userName, ListEnvironmentsPayload listEnvironmentsPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List labs for the user. - /// - /// - /// The name of the user. - /// - /// - /// 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> ListLabsWithHttpMessagesAsync(string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Register a user to a managed lab - /// - /// - /// The name of the user. - /// - /// - /// Represents payload for Register action. - /// - /// - /// 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 RegisterWithHttpMessagesAsync(string userName, RegisterPayload registerPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task ResetPasswordWithHttpMessagesAsync(string userName, ResetPasswordPayload resetPasswordPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task StartEnvironmentWithHttpMessagesAsync(string userName, EnvironmentOperationsPayload environmentOperationsPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task StopEnvironmentWithHttpMessagesAsync(string userName, EnvironmentOperationsPayload environmentOperationsPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task BeginResetPasswordWithHttpMessagesAsync(string userName, ResetPasswordPayload resetPasswordPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task BeginStartEnvironmentWithHttpMessagesAsync(string userName, EnvironmentOperationsPayload environmentOperationsPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task BeginStopEnvironmentWithHttpMessagesAsync(string userName, EnvironmentOperationsPayload environmentOperationsPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IImagesOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IImagesOperations.cs new file mode 100644 index 000000000000..2e9797e99005 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IImagesOperations.cs @@ -0,0 +1,187 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ImagesOperations operations. + /// + public partial interface IImagesOperations + { + /// + /// Gets all images. + /// + /// + /// Gets all images from galleries attached to a lab plan. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within + /// containing resource group. Used in resource URIs and in UI. + /// + /// + /// The filter 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>> ListByLabPlanWithHttpMessagesAsync(string resourceGroupName, string labPlanName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets an image. + /// + /// + /// Gets an image resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within + /// containing resource group. Used in resource URIs and in UI. + /// + /// + /// The image name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string labPlanName, string imageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates an image via PUT. + /// + /// + /// Updates an image resource via PUT. Creating new resources via PUT + /// will not function. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within + /// containing resource group. Used in resource URIs and in UI. + /// + /// + /// The image name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(Image body, string resourceGroupName, string labPlanName, string imageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates an image. + /// + /// + /// Updates an image resource. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within + /// containing resource group. Used in resource URIs and in UI. + /// + /// + /// The image name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(ImageUpdate body, string resourceGroupName, string labPlanName, string imageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all images. + /// + /// + /// Gets all images from galleries attached to a lab plan. + /// + /// + /// 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>> ListByLabPlanNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ILabAccountsOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ILabAccountsOperations.cs deleted file mode 100644 index 27c601d9c91c..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ILabAccountsOperations.cs +++ /dev/null @@ -1,300 +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; - - /// - /// LabAccountsOperations operations. - /// - public partial interface ILabAccountsOperations - { - /// - /// List lab accounts in a subscription. - /// - /// - /// 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>> ListBySubscriptionWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List lab accounts in a resource group. - /// - /// - /// The name of the resource group. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get lab account - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// Specify the $expand query. Example: - /// 'properties($expand=sizeConfiguration)' - /// - /// - /// 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 expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create or replace an existing Lab Account. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// Represents a lab account. - /// - /// - /// 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, LabAccount labAccount, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete lab account. This operation can take a while to complete - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// 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, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Modify properties of lab accounts. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// Represents a lab account. - /// - /// - /// 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, LabAccountFragment labAccount, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create a lab in a lab account. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// Properties for creating a managed lab and a default 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 CreateLabWithHttpMessagesAsync(string resourceGroupName, string labAccountName, CreateLabProperties createLabProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get regional availability information for each size category - /// configured under a lab account - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// 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> GetRegionalAvailabilityWithHttpMessagesAsync(string resourceGroupName, string labAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete lab account. This operation can take a while to complete - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// 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, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List lab accounts in a subscription. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List lab accounts in a resource group. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ILabPlansOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ILabPlansOperations.cs new file mode 100644 index 000000000000..f4cd44cbf174 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ILabPlansOperations.cs @@ -0,0 +1,402 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// LabPlansOperations operations. + /// + public partial interface ILabPlansOperations + { + /// + /// Get all lab plans for a subscription. + /// + /// + /// Returns a list of all lab plans within a subscription + /// + /// + /// The filter 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>> ListBySubscriptionWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all lab plans for a subscription and resource group. + /// + /// + /// Returns a list of all lab plans for a subscription and resource + /// group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves a Lab Plan resource. + /// + /// + /// Retrieves the properties of a Lab Plan. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within + /// containing resource group. Used in resource URIs and in UI. + /// + /// + /// 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 labPlanName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates or creates a Lab Plan resource. + /// + /// + /// Operation to create or update a Lab Plan resource. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within + /// containing resource group. Used in resource URIs and in UI. + /// + /// + /// 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(LabPlan body, string resourceGroupName, string labPlanName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a Lab Plan resource. + /// + /// + /// Operation to update a Lab Plan resource. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within + /// containing resource group. Used in resource URIs and in UI. + /// + /// + /// 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(LabPlanUpdate body, string resourceGroupName, string labPlanName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Lab Plan resource. + /// + /// + /// Operation to delete a Lab Plan resource. Deleting a lab plan does + /// not delete labs associated with a lab plan, nor does it delete + /// shared images added to a gallery via the lab plan permission + /// container. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within + /// containing resource group. Used in resource URIs and in UI. + /// + /// + /// 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 labPlanName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Save an image from a lab VM to the attached shared image gallery. + /// + /// + /// Saves an image from a lab VM to the attached shared image gallery. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within + /// containing resource group. Used in resource URIs and in UI. + /// + /// + /// 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 SaveImageWithHttpMessagesAsync(SaveImageBody body, string resourceGroupName, string labPlanName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates or creates a Lab Plan resource. + /// + /// + /// Operation to create or update a Lab Plan resource. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within + /// containing resource group. Used in resource URIs and in UI. + /// + /// + /// 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(LabPlan body, string resourceGroupName, string labPlanName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a Lab Plan resource. + /// + /// + /// Operation to update a Lab Plan resource. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within + /// containing resource group. Used in resource URIs and in UI. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(LabPlanUpdate body, string resourceGroupName, string labPlanName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Lab Plan resource. + /// + /// + /// Operation to delete a Lab Plan resource. Deleting a lab plan does + /// not delete labs associated with a lab plan, nor does it delete + /// shared images added to a gallery via the lab plan permission + /// container. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within + /// containing resource group. Used in resource URIs and in UI. + /// + /// + /// 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 labPlanName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Save an image from a lab VM to the attached shared image gallery. + /// + /// + /// Saves an image from a lab VM to the attached shared image gallery. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within + /// containing resource group. Used in resource URIs and in UI. + /// + /// + /// 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 BeginSaveImageWithHttpMessagesAsync(SaveImageBody body, string resourceGroupName, string labPlanName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all lab plans for a subscription. + /// + /// + /// Returns a list of all lab plans within a subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all lab plans for a subscription and resource group. + /// + /// + /// Returns a list of all lab plans for a subscription and resource + /// group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IManagedLabsClient.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ILabServicesClient.cs similarity index 76% rename from sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IManagedLabsClient.cs rename to sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ILabServicesClient.cs index 11fa97f251e6..17fe66f14866 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IManagedLabsClient.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ILabServicesClient.cs @@ -16,9 +16,8 @@ namespace Microsoft.Azure.Management.LabServices using Newtonsoft.Json; /// - /// The Managed Labs Client. /// - public partial interface IManagedLabsClient : System.IDisposable + public partial interface ILabServicesClient : System.IDisposable { /// /// The base URI of the service. @@ -41,12 +40,12 @@ public partial interface IManagedLabsClient : System.IDisposable ServiceClientCredentials Credentials { get; } /// - /// Client API version. + /// The API version to use for this operation. /// string ApiVersion { get; } /// - /// The subscription ID. + /// The ID of the target subscription. /// string SubscriptionId { get; set; } @@ -70,29 +69,24 @@ public partial interface IManagedLabsClient : System.IDisposable /// - /// Gets the IProviderOperations. + /// Gets the IOperations. /// - IProviderOperations ProviderOperations { get; } + IOperations Operations { get; } /// - /// Gets the IGlobalUsersOperations. + /// Gets the IOperationResultsOperations. /// - IGlobalUsersOperations GlobalUsers { get; } + IOperationResultsOperations OperationResults { get; } /// - /// Gets the ILabAccountsOperations. + /// Gets the ILabPlansOperations. /// - ILabAccountsOperations LabAccounts { get; } + ILabPlansOperations LabPlans { get; } /// - /// Gets the IOperations. + /// Gets the IImagesOperations. /// - IOperations Operations { get; } - - /// - /// Gets the IGalleryImagesOperations. - /// - IGalleryImagesOperations GalleryImages { get; } + IImagesOperations Images { get; } /// /// Gets the ILabsOperations. @@ -100,19 +94,19 @@ public partial interface IManagedLabsClient : System.IDisposable ILabsOperations Labs { get; } /// - /// Gets the IEnvironmentSettingsOperations. + /// Gets the IUsersOperations. /// - IEnvironmentSettingsOperations EnvironmentSettings { get; } + IUsersOperations Users { get; } /// - /// Gets the IEnvironmentsOperations. + /// Gets the IVirtualMachinesOperations. /// - IEnvironmentsOperations Environments { get; } + IVirtualMachinesOperations VirtualMachines { get; } /// - /// Gets the IUsersOperations. + /// Gets the ISchedulesOperations. /// - IUsersOperations Users { get; } + ISchedulesOperations Schedules { get; } } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ILabsOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ILabsOperations.cs index 119c3f218779..7eb5c4ed448c 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ILabsOperations.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ILabsOperations.cs @@ -12,7 +12,6 @@ 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; @@ -25,16 +24,38 @@ namespace Microsoft.Azure.Management.LabServices public partial interface ILabsOperations { /// - /// List labs in a given lab account. + /// Get all labs for a subscription. /// - /// - /// The name of the resource group. + /// + /// Returns a list of all labs for a subscription. + /// + /// + /// The filter to apply to the operation. + /// + /// + /// The headers that will be added to request. /// - /// - /// The name of the lab Account. + /// + /// The cancellation token. /// - /// - /// OData parameters to apply to the operation. + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all labs for a subscription and resource group. + /// + /// + /// Returns a list of all labs in a resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. /// /// /// The headers that will be added to request. @@ -42,7 +63,7 @@ public partial interface ILabsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -51,22 +72,19 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labAccountName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get lab + /// Get a lab resource. /// + /// + /// Returns the properties of a lab resource. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. - /// - /// - /// Specify the $expand query. Example: - /// 'properties($select=maxUsersInLab)' + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. /// /// /// The headers that will be added to request. @@ -74,7 +92,7 @@ public partial interface ILabsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -83,21 +101,22 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Create or replace an existing Lab. + /// Create or update a lab resource. /// - /// - /// The name of the resource group. + /// + /// Operation to create or update a lab resource. + /// + /// + /// The request body. /// - /// - /// The name of the lab Account. + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. - /// - /// - /// Represents a lab. + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. /// /// /// The headers that will be added to request. @@ -105,7 +124,7 @@ public partial interface ILabsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -114,18 +133,51 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, Lab lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(Lab body, string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete lab. This operation can take a while to complete + /// Update a lab resource. /// + /// + /// Operation to update a lab resource. + /// + /// + /// The request body. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// - /// - /// The name of the lab Account. + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// 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(LabUpdate body, string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a lab resource. + /// + /// + /// Operation to delete a lab resource. + /// + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. /// /// /// The headers that will be added to request. @@ -133,27 +185,81 @@ public partial interface ILabsOperations /// /// 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, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Modify properties of labs. + /// Publish or re-publish a lab. /// + /// + /// Publish or re-publish a lab. This will create or update all lab + /// resources, such as virtual machines. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// - /// - /// The name of the lab Account. + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// 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 labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Manually sync the lab group. + /// + /// + /// Action used to manually kick off an AAD group sync job. + /// + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. /// - /// - /// Represents a lab. + /// + /// 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 SyncGroupWithHttpMessagesAsync(string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a lab resource. + /// + /// + /// Operation to create or update a lab resource. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. /// /// /// The headers that will be added to request. @@ -161,7 +267,7 @@ public partial interface ILabsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -170,21 +276,22 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, LabFragment lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(Lab body, string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Add users to a lab + /// Update a lab resource. /// - /// - /// The name of the resource group. + /// + /// Operation to update a lab resource. + /// + /// + /// The request body. /// - /// - /// The name of the lab Account. + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. - /// - /// - /// Payload for Add Users operation on a Lab. + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. /// /// /// The headers that will be added to request. @@ -192,24 +299,28 @@ public partial interface ILabsOperations /// /// 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 AddUsersWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, AddUsersPayload addUsersPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginUpdateWithHttpMessagesAsync(LabUpdate body, string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Register to managed lab. + /// Deletes a lab resource. /// + /// + /// Operation to delete a lab resource. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. /// /// /// The headers that will be added to request. @@ -217,24 +328,52 @@ public partial interface ILabsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// - Task RegisterWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete lab. This operation can take a while to complete + /// Publish or re-publish a lab. /// + /// + /// Publish or re-publish a lab. This will create or update all lab + /// resources, such as virtual machines. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. /// - /// - /// The name of the lab Account. + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginPublishWithHttpMessagesAsync(string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Manually sync the lab group. + /// + /// + /// Action used to manually kick off an AAD group sync job. + /// + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. /// /// /// The headers that will be added to request. @@ -242,16 +381,44 @@ public partial interface ILabsOperations /// /// 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, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginSyncGroupWithHttpMessagesAsync(string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all labs for a subscription. + /// + /// + /// Returns a list of all labs for a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// List labs in a given lab account. + /// Get all labs for a subscription and resource group. /// + /// + /// Returns a list of all labs in a resource group. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -261,7 +428,7 @@ public partial interface ILabsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -270,6 +437,6 @@ public partial interface ILabsOperations /// /// Thrown when a required parameter is null /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IOperationResultsOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IOperationResultsOperations.cs new file mode 100644 index 000000000000..018d046be3d0 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IOperationResultsOperations.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OperationResultsOperations operations. + /// + public partial interface IOperationResultsOperations + { + /// + /// Get an azure operation result. + /// + /// + /// Returns an azure operation result. + /// + /// + /// The operation result ID / name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IOperations.cs index fe513d5f20b5..e85f6e4e0ac8 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IOperations.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IOperations.cs @@ -24,13 +24,35 @@ namespace Microsoft.Azure.Management.LabServices public partial interface IOperations { /// - /// Get operation + /// Get all operations /// - /// - /// The name of the location. + /// + /// Returns a list of all operations. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. /// - /// - /// The name of the operation. + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all operations + /// + /// + /// Returns a list of all operations. + /// + /// + /// The NextLink from the previous successful call to List operation. /// /// /// The headers that will be added to request. @@ -38,7 +60,7 @@ public partial interface IOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -47,6 +69,6 @@ public partial interface IOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string locationName, string operationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IProviderOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IProviderOperations.cs deleted file mode 100644 index 3953ba4dc044..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IProviderOperations.cs +++ /dev/null @@ -1,68 +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.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ProviderOperations operations. - /// - public partial interface IProviderOperations - { - /// - /// Result of the request to list REST API operations - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Result of the request to list REST API operations - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ISchedulesOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ISchedulesOperations.cs new file mode 100644 index 000000000000..6d0d3e69d09f --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ISchedulesOperations.cs @@ -0,0 +1,249 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SchedulesOperations operations. + /// + public partial interface ISchedulesOperations + { + /// + /// Get all schedules for a lab. + /// + /// + /// Returns a list of all schedules for a lab. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The filter 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>> ListByLabWithHttpMessagesAsync(string resourceGroupName, string labName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a lab Schedule. + /// + /// + /// Returns the properties of a lab Schedule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The name of the schedule that uniquely identifies it within + /// containing lab. Used in resource URIs. + /// + /// + /// 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 labName, string scheduleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a lab schedule. + /// + /// + /// Operation to create or update a lab schedule. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The name of the schedule that uniquely identifies it within + /// containing lab. Used in resource URIs. + /// + /// + /// 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(Schedule body, string resourceGroupName, string labName, string scheduleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a lab schedule. + /// + /// + /// Operation to update a lab schedule. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The name of the schedule that uniquely identifies it within + /// containing lab. Used in resource URIs. + /// + /// + /// 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(ScheduleUpdate body, string resourceGroupName, string labName, string scheduleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a schedule resource. + /// + /// + /// Operation to delete a schedule resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The name of the schedule that uniquely identifies it within + /// containing lab. Used in resource URIs. + /// + /// + /// 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 labName, string scheduleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a schedule resource. + /// + /// + /// Operation to delete a schedule resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The name of the schedule that uniquely identifies it within + /// containing lab. Used in resource URIs. + /// + /// + /// 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 labName, string scheduleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all schedules for a lab. + /// + /// + /// Returns a list of all schedules for a 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>> ListByLabNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IUsersOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IUsersOperations.cs index 5731f8c87967..74586844f46b 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IUsersOperations.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IUsersOperations.cs @@ -12,7 +12,6 @@ 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; @@ -25,19 +24,20 @@ namespace Microsoft.Azure.Management.LabServices public partial interface IUsersOperations { /// - /// List users in a given lab. + /// Get all users for a lab. /// + /// + /// Returns a list of all users for a lab. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. /// - /// - /// OData parameters to apply to the operation. + /// + /// The filter to apply to the operation. /// /// /// The headers that will be added to request. @@ -45,7 +45,7 @@ public partial interface IUsersOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -54,24 +54,23 @@ public partial interface IUsersOperations /// /// 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)); + Task>> ListByLabWithHttpMessagesAsync(string resourceGroupName, string labName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get user + /// Get a lab user. /// + /// + /// Returns the properties of a lab user. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. /// /// - /// The name of the user. - /// - /// - /// Specify the $expand query. Example: 'properties($select=email)' + /// The name of the user that uniquely identifies it within containing + /// lab. Used in resource URIs. /// /// /// The headers that will be added to request. @@ -79,7 +78,7 @@ public partial interface IUsersOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -88,24 +87,26 @@ public partial interface IUsersOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string userName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Create or replace an existing User. + /// Create or update a lab user. /// - /// - /// The name of the resource group. + /// + /// Operation to create or update a lab user. + /// + /// + /// The request body. /// - /// - /// The name of the lab Account. + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. /// /// - /// The name of the user. - /// - /// - /// The User registered to a lab + /// The name of the user that uniquely identifies it within containing + /// lab. Used in resource URIs. /// /// /// The headers that will be added to request. @@ -113,7 +114,7 @@ public partial interface IUsersOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -122,21 +123,59 @@ public partial interface IUsersOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string userName, User user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(User body, string resourceGroupName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete user. This operation can take a while to complete + /// Update a lab user. /// + /// + /// Operation to update a lab user. + /// + /// + /// The request body. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. /// - /// - /// The name of the lab Account. + /// + /// The name of the user that uniquely identifies it within containing + /// lab. Used in resource URIs. + /// + /// + /// 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(UserUpdate body, string resourceGroupName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a user resource. + /// + /// + /// Operation to delete a user resource. + /// + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. /// /// - /// The name of the user. + /// The name of the user that uniquely identifies it within containing + /// lab. Used in resource URIs. /// /// /// The headers that will be added to request. @@ -144,30 +183,101 @@ public partial interface IUsersOperations /// /// 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 userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Modify properties of users. + /// Invite a user to a lab. /// + /// + /// Operation to invite a user to a lab. + /// + /// + /// The request body. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The name of the user that uniquely identifies it within containing + /// lab. Used in resource URIs. + /// + /// + /// The headers that will be added to request. /// - /// - /// The name of the lab Account. + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task InviteWithHttpMessagesAsync(InviteBody body, string resourceGroupName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a lab user. + /// + /// + /// Operation to create or update a lab user. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. /// /// - /// The name of the user. + /// The name of the user that uniquely identifies it within containing + /// lab. Used in resource URIs. + /// + /// + /// 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(User body, string resourceGroupName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a lab user. + /// + /// + /// Operation to update a lab user. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. /// - /// - /// The User registered to a lab + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The name of the user that uniquely identifies it within containing + /// lab. Used in resource URIs. /// /// /// The headers that will be added to request. @@ -175,7 +285,7 @@ public partial interface IUsersOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -184,21 +294,56 @@ public partial interface IUsersOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string userName, UserFragment user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginUpdateWithHttpMessagesAsync(UserUpdate body, string resourceGroupName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete user. This operation can take a while to complete + /// Deletes a user resource. /// + /// + /// Operation to delete a user resource. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The name of the user that uniquely identifies it within containing + /// lab. Used in resource URIs. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. /// - /// - /// The name of the lab Account. + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Invite a user to a lab. + /// + /// + /// Operation to invite a user to a lab. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. /// /// - /// The name of the user. + /// The name of the user that uniquely identifies it within containing + /// lab. Used in resource URIs. /// /// /// The headers that will be added to request. @@ -206,16 +351,19 @@ public partial interface IUsersOperations /// /// 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 userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginInviteWithHttpMessagesAsync(InviteBody body, string resourceGroupName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// List users in a given lab. + /// Get all users for a lab. /// + /// + /// Returns a list of all users for a lab. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -225,7 +373,7 @@ public partial interface IUsersOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -234,6 +382,6 @@ public partial interface IUsersOperations /// /// Thrown when a required parameter is null /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByLabNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IVirtualMachinesOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IVirtualMachinesOperations.cs new file mode 100644 index 000000000000..830b9c2a47b1 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IVirtualMachinesOperations.cs @@ -0,0 +1,431 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachinesOperations operations. + /// + public partial interface IVirtualMachinesOperations + { + /// + /// Get all virtual machines for a lab. + /// + /// + /// Returns a list of all virtual machines for a lab. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The filter 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>> ListByLabWithHttpMessagesAsync(string resourceGroupName, string labName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a lab virtual machine. + /// + /// + /// Returns the properties for a lab virtual machine. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within + /// the containing lab. Used in resource URIs. + /// + /// + /// 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 labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Start a lab virtual machine. + /// + /// + /// Action to start a lab virtual machine. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within + /// the containing lab. Used in resource URIs. + /// + /// + /// 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 labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stop a lab virtual machine. + /// + /// + /// Action to stop a lab virtual machine. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within + /// the containing lab. Used in resource URIs. + /// + /// + /// 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 labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Re-image a lab virtual machine. + /// + /// + /// Re-image a lab virtual machine. The virtual machine will be deleted + /// and recreated using the latest published snapshot of the reference + /// environment of the lab. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within + /// the containing lab. Used in resource URIs. + /// + /// + /// 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 ReimageWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Redeploy a lab virtual machine to a different compute node. For + /// troubleshooting connectivity. + /// + /// + /// Action to redeploy a lab virtual machine to a different compute + /// node. For troubleshooting connectivity. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within + /// the containing lab. Used in resource URIs. + /// + /// + /// 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 RedeployWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reset a lab virtual machine password. + /// + /// + /// Resets a lab virtual machine password. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within + /// the containing lab. Used in resource URIs. + /// + /// + /// 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 ResetPasswordWithHttpMessagesAsync(ResetPasswordBody body, string resourceGroupName, string labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Start a lab virtual machine. + /// + /// + /// Action to start a lab virtual machine. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within + /// the containing lab. Used in resource URIs. + /// + /// + /// 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 labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stop a lab virtual machine. + /// + /// + /// Action to stop a lab virtual machine. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within + /// the containing lab. Used in resource URIs. + /// + /// + /// 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 labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Re-image a lab virtual machine. + /// + /// + /// Re-image a lab virtual machine. The virtual machine will be deleted + /// and recreated using the latest published snapshot of the reference + /// environment of the lab. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within + /// the containing lab. Used in resource URIs. + /// + /// + /// 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 BeginReimageWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Redeploy a lab virtual machine to a different compute node. For + /// troubleshooting connectivity. + /// + /// + /// Action to redeploy a lab virtual machine to a different compute + /// node. For troubleshooting connectivity. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within + /// the containing lab. Used in resource URIs. + /// + /// + /// 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 BeginRedeployWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reset a lab virtual machine password. + /// + /// + /// Resets a lab virtual machine password. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing + /// lab account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within + /// the containing lab. Used in resource URIs. + /// + /// + /// 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 BeginResetPasswordWithHttpMessagesAsync(ResetPasswordBody body, string resourceGroupName, string labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all virtual machines for a lab. + /// + /// + /// Returns a list of all virtual machines for a 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>> ListByLabNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ImagesOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ImagesOperations.cs new file mode 100644 index 000000000000..a9a8dc761e0f --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ImagesOperations.cs @@ -0,0 +1,1258 @@ +// +// 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; + + /// + /// ImagesOperations operations. + /// + internal partial class ImagesOperations : IServiceOperations, IImagesOperations + { + /// + /// Initializes a new instance of the ImagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ImagesOperations(LabServicesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the LabServicesClient + /// + public LabServicesClient Client { get; private set; } + + /// + /// Gets all images. + /// + /// + /// Gets all images from galleries attached to a lab plan. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The filter 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>> ListByLabPlanWithHttpMessagesAsync(string resourceGroupName, string labPlanName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (labPlanName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labPlanName"); + } + if (labPlanName != null) + { + if (labPlanName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labPlanName", 100); + } + if (labPlanName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labPlanName", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labPlanName", labPlanName); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLabPlan", 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/labPlans/{labPlanName}/images").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labPlanName}", System.Uri.EscapeDataString(labPlanName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets an image. + /// + /// + /// Gets an image resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The image name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labPlanName, string imageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (labPlanName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labPlanName"); + } + if (labPlanName != null) + { + if (labPlanName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labPlanName", 100); + } + if (labPlanName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labPlanName", 1); + } + } + if (imageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "imageName"); + } + if (imageName != null) + { + if (imageName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "imageName", 100); + } + if (imageName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "imageName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(imageName, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "imageName", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labPlanName", labPlanName); + tracingParameters.Add("imageName", imageName); + 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/labPlans/{labPlanName}/images/{imageName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labPlanName}", System.Uri.EscapeDataString(labPlanName)); + _url = _url.Replace("{imageName}", System.Uri.EscapeDataString(imageName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates an image via PUT. + /// + /// + /// Updates an image resource via PUT. Creating new resources via PUT will not + /// function. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The image name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(Image body, string resourceGroupName, string labPlanName, string imageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (labPlanName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labPlanName"); + } + if (labPlanName != null) + { + if (labPlanName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labPlanName", 100); + } + if (labPlanName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labPlanName", 1); + } + } + if (imageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "imageName"); + } + if (imageName != null) + { + if (imageName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "imageName", 100); + } + if (imageName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "imageName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(imageName, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "imageName", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labPlanName", labPlanName); + tracingParameters.Add("imageName", imageName); + 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/labPlans/{labPlanName}/images/{imageName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labPlanName}", System.Uri.EscapeDataString(labPlanName)); + _url = _url.Replace("{imageName}", System.Uri.EscapeDataString(imageName)); + 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(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates an image. + /// + /// + /// Updates an image resource. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The image name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(ImageUpdate body, string resourceGroupName, string labPlanName, string imageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (labPlanName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labPlanName"); + } + if (labPlanName != null) + { + if (labPlanName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labPlanName", 100); + } + if (labPlanName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labPlanName", 1); + } + } + if (imageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "imageName"); + } + if (imageName != null) + { + if (imageName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "imageName", 100); + } + if (imageName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "imageName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(imageName, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "imageName", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labPlanName", labPlanName); + tracingParameters.Add("imageName", imageName); + 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/labPlans/{labPlanName}/images/{imageName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labPlanName}", System.Uri.EscapeDataString(labPlanName)); + _url = _url.Replace("{imageName}", System.Uri.EscapeDataString(imageName)); + 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(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all images. + /// + /// + /// Gets all images from galleries attached to a lab plan. + /// + /// + /// 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>> ListByLabPlanNextWithHttpMessagesAsync(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, "ListByLabPlanNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ImagesOperationsExtensions.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ImagesOperationsExtensions.cs new file mode 100644 index 000000000000..088e76b61f89 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ImagesOperationsExtensions.cs @@ -0,0 +1,295 @@ +// +// 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 ImagesOperations. + /// + public static partial class ImagesOperationsExtensions + { + /// + /// Gets all images. + /// + /// + /// Gets all images from galleries attached to a lab plan. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The filter to apply to the operation. + /// + public static IPage ListByLabPlan(this IImagesOperations operations, string resourceGroupName, string labPlanName, string filter = default(string)) + { + return operations.ListByLabPlanAsync(resourceGroupName, labPlanName, filter).GetAwaiter().GetResult(); + } + + /// + /// Gets all images. + /// + /// + /// Gets all images from galleries attached to a lab plan. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The filter to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLabPlanAsync(this IImagesOperations operations, string resourceGroupName, string labPlanName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLabPlanWithHttpMessagesAsync(resourceGroupName, labPlanName, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets an image. + /// + /// + /// Gets an image resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The image name. + /// + public static Image Get(this IImagesOperations operations, string resourceGroupName, string labPlanName, string imageName) + { + return operations.GetAsync(resourceGroupName, labPlanName, imageName).GetAwaiter().GetResult(); + } + + /// + /// Gets an image. + /// + /// + /// Gets an image resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The image name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IImagesOperations operations, string resourceGroupName, string labPlanName, string imageName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labPlanName, imageName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates an image via PUT. + /// + /// + /// Updates an image resource via PUT. Creating new resources via PUT will not + /// function. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The image name. + /// + public static Image CreateOrUpdate(this IImagesOperations operations, Image body, string resourceGroupName, string labPlanName, string imageName) + { + return operations.CreateOrUpdateAsync(body, resourceGroupName, labPlanName, imageName).GetAwaiter().GetResult(); + } + + /// + /// Updates an image via PUT. + /// + /// + /// Updates an image resource via PUT. Creating new resources via PUT will not + /// function. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The image name. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IImagesOperations operations, Image body, string resourceGroupName, string labPlanName, string imageName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(body, resourceGroupName, labPlanName, imageName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates an image. + /// + /// + /// Updates an image resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The image name. + /// + public static Image Update(this IImagesOperations operations, ImageUpdate body, string resourceGroupName, string labPlanName, string imageName) + { + return operations.UpdateAsync(body, resourceGroupName, labPlanName, imageName).GetAwaiter().GetResult(); + } + + /// + /// Updates an image. + /// + /// + /// Updates an image resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The image name. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IImagesOperations operations, ImageUpdate body, string resourceGroupName, string labPlanName, string imageName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(body, resourceGroupName, labPlanName, imageName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all images. + /// + /// + /// Gets all images from galleries attached to a lab plan. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByLabPlanNext(this IImagesOperations operations, string nextPageLink) + { + return operations.ListByLabPlanNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all images. + /// + /// + /// Gets all images from galleries attached to a lab plan. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLabPlanNextAsync(this IImagesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLabPlanNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabAccountsOperationsExtensions.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabAccountsOperationsExtensions.cs deleted file mode 100644 index b1d1d876345c..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabAccountsOperationsExtensions.cs +++ /dev/null @@ -1,465 +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 LabAccountsOperations. - /// - public static partial class LabAccountsOperationsExtensions - { - /// - /// List lab accounts in a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage ListBySubscription(this ILabAccountsOperations operations, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListBySubscriptionAsync(odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List lab accounts in a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionAsync(this ILabAccountsOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List lab accounts in a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage ListByResourceGroup(this ILabAccountsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListByResourceGroupAsync(resourceGroupName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List lab accounts in a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAsync(this ILabAccountsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get lab account - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// Specify the $expand query. Example: 'properties($expand=sizeConfiguration)' - /// - public static LabAccount Get(this ILabAccountsOperations operations, string resourceGroupName, string labAccountName, string expand = default(string)) - { - return operations.GetAsync(resourceGroupName, labAccountName, expand).GetAwaiter().GetResult(); - } - - /// - /// Get lab account - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// Specify the $expand query. Example: 'properties($expand=sizeConfiguration)' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ILabAccountsOperations operations, string resourceGroupName, string labAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labAccountName, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or replace an existing Lab Account. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// Represents a lab account. - /// - public static LabAccount CreateOrUpdate(this ILabAccountsOperations operations, string resourceGroupName, string labAccountName, LabAccount labAccount) - { - return operations.CreateOrUpdateAsync(resourceGroupName, labAccountName, labAccount).GetAwaiter().GetResult(); - } - - /// - /// Create or replace an existing Lab Account. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// Represents a lab account. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this ILabAccountsOperations operations, string resourceGroupName, string labAccountName, LabAccount labAccount, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labAccountName, labAccount, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete lab account. 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. - /// - public static void Delete(this ILabAccountsOperations operations, string resourceGroupName, string labAccountName) - { - operations.DeleteAsync(resourceGroupName, labAccountName).GetAwaiter().GetResult(); - } - - /// - /// Delete lab account. 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 cancellation token. - /// - public static async Task DeleteAsync(this ILabAccountsOperations operations, string resourceGroupName, string labAccountName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labAccountName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Modify properties of lab accounts. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// Represents a lab account. - /// - public static LabAccount Update(this ILabAccountsOperations operations, string resourceGroupName, string labAccountName, LabAccountFragment labAccount) - { - return operations.UpdateAsync(resourceGroupName, labAccountName, labAccount).GetAwaiter().GetResult(); - } - - /// - /// Modify properties of lab accounts. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// Represents a lab account. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this ILabAccountsOperations operations, string resourceGroupName, string labAccountName, LabAccountFragment labAccount, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labAccountName, labAccount, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create a lab in a lab account. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// Properties for creating a managed lab and a default environment setting - /// - public static void CreateLab(this ILabAccountsOperations operations, string resourceGroupName, string labAccountName, CreateLabProperties createLabProperties) - { - operations.CreateLabAsync(resourceGroupName, labAccountName, createLabProperties).GetAwaiter().GetResult(); - } - - /// - /// Create a lab in a lab account. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// Properties for creating a managed lab and a default environment setting - /// - /// - /// The cancellation token. - /// - public static async Task CreateLabAsync(this ILabAccountsOperations operations, string resourceGroupName, string labAccountName, CreateLabProperties createLabProperties, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.CreateLabWithHttpMessagesAsync(resourceGroupName, labAccountName, createLabProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Get regional availability information for each size category configured - /// under a lab account - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - public static GetRegionalAvailabilityResponse GetRegionalAvailability(this ILabAccountsOperations operations, string resourceGroupName, string labAccountName) - { - return operations.GetRegionalAvailabilityAsync(resourceGroupName, labAccountName).GetAwaiter().GetResult(); - } - - /// - /// Get regional availability information for each size category configured - /// under a lab account - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// The cancellation token. - /// - public static async Task GetRegionalAvailabilityAsync(this ILabAccountsOperations operations, string resourceGroupName, string labAccountName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetRegionalAvailabilityWithHttpMessagesAsync(resourceGroupName, labAccountName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete lab account. 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. - /// - public static void BeginDelete(this ILabAccountsOperations operations, string resourceGroupName, string labAccountName) - { - operations.BeginDeleteAsync(resourceGroupName, labAccountName).GetAwaiter().GetResult(); - } - - /// - /// Delete lab account. 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 cancellation token. - /// - public static async Task BeginDeleteAsync(this ILabAccountsOperations operations, string resourceGroupName, string labAccountName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labAccountName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// List lab accounts in a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListBySubscriptionNext(this ILabAccountsOperations operations, string nextPageLink) - { - return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List lab accounts in a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionNextAsync(this ILabAccountsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List lab accounts in a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByResourceGroupNext(this ILabAccountsOperations operations, string nextPageLink) - { - return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List lab accounts in a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupNextAsync(this ILabAccountsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabAccountsOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabPlansOperations.cs similarity index 73% rename from sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabAccountsOperations.cs rename to sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabPlansOperations.cs index 00a1f7a24bb8..ec906edcae09 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabAccountsOperations.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabPlansOperations.cs @@ -12,7 +12,6 @@ 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; @@ -24,12 +23,12 @@ namespace Microsoft.Azure.Management.LabServices using System.Threading.Tasks; /// - /// LabAccountsOperations operations. + /// LabPlansOperations operations. /// - internal partial class LabAccountsOperations : IServiceOperations, ILabAccountsOperations + internal partial class LabPlansOperations : IServiceOperations, ILabPlansOperations { /// - /// Initializes a new instance of the LabAccountsOperations class. + /// Initializes a new instance of the LabPlansOperations class. /// /// /// Reference to the service client. @@ -37,7 +36,7 @@ internal partial class LabAccountsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal LabAccountsOperations(ManagedLabsClient client) + internal LabPlansOperations(LabServicesClient client) { if (client == null) { @@ -47,15 +46,18 @@ internal LabAccountsOperations(ManagedLabsClient client) } /// - /// Gets a reference to the ManagedLabsClient + /// Gets a reference to the LabServicesClient /// - public ManagedLabsClient Client { get; private set; } + public LabServicesClient Client { get; private set; } /// - /// List lab accounts in a subscription. + /// Get all lab plans for a subscription. /// - /// - /// OData parameters to apply to the operation. + /// + /// Returns a list of all lab plans within a subscription + /// + /// + /// The filter to apply to the operation. /// /// /// Headers that will be added to request. @@ -63,7 +65,7 @@ internal LabAccountsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -78,15 +80,29 @@ internal LabAccountsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListBySubscriptionWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListBySubscriptionWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ApiVersion == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -95,27 +111,23 @@ internal LabAccountsOperations(ManagedLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labaccounts").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labPlans").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); 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 (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -176,14 +188,13 @@ internal LabAccountsOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -193,10 +204,6 @@ internal LabAccountsOperations(ManagedLabsClient client) } 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); @@ -209,7 +216,7 @@ internal LabAccountsOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -222,7 +229,7 @@ internal LabAccountsOperations(ManagedLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -242,13 +249,13 @@ internal LabAccountsOperations(ManagedLabsClient client) } /// - /// List lab accounts in a resource group. + /// Get all lab plans for a subscription and resource group. /// + /// + /// Returns a list of all lab plans for a subscription and resource group. + /// /// - /// The name of the resource group. - /// - /// - /// OData parameters to apply to the operation. + /// The name of the resource group. The name is case insensitive. /// /// /// Headers that will be added to request. @@ -256,7 +263,7 @@ internal LabAccountsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -271,19 +278,44 @@ internal LabAccountsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (Client.ApiVersion == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -292,25 +324,16 @@ internal LabAccountsOperations(ManagedLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); 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))); @@ -375,14 +398,13 @@ internal LabAccountsOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -392,10 +414,6 @@ internal LabAccountsOperations(ManagedLabsClient client) } 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); @@ -408,7 +426,7 @@ internal LabAccountsOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -421,7 +439,7 @@ internal LabAccountsOperations(ManagedLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -441,16 +459,17 @@ internal LabAccountsOperations(ManagedLabsClient client) } /// - /// Get lab account + /// Retrieves a Lab Plan resource. /// + /// + /// Retrieves the properties of a Lab Plan. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// - /// - /// Specify the $expand query. Example: 'properties($expand=sizeConfiguration)' + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. /// /// /// Headers that will be added to request. @@ -458,7 +477,7 @@ internal LabAccountsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -473,23 +492,59 @@ internal LabAccountsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labPlanName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } - if (Client.ApiVersion == null) + if (labPlanName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "labPlanName"); + } + if (labPlanName != null) + { + if (labPlanName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labPlanName", 100); + } + if (labPlanName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labPlanName", 1); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -499,22 +554,17 @@ internal LabAccountsOperations(ManagedLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); - tracingParameters.Add("expand", expand); + tracingParameters.Add("labPlanName", labPlanName); 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}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}").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("{labPlanName}", System.Uri.EscapeDataString(labPlanName)); 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))); @@ -579,14 +629,13 @@ internal LabAccountsOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -596,10 +645,6 @@ internal LabAccountsOperations(ManagedLabsClient client) } 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); @@ -612,7 +657,7 @@ internal LabAccountsOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -625,7 +670,7 @@ internal LabAccountsOperations(ManagedLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -645,16 +690,135 @@ internal LabAccountsOperations(ManagedLabsClient client) } /// - /// Create or replace an existing Lab Account. + /// Updates or creates a Lab Plan resource. + /// + /// + /// Operation to create or update a Lab Plan resource. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(LabPlan body, string resourceGroupName, string labPlanName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(body, resourceGroupName, labPlanName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a Lab Plan resource. + /// + /// + /// Operation to update a Lab Plan resource. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(LabPlanUpdate body, string resourceGroupName, string labPlanName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(body, resourceGroupName, labPlanName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a Lab Plan resource. + /// + /// + /// Operation to delete a Lab Plan resource. Deleting a lab plan does not + /// delete labs associated with a lab plan, nor does it delete shared images + /// added to a gallery via the lab plan permission container. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labPlanName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labPlanName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Save an image from a lab VM to the attached shared image gallery. /// + /// + /// Saves an image from a lab VM to the attached shared image gallery. + /// + /// + /// The request body. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// - /// - /// The name of the lab Account. + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. /// - /// - /// Represents a lab account. + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task SaveImageWithHttpMessagesAsync(SaveImageBody body, string resourceGroupName, string labPlanName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginSaveImageWithHttpMessagesAsync(body, resourceGroupName, labPlanName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates or creates a Lab Plan resource. + /// + /// + /// Operation to create or update a Lab Plan resource. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. /// /// /// Headers that will be added to request. @@ -662,7 +826,7 @@ internal LabAccountsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -677,27 +841,67 @@ internal LabAccountsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labAccountName, LabAccount labAccount, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(LabPlan body, string resourceGroupName, string labPlanName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } - if (labAccount == null) + if (labPlanName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccount"); + throw new ValidationException(ValidationRules.CannotBeNull, "labPlanName"); } - if (Client.ApiVersion == null) + if (labPlanName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (labPlanName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labPlanName", 100); + } + if (labPlanName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labPlanName", 1); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -706,18 +910,18 @@ internal LabAccountsOperations(ManagedLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); - tracingParameters.Add("labAccount", labAccount); + tracingParameters.Add("labPlanName", labPlanName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}").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("{labPlanName}", System.Uri.EscapeDataString(labPlanName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -761,9 +965,9 @@ internal LabAccountsOperations(ManagedLabsClient client) // Serialize Request string _requestContent = null; - if(labAccount != null) + if(body != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(labAccount, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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"); } @@ -787,16 +991,15 @@ internal LabAccountsOperations(ManagedLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -806,10 +1009,6 @@ internal LabAccountsOperations(ManagedLabsClient client) } 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); @@ -822,7 +1021,7 @@ internal LabAccountsOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -835,7 +1034,7 @@ internal LabAccountsOperations(ManagedLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -853,7 +1052,25 @@ internal LabAccountsOperations(ManagedLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -873,38 +1090,20 @@ internal LabAccountsOperations(ManagedLabsClient client) } /// - /// Delete lab account. This operation can take a while to complete + /// Updates a Lab Plan resource. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// + /// Operation to update a Lab Plan resource. + /// + /// + /// The request body. /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labAccountName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Modify properties of lab accounts. - /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// - /// - /// Represents a lab account. + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. /// /// /// Headers that will be added to request. @@ -912,7 +1111,7 @@ internal LabAccountsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -927,27 +1126,63 @@ internal LabAccountsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labAccountName, LabAccountFragment labAccount, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(LabPlanUpdate body, string resourceGroupName, string labPlanName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } - if (labAccount == null) + if (labPlanName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccount"); + throw new ValidationException(ValidationRules.CannotBeNull, "labPlanName"); } - if (Client.ApiVersion == null) + if (labPlanName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (labPlanName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labPlanName", 100); + } + if (labPlanName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labPlanName", 1); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -956,18 +1191,18 @@ internal LabAccountsOperations(ManagedLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); - tracingParameters.Add("labAccount", labAccount); + tracingParameters.Add("labPlanName", labPlanName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}").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("{labPlanName}", System.Uri.EscapeDataString(labPlanName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -1011,9 +1246,9 @@ internal LabAccountsOperations(ManagedLabsClient client) // Serialize Request string _requestContent = null; - if(labAccount != null) + if(body != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(labAccount, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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"); } @@ -1037,16 +1272,15 @@ internal LabAccountsOperations(ManagedLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1056,10 +1290,6 @@ internal LabAccountsOperations(ManagedLabsClient client) } 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); @@ -1072,7 +1302,7 @@ internal LabAccountsOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1085,7 +1315,25 @@ internal LabAccountsOperations(ManagedLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1105,16 +1353,19 @@ internal LabAccountsOperations(ManagedLabsClient client) } /// - /// Create a lab in a lab account. + /// Deletes a Lab Plan resource. /// + /// + /// Operation to delete a Lab Plan resource. Deleting a lab plan does not + /// delete labs associated with a lab plan, nor does it delete shared images + /// added to a gallery via the lab plan permission container. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// - /// - /// The name of the lab Account. - /// - /// - /// Properties for creating a managed lab and a default environment setting + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. /// /// /// Headers that will be added to request. @@ -1122,7 +1373,7 @@ internal LabAccountsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1134,31 +1385,59 @@ internal LabAccountsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task CreateLabWithHttpMessagesAsync(string resourceGroupName, string labAccountName, CreateLabProperties createLabProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labPlanName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } } - if (labAccountName == null) + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (createLabProperties == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "createLabProperties"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } - if (createLabProperties != null) + if (labPlanName == null) { - createLabProperties.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "labPlanName"); } - if (Client.ApiVersion == null) + if (labPlanName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (labPlanName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labPlanName", 100); + } + if (labPlanName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labPlanName", 1); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1168,17 +1447,16 @@ internal LabAccountsOperations(ManagedLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); - tracingParameters.Add("createLabProperties", createLabProperties); + tracingParameters.Add("labPlanName", labPlanName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateLab", tracingParameters); + 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}/createLab").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}").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("{labPlanName}", System.Uri.EscapeDataString(labPlanName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -1191,7 +1469,7 @@ internal LabAccountsOperations(ManagedLabsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1222,12 +1500,6 @@ internal LabAccountsOperations(ManagedLabsClient client) // Serialize Request string _requestContent = null; - if(createLabProperties != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(createLabProperties, 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) { @@ -1248,16 +1520,15 @@ internal LabAccountsOperations(ManagedLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1267,10 +1538,6 @@ internal LabAccountsOperations(ManagedLabsClient client) } 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); @@ -1298,14 +1565,20 @@ internal LabAccountsOperations(ManagedLabsClient client) } /// - /// Get regional availability information for each size category configured - /// under a lab account + /// Save an image from a lab VM to the attached shared image gallery. /// + /// + /// Saves an image from a lab VM to the attached shared image gallery. + /// + /// + /// The request body. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// - /// - /// The name of the lab Account. + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. /// /// /// Headers that will be added to request. @@ -1313,12 +1586,9 @@ internal LabAccountsOperations(ManagedLabsClient client) /// /// 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 /// @@ -1328,217 +1598,64 @@ internal LabAccountsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetRegionalAvailabilityWithHttpMessagesAsync(string resourceGroupName, string labAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginSaveImageWithHttpMessagesAsync(SaveImageBody body, string resourceGroupName, string labPlanName, 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) + if (body == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + throw new ValidationException(ValidationRules.CannotBeNull, "body"); } 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("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetRegionalAvailability", 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}/getRegionalAvailability").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)); - 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")) + if (Client.ApiVersion.Length < 1) { - _httpRequest.Headers.Remove("accept-language"); + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } - _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) + if (Client.SubscriptionId == null) { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - // Send Request - if (_shouldTrace) + if (Client.SubscriptionId != null) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) + if (resourceGroupName == null) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) + if (resourceGroupName != null) { - 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) + if (resourceGroupName.Length > 90) { - // 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(); + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); } - if (_shouldTrace) + if (resourceGroupName.Length < 1) { - ServiceClientTracing.Error(_invocationId, ex); + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } - _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")) + if (labPlanName == null) { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + throw new ValidationException(ValidationRules.CannotBeNull, "labPlanName"); } - // Deserialize Response - if ((int)_statusCode == 200) + if (labPlanName != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try + if (labPlanName.Length > 100) { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + throw new ValidationException(ValidationRules.MaxLength, "labPlanName", 100); } - catch (JsonException ex) + if (labPlanName.Length < 1) { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new ValidationException(ValidationRules.MinLength, "labPlanName", 1); } } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Delete lab account. This operation can take a while to complete - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// 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, 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 (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1546,17 +1663,18 @@ internal LabAccountsOperations(ManagedLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); + tracingParameters.Add("labPlanName", labPlanName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginSaveImage", 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}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}/saveImage").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("{labPlanName}", System.Uri.EscapeDataString(labPlanName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -1569,7 +1687,7 @@ internal LabAccountsOperations(ManagedLabsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1600,6 +1718,12 @@ internal LabAccountsOperations(ManagedLabsClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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) { @@ -1620,16 +1744,15 @@ internal LabAccountsOperations(ManagedLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1639,10 +1762,6 @@ internal LabAccountsOperations(ManagedLabsClient client) } 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); @@ -1670,8 +1789,11 @@ internal LabAccountsOperations(ManagedLabsClient client) } /// - /// List lab accounts in a subscription. + /// Get all lab plans for a subscription. /// + /// + /// Returns a list of all lab plans within a subscription + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -1681,7 +1803,7 @@ internal LabAccountsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1696,7 +1818,7 @@ internal LabAccountsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -1777,14 +1899,13 @@ internal LabAccountsOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1794,10 +1915,6 @@ internal LabAccountsOperations(ManagedLabsClient client) } 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); @@ -1810,7 +1927,7 @@ internal LabAccountsOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1823,7 +1940,7 @@ internal LabAccountsOperations(ManagedLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1843,8 +1960,11 @@ internal LabAccountsOperations(ManagedLabsClient client) } /// - /// List lab accounts in a resource group. + /// Get all lab plans for a subscription and resource group. /// + /// + /// Returns a list of all lab plans for a subscription and resource group. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -1854,7 +1974,7 @@ internal LabAccountsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1869,7 +1989,7 @@ internal LabAccountsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -1950,14 +2070,13 @@ internal LabAccountsOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1967,10 +2086,6 @@ internal LabAccountsOperations(ManagedLabsClient client) } 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); @@ -1983,7 +2098,7 @@ internal LabAccountsOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1996,7 +2111,7 @@ internal LabAccountsOperations(ManagedLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabPlansOperationsExtensions.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabPlansOperationsExtensions.cs new file mode 100644 index 000000000000..daf097173917 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabPlansOperationsExtensions.cs @@ -0,0 +1,649 @@ +// +// 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 LabPlansOperations. + /// + public static partial class LabPlansOperationsExtensions + { + /// + /// Get all lab plans for a subscription. + /// + /// + /// Returns a list of all lab plans within a subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The filter to apply to the operation. + /// + public static IPage ListBySubscription(this ILabPlansOperations operations, string filter = default(string)) + { + return operations.ListBySubscriptionAsync(filter).GetAwaiter().GetResult(); + } + + /// + /// Get all lab plans for a subscription. + /// + /// + /// Returns a list of all lab plans within a subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The filter to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this ILabPlansOperations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all lab plans for a subscription and resource group. + /// + /// + /// Returns a list of all lab plans for a subscription and resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IPage ListByResourceGroup(this ILabPlansOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Get all lab plans for a subscription and resource group. + /// + /// + /// Returns a list of all lab plans for a subscription and resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this ILabPlansOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves a Lab Plan resource. + /// + /// + /// Retrieves the properties of a Lab Plan. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + public static LabPlan Get(this ILabPlansOperations operations, string resourceGroupName, string labPlanName) + { + return operations.GetAsync(resourceGroupName, labPlanName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves a Lab Plan resource. + /// + /// + /// Retrieves the properties of a Lab Plan. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ILabPlansOperations operations, string resourceGroupName, string labPlanName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labPlanName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates or creates a Lab Plan resource. + /// + /// + /// Operation to create or update a Lab Plan resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + public static LabPlan CreateOrUpdate(this ILabPlansOperations operations, LabPlan body, string resourceGroupName, string labPlanName) + { + return operations.CreateOrUpdateAsync(body, resourceGroupName, labPlanName).GetAwaiter().GetResult(); + } + + /// + /// Updates or creates a Lab Plan resource. + /// + /// + /// Operation to create or update a Lab Plan resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ILabPlansOperations operations, LabPlan body, string resourceGroupName, string labPlanName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(body, resourceGroupName, labPlanName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a Lab Plan resource. + /// + /// + /// Operation to update a Lab Plan resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + public static LabPlan Update(this ILabPlansOperations operations, LabPlanUpdate body, string resourceGroupName, string labPlanName) + { + return operations.UpdateAsync(body, resourceGroupName, labPlanName).GetAwaiter().GetResult(); + } + + /// + /// Updates a Lab Plan resource. + /// + /// + /// Operation to update a Lab Plan resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ILabPlansOperations operations, LabPlanUpdate body, string resourceGroupName, string labPlanName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(body, resourceGroupName, labPlanName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Lab Plan resource. + /// + /// + /// Operation to delete a Lab Plan resource. Deleting a lab plan does not + /// delete labs associated with a lab plan, nor does it delete shared images + /// added to a gallery via the lab plan permission container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + public static void Delete(this ILabPlansOperations operations, string resourceGroupName, string labPlanName) + { + operations.DeleteAsync(resourceGroupName, labPlanName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Lab Plan resource. + /// + /// + /// Operation to delete a Lab Plan resource. Deleting a lab plan does not + /// delete labs associated with a lab plan, nor does it delete shared images + /// added to a gallery via the lab plan permission container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ILabPlansOperations operations, string resourceGroupName, string labPlanName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labPlanName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Save an image from a lab VM to the attached shared image gallery. + /// + /// + /// Saves an image from a lab VM to the attached shared image gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + public static void SaveImage(this ILabPlansOperations operations, SaveImageBody body, string resourceGroupName, string labPlanName) + { + operations.SaveImageAsync(body, resourceGroupName, labPlanName).GetAwaiter().GetResult(); + } + + /// + /// Save an image from a lab VM to the attached shared image gallery. + /// + /// + /// Saves an image from a lab VM to the attached shared image gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The cancellation token. + /// + public static async Task SaveImageAsync(this ILabPlansOperations operations, SaveImageBody body, string resourceGroupName, string labPlanName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.SaveImageWithHttpMessagesAsync(body, resourceGroupName, labPlanName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates or creates a Lab Plan resource. + /// + /// + /// Operation to create or update a Lab Plan resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + public static LabPlan BeginCreateOrUpdate(this ILabPlansOperations operations, LabPlan body, string resourceGroupName, string labPlanName) + { + return operations.BeginCreateOrUpdateAsync(body, resourceGroupName, labPlanName).GetAwaiter().GetResult(); + } + + /// + /// Updates or creates a Lab Plan resource. + /// + /// + /// Operation to create or update a Lab Plan resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this ILabPlansOperations operations, LabPlan body, string resourceGroupName, string labPlanName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(body, resourceGroupName, labPlanName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a Lab Plan resource. + /// + /// + /// Operation to update a Lab Plan resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + public static LabPlan BeginUpdate(this ILabPlansOperations operations, LabPlanUpdate body, string resourceGroupName, string labPlanName) + { + return operations.BeginUpdateAsync(body, resourceGroupName, labPlanName).GetAwaiter().GetResult(); + } + + /// + /// Updates a Lab Plan resource. + /// + /// + /// Operation to update a Lab Plan resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this ILabPlansOperations operations, LabPlanUpdate body, string resourceGroupName, string labPlanName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(body, resourceGroupName, labPlanName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Lab Plan resource. + /// + /// + /// Operation to delete a Lab Plan resource. Deleting a lab plan does not + /// delete labs associated with a lab plan, nor does it delete shared images + /// added to a gallery via the lab plan permission container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + public static void BeginDelete(this ILabPlansOperations operations, string resourceGroupName, string labPlanName) + { + operations.BeginDeleteAsync(resourceGroupName, labPlanName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Lab Plan resource. + /// + /// + /// Operation to delete a Lab Plan resource. Deleting a lab plan does not + /// delete labs associated with a lab plan, nor does it delete shared images + /// added to a gallery via the lab plan permission container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ILabPlansOperations operations, string resourceGroupName, string labPlanName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labPlanName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Save an image from a lab VM to the attached shared image gallery. + /// + /// + /// Saves an image from a lab VM to the attached shared image gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + public static void BeginSaveImage(this ILabPlansOperations operations, SaveImageBody body, string resourceGroupName, string labPlanName) + { + operations.BeginSaveImageAsync(body, resourceGroupName, labPlanName).GetAwaiter().GetResult(); + } + + /// + /// Save an image from a lab VM to the attached shared image gallery. + /// + /// + /// Saves an image from a lab VM to the attached shared image gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab plan that uniquely identifies it within containing + /// resource group. Used in resource URIs and in UI. + /// + /// + /// The cancellation token. + /// + public static async Task BeginSaveImageAsync(this ILabPlansOperations operations, SaveImageBody body, string resourceGroupName, string labPlanName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginSaveImageWithHttpMessagesAsync(body, resourceGroupName, labPlanName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get all lab plans for a subscription. + /// + /// + /// Returns a list of all lab plans within a subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this ILabPlansOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all lab plans for a subscription. + /// + /// + /// Returns a list of all lab plans within a subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this ILabPlansOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all lab plans for a subscription and resource group. + /// + /// + /// Returns a list of all lab plans for a subscription and resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this ILabPlansOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all lab plans for a subscription and resource group. + /// + /// + /// Returns a list of all lab plans for a subscription and resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this ILabPlansOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ManagedLabsClient.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabServicesClient.cs similarity index 78% rename from sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ManagedLabsClient.cs rename to sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabServicesClient.cs index 5903f151ebed..c47df697cd40 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ManagedLabsClient.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabServicesClient.cs @@ -21,10 +21,7 @@ namespace Microsoft.Azure.Management.LabServices using System.Net; using System.Net.Http; - /// - /// The Managed Labs Client. - /// - public partial class ManagedLabsClient : ServiceClient, IManagedLabsClient, IAzureClient + public partial class LabServicesClient : ServiceClient, ILabServicesClient, IAzureClient { /// /// The base URI of the service. @@ -47,12 +44,12 @@ public partial class ManagedLabsClient : ServiceClient, IMana public ServiceClientCredentials Credentials { get; private set; } /// - /// Client API version. + /// The API version to use for this operation. /// public string ApiVersion { get; private set; } /// - /// The subscription ID. + /// The ID of the target subscription. /// public string SubscriptionId { get; set; } @@ -75,29 +72,24 @@ public partial class ManagedLabsClient : ServiceClient, IMana public bool? GenerateClientRequestId { get; set; } /// - /// Gets the IProviderOperations. + /// Gets the IOperations. /// - public virtual IProviderOperations ProviderOperations { get; private set; } + public virtual IOperations Operations { get; private set; } /// - /// Gets the IGlobalUsersOperations. + /// Gets the IOperationResultsOperations. /// - public virtual IGlobalUsersOperations GlobalUsers { get; private set; } + public virtual IOperationResultsOperations OperationResults { get; private set; } /// - /// Gets the ILabAccountsOperations. + /// Gets the ILabPlansOperations. /// - public virtual ILabAccountsOperations LabAccounts { get; private set; } + public virtual ILabPlansOperations LabPlans { get; private set; } /// - /// Gets the IOperations. + /// Gets the IImagesOperations. /// - public virtual IOperations Operations { get; private set; } - - /// - /// Gets the IGalleryImagesOperations. - /// - public virtual IGalleryImagesOperations GalleryImages { get; private set; } + public virtual IImagesOperations Images { get; private set; } /// /// Gets the ILabsOperations. @@ -105,46 +97,46 @@ public partial class ManagedLabsClient : ServiceClient, IMana public virtual ILabsOperations Labs { get; private set; } /// - /// Gets the IEnvironmentSettingsOperations. + /// Gets the IUsersOperations. /// - public virtual IEnvironmentSettingsOperations EnvironmentSettings { get; private set; } + public virtual IUsersOperations Users { get; private set; } /// - /// Gets the IEnvironmentsOperations. + /// Gets the IVirtualMachinesOperations. /// - public virtual IEnvironmentsOperations Environments { get; private set; } + public virtual IVirtualMachinesOperations VirtualMachines { get; private set; } /// - /// Gets the IUsersOperations. + /// Gets the ISchedulesOperations. /// - public virtual IUsersOperations Users { get; private set; } + public virtual ISchedulesOperations Schedules { get; private set; } /// - /// Initializes a new instance of the ManagedLabsClient class. + /// Initializes a new instance of the LabServicesClient class. /// /// /// HttpClient to be used /// /// - /// True: will dispose the provided httpClient on calling ManagedLabsClient.Dispose(). False: will not dispose provided httpClient - protected ManagedLabsClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + /// True: will dispose the provided httpClient on calling LabServicesClient.Dispose(). False: will not dispose provided httpClient + protected LabServicesClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) { Initialize(); } /// - /// Initializes a new instance of the ManagedLabsClient class. + /// Initializes a new instance of the LabServicesClient class. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected ManagedLabsClient(params DelegatingHandler[] handlers) : base(handlers) + protected LabServicesClient(params DelegatingHandler[] handlers) : base(handlers) { Initialize(); } /// - /// Initializes a new instance of the ManagedLabsClient class. + /// Initializes a new instance of the LabServicesClient class. /// /// /// Optional. The http client handler used to handle http transport. @@ -152,13 +144,13 @@ protected ManagedLabsClient(params DelegatingHandler[] handlers) : base(handlers /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected ManagedLabsClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + protected LabServicesClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { Initialize(); } /// - /// Initializes a new instance of the ManagedLabsClient class. + /// Initializes a new instance of the LabServicesClient class. /// /// /// Optional. The base URI of the service. @@ -169,7 +161,7 @@ protected ManagedLabsClient(HttpClientHandler rootHandler, params DelegatingHand /// /// Thrown when a required parameter is null /// - protected ManagedLabsClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + protected LabServicesClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -179,7 +171,7 @@ protected ManagedLabsClient(System.Uri baseUri, params DelegatingHandler[] handl } /// - /// Initializes a new instance of the ManagedLabsClient class. + /// Initializes a new instance of the LabServicesClient class. /// /// /// Optional. The base URI of the service. @@ -193,7 +185,7 @@ protected ManagedLabsClient(System.Uri baseUri, params DelegatingHandler[] handl /// /// Thrown when a required parameter is null /// - protected ManagedLabsClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + protected LabServicesClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -203,7 +195,7 @@ protected ManagedLabsClient(System.Uri baseUri, HttpClientHandler rootHandler, p } /// - /// Initializes a new instance of the ManagedLabsClient class. + /// Initializes a new instance of the LabServicesClient class. /// /// /// Required. Credentials needed for the client to connect to Azure. @@ -214,7 +206,7 @@ protected ManagedLabsClient(System.Uri baseUri, HttpClientHandler rootHandler, p /// /// Thrown when a required parameter is null /// - public ManagedLabsClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + internal LabServicesClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) { @@ -228,7 +220,7 @@ public ManagedLabsClient(ServiceClientCredentials credentials, params Delegating } /// - /// Initializes a new instance of the ManagedLabsClient class. + /// Initializes a new instance of the LabServicesClient class. /// /// /// Required. Credentials needed for the client to connect to Azure. @@ -237,11 +229,11 @@ public ManagedLabsClient(ServiceClientCredentials credentials, params Delegating /// HttpClient to be used /// /// - /// True: will dispose the provided httpClient on calling ManagedLabsClient.Dispose(). False: will not dispose provided httpClient + /// True: will dispose the provided httpClient on calling LabServicesClient.Dispose(). False: will not dispose provided httpClient /// /// Thrown when a required parameter is null /// - public ManagedLabsClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + internal LabServicesClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) { if (credentials == null) { @@ -255,7 +247,7 @@ public ManagedLabsClient(ServiceClientCredentials credentials, HttpClient httpCl } /// - /// Initializes a new instance of the ManagedLabsClient class. + /// Initializes a new instance of the LabServicesClient class. /// /// /// Required. Credentials needed for the client to connect to Azure. @@ -269,7 +261,7 @@ public ManagedLabsClient(ServiceClientCredentials credentials, HttpClient httpCl /// /// Thrown when a required parameter is null /// - public ManagedLabsClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + internal LabServicesClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) { @@ -283,7 +275,7 @@ public ManagedLabsClient(ServiceClientCredentials credentials, HttpClientHandler } /// - /// Initializes a new instance of the ManagedLabsClient class. + /// Initializes a new instance of the LabServicesClient class. /// /// /// Optional. The base URI of the service. @@ -297,7 +289,7 @@ public ManagedLabsClient(ServiceClientCredentials credentials, HttpClientHandler /// /// Thrown when a required parameter is null /// - public ManagedLabsClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + internal LabServicesClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -316,7 +308,7 @@ public ManagedLabsClient(System.Uri baseUri, ServiceClientCredentials credential } /// - /// Initializes a new instance of the ManagedLabsClient class. + /// Initializes a new instance of the LabServicesClient class. /// /// /// Optional. The base URI of the service. @@ -333,7 +325,7 @@ public ManagedLabsClient(System.Uri baseUri, ServiceClientCredentials credential /// /// Thrown when a required parameter is null /// - public ManagedLabsClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + internal LabServicesClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -360,17 +352,16 @@ public ManagedLabsClient(System.Uri baseUri, ServiceClientCredentials credential /// private void Initialize() { - ProviderOperations = new ProviderOperations(this); - GlobalUsers = new GlobalUsersOperations(this); - LabAccounts = new LabAccountsOperations(this); Operations = new Operations(this); - GalleryImages = new GalleryImagesOperations(this); + OperationResults = new OperationResultsOperations(this); + LabPlans = new LabPlansOperations(this); + Images = new ImagesOperations(this); Labs = new LabsOperations(this); - EnvironmentSettings = new EnvironmentSettingsOperations(this); - Environments = new EnvironmentsOperations(this); Users = new UsersOperations(this); + VirtualMachines = new VirtualMachinesOperations(this); + Schedules = new SchedulesOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2018-10-15"; + ApiVersion = "2021-10-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabsOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabsOperations.cs index 2e6c3d911b49..a695e06a3e01 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabsOperations.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabsOperations.cs @@ -12,7 +12,6 @@ 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; @@ -26,7 +25,7 @@ namespace Microsoft.Azure.Management.LabServices /// /// LabsOperations operations. /// - internal partial class LabsOperations : IServiceOperations, ILabsOperations + internal partial class LabsOperations : IServiceOperations, ILabsOperations { /// /// Initializes a new instance of the LabsOperations class. @@ -37,7 +36,7 @@ internal partial class LabsOperations : IServiceOperations, I /// /// Thrown when a required parameter is null /// - internal LabsOperations(ManagedLabsClient client) + internal LabsOperations(LabServicesClient client) { if (client == null) { @@ -47,21 +46,18 @@ internal LabsOperations(ManagedLabsClient client) } /// - /// Gets a reference to the ManagedLabsClient + /// Gets a reference to the LabServicesClient /// - public ManagedLabsClient Client { get; private set; } + public LabServicesClient Client { get; private set; } /// - /// List labs in a given lab account. + /// Get all labs for a subscription. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// OData parameters to apply to the operation. + /// + /// Returns a list of all labs for a subscription. + /// + /// + /// The filter to apply to the operation. /// /// /// Headers that will be added to request. @@ -69,7 +65,7 @@ internal LabsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -84,24 +80,243 @@ internal LabsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labAccountName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListBySubscriptionWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labs").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - if (labAccountName == null) + // 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) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + ServiceClientTracing.Exit(_invocationId, _result); } + return _result; + } + + /// + /// Get all labs for a subscription and resource group. + /// + /// + /// Returns a list of all labs in a resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -109,27 +324,16 @@ internal LabsOperations(ManagedLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs").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)); 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))); @@ -194,14 +398,13 @@ internal LabsOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -211,10 +414,6 @@ internal LabsOperations(ManagedLabsClient client) } 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); @@ -260,19 +459,17 @@ internal LabsOperations(ManagedLabsClient client) } /// - /// Get lab + /// Get a lab resource. /// + /// + /// Returns the properties of a lab resource. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. - /// - /// - /// Specify the $expand query. Example: 'properties($select=maxUsersInLab)' + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// /// Headers that will be added to request. @@ -280,7 +477,7 @@ internal LabsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -295,27 +492,59 @@ internal LabsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (labName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (Client.ApiVersion == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -325,24 +554,17 @@ internal LabsOperations(ManagedLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); tracingParameters.Add("labName", labName); - 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}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}").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)); 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))); @@ -407,14 +629,13 @@ internal LabsOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -424,10 +645,6 @@ internal LabsOperations(ManagedLabsClient client) } 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); @@ -437,18 +654,440 @@ internal LabsOperations(ManagedLabsClient client) { _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(); + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update a lab resource. + /// + /// + /// Operation to create or update a lab resource. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(Lab body, string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(body, resourceGroupName, labName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a lab resource. + /// + /// + /// Operation to update a lab resource. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(LabUpdate body, string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(body, resourceGroupName, labName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a lab resource. + /// + /// + /// Operation to delete a lab resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Publish or re-publish a lab. + /// + /// + /// Publish or re-publish a lab. This will create or update all lab resources, + /// such as virtual machines. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task PublishWithHttpMessagesAsync(string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPublishWithHttpMessagesAsync(resourceGroupName, labName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Manually sync the lab group. + /// + /// + /// Action used to manually kick off an AAD group sync job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task SyncGroupWithHttpMessagesAsync(string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginSyncGroupWithHttpMessagesAsync(resourceGroupName, labName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or update a lab resource. + /// + /// + /// Operation to create or update a lab resource. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(Lab body, string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (labName != null) + { + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + 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(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } } // Deserialize Response - if ((int)_statusCode == 200) + if ((int)_statusCode == 202) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try @@ -473,19 +1112,20 @@ internal LabsOperations(ManagedLabsClient client) } /// - /// Create or replace an existing Lab. + /// Update a lab resource. /// - /// - /// The name of the resource group. + /// + /// Operation to update a lab resource. + /// + /// + /// The request body. /// - /// - /// The name of the lab Account. + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. - /// - /// - /// Represents a lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// /// Headers that will be added to request. @@ -493,7 +1133,7 @@ internal LabsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -508,31 +1148,63 @@ internal LabsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, Lab lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(LabUpdate body, string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (labName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (lab == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "lab"); - } - if (Client.ApiVersion == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -541,19 +1213,17 @@ internal LabsOperations(ManagedLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); tracingParameters.Add("labName", labName); - tracingParameters.Add("lab", lab); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}").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)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -567,7 +1237,7 @@ internal LabsOperations(ManagedLabsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -598,9 +1268,9 @@ internal LabsOperations(ManagedLabsClient client) // Serialize Request string _requestContent = null; - if(lab != null) + if(body != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(lab, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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"); } @@ -624,16 +1294,15 @@ internal LabsOperations(ManagedLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -643,10 +1312,6 @@ internal LabsOperations(ManagedLabsClient client) } 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); @@ -685,7 +1350,7 @@ internal LabsOperations(ManagedLabsClient client) } } // Deserialize Response - if ((int)_statusCode == 201) + if ((int)_statusCode == 202) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try @@ -710,44 +1375,17 @@ internal LabsOperations(ManagedLabsClient client) } /// - /// Delete lab. 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 headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Modify properties of labs. + /// Deletes a lab resource. /// + /// + /// Operation to delete a lab resource. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. - /// - /// - /// Represents a lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// /// Headers that will be added to request. @@ -755,12 +1393,9 @@ internal LabsOperations(ManagedLabsClient client) /// /// 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 /// @@ -770,31 +1405,59 @@ internal LabsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, LabFragment lab, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (labName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (lab == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "lab"); - } - if (Client.ApiVersion == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -804,18 +1467,15 @@ internal LabsOperations(ManagedLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); tracingParameters.Add("labName", labName); - tracingParameters.Add("lab", lab); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + 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}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}").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)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -829,7 +1489,7 @@ internal LabsOperations(ManagedLabsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -860,12 +1520,6 @@ internal LabsOperations(ManagedLabsClient client) // Serialize Request string _requestContent = null; - if(lab != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(lab, 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) { @@ -886,16 +1540,15 @@ internal LabsOperations(ManagedLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -905,10 +1558,6 @@ internal LabsOperations(ManagedLabsClient client) } 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); @@ -921,31 +1570,13 @@ internal LabsOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _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); @@ -954,19 +1585,18 @@ internal LabsOperations(ManagedLabsClient client) } /// - /// Add users to a lab + /// Publish or re-publish a lab. /// + /// + /// Publish or re-publish a lab. This will create or update all lab resources, + /// such as virtual machines. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. - /// - /// - /// Payload for Add Users operation on a Lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// /// Headers that will be added to request. @@ -974,7 +1604,7 @@ internal LabsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -986,35 +1616,59 @@ internal LabsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task AddUsersWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, AddUsersPayload addUsersPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginPublishWithHttpMessagesAsync(string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (labName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (addUsersPayload == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "addUsersPayload"); - } - if (addUsersPayload != null) - { - addUsersPayload.Validate(); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1024,18 +1678,15 @@ internal LabsOperations(ManagedLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); tracingParameters.Add("labName", labName); - tracingParameters.Add("addUsersPayload", addUsersPayload); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "AddUsers", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginPublish", 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}/addUsers").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/publish").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)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1080,12 +1731,6 @@ internal LabsOperations(ManagedLabsClient client) // Serialize Request string _requestContent = null; - if(addUsersPayload != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(addUsersPayload, 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) { @@ -1106,16 +1751,15 @@ internal LabsOperations(ManagedLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1125,10 +1769,6 @@ internal LabsOperations(ManagedLabsClient client) } 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); @@ -1156,16 +1796,17 @@ internal LabsOperations(ManagedLabsClient client) } /// - /// Register to managed lab. + /// Manually sync the lab group. /// + /// + /// Action used to manually kick off an AAD group sync job. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// /// Headers that will be added to request. @@ -1173,7 +1814,7 @@ internal LabsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1185,27 +1826,59 @@ internal LabsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task RegisterWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginSyncGroupWithHttpMessagesAsync(string resourceGroupName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (labName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (Client.ApiVersion == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1215,17 +1888,15 @@ internal LabsOperations(ManagedLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); tracingParameters.Add("labName", labName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Register", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginSyncGroup", 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}/register").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/syncGroup").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)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1290,16 +1961,15 @@ internal LabsOperations(ManagedLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1309,10 +1979,6 @@ internal LabsOperations(ManagedLabsClient client) } 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); @@ -1340,16 +2006,13 @@ internal LabsOperations(ManagedLabsClient client) } /// - /// Delete lab. This operation can take a while to complete + /// Get all labs for a subscription. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// The name of the lab. + /// + /// Returns a list of all labs for a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. /// /// /// Headers that will be added to request. @@ -1357,9 +2020,12 @@ internal LabsOperations(ManagedLabsClient client) /// /// 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 /// @@ -1369,27 +2035,11 @@ internal LabsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, 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 (Client.ApiVersion == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1398,24 +2048,14 @@ internal LabsOperations(ManagedLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); - tracingParameters.Add("labName", labName); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", 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}").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)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); 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); @@ -1423,7 +2063,7 @@ internal LabsOperations(ManagedLabsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1474,16 +2114,15 @@ internal LabsOperations(ManagedLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1493,10 +2132,6 @@ internal LabsOperations(ManagedLabsClient client) } 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); @@ -1509,13 +2144,31 @@ internal LabsOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _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); @@ -1524,8 +2177,11 @@ internal LabsOperations(ManagedLabsClient client) } /// - /// List labs in a given lab account. + /// Get all labs for a subscription and resource group. /// + /// + /// Returns a list of all labs in a resource group. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -1535,7 +2191,7 @@ internal LabsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1550,7 +2206,7 @@ internal LabsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -1565,7 +2221,7 @@ internal LabsOperations(ManagedLabsClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -1631,14 +2287,13 @@ internal LabsOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1648,10 +2303,6 @@ internal LabsOperations(ManagedLabsClient client) } 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); diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabsOperationsExtensions.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabsOperationsExtensions.cs index 32a3feb16a85..8ba06b0b7a97 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabsOperationsExtensions.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabsOperationsExtensions.cs @@ -12,7 +12,6 @@ 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; @@ -23,402 +22,686 @@ namespace Microsoft.Azure.Management.LabServices public static partial class LabsOperationsExtensions { /// - /// List labs in a given lab account. + /// Get all labs for a subscription. /// + /// + /// Returns a list of all labs for a subscription. + /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. + /// + /// The filter to apply to the operation. /// - /// - /// The name of the lab Account. + public static IPage ListBySubscription(this ILabsOperations operations, string filter = default(string)) + { + return operations.ListBySubscriptionAsync(filter).GetAwaiter().GetResult(); + } + + /// + /// Get all labs for a subscription. + /// + /// + /// Returns a list of all labs for a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The filter to apply to the operation. /// - /// - /// OData parameters to apply to the operation. + /// + /// The cancellation token. /// - public static IPage List(this ILabsOperations operations, string resourceGroupName, string labAccountName, ODataQuery odataQuery = default(ODataQuery)) + public static async Task> ListBySubscriptionAsync(this ILabsOperations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - return operations.ListAsync(resourceGroupName, labAccountName, odataQuery).GetAwaiter().GetResult(); + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// List labs in a given lab account. + /// Get all labs for a subscription and resource group. /// + /// + /// Returns a list of all labs in a resource group. + /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// - /// - /// The name of the lab Account. + public static IPage ListByResourceGroup(this ILabsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Get all labs for a subscription and resource group. + /// + /// + /// Returns a list of all labs in a resource group. + /// + /// + /// The operations group for this extension method. /// - /// - /// OData parameters to apply to the operation. + /// + /// The name of the resource group. The name is case insensitive. /// /// /// The cancellation token. /// - public static async Task> ListAsync(this ILabsOperations operations, string resourceGroupName, string labAccountName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupAsync(this ILabsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labAccountName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Get lab + /// Get a lab resource. /// + /// + /// Returns the properties of a lab resource. + /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. - /// - /// - /// Specify the $expand query. Example: 'properties($select=maxUsersInLab)' + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - public static Lab Get(this ILabsOperations operations, string resourceGroupName, string labAccountName, string labName, string expand = default(string)) + public static Lab Get(this ILabsOperations operations, string resourceGroupName, string labName) { - return operations.GetAsync(resourceGroupName, labAccountName, labName, expand).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, labName).GetAwaiter().GetResult(); } /// - /// Get lab + /// Get a lab resource. /// + /// + /// Returns the properties of a lab resource. + /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. - /// - /// - /// Specify the $expand query. Example: 'properties($select=maxUsersInLab)' + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// /// The cancellation token. /// - public static async Task GetAsync(this ILabsOperations operations, string resourceGroupName, string labAccountName, string labName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this ILabsOperations operations, string resourceGroupName, string labName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Create or replace an existing Lab. + /// Create or update a lab resource. /// + /// + /// Operation to create or update a lab resource. + /// /// /// The operations group for this extension method. /// + /// + /// The request body. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// - /// - /// The name of the lab Account. + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + public static Lab CreateOrUpdate(this ILabsOperations operations, Lab body, string resourceGroupName, string labName) + { + return operations.CreateOrUpdateAsync(body, resourceGroupName, labName).GetAwaiter().GetResult(); + } + + /// + /// Create or update a lab resource. + /// + /// + /// Operation to create or update a lab resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// Represents a lab. + /// + /// The cancellation token. /// - public static Lab CreateOrUpdate(this ILabsOperations operations, string resourceGroupName, string labAccountName, string labName, Lab lab) + public static async Task CreateOrUpdateAsync(this ILabsOperations operations, Lab body, string resourceGroupName, string labName, CancellationToken cancellationToken = default(CancellationToken)) { - return operations.CreateOrUpdateAsync(resourceGroupName, labAccountName, labName, lab).GetAwaiter().GetResult(); + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(body, resourceGroupName, labName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Create or replace an existing Lab. + /// Update a lab resource. /// + /// + /// Operation to update a lab resource. + /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. + /// + /// The request body. /// - /// - /// The name of the lab Account. + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + public static Lab Update(this ILabsOperations operations, LabUpdate body, string resourceGroupName, string labName) + { + return operations.UpdateAsync(body, resourceGroupName, labName).GetAwaiter().GetResult(); + } + + /// + /// Update a lab resource. + /// + /// + /// Operation to update a lab resource. + /// + /// + /// The operations group for this extension method. /// - /// - /// Represents a lab. + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this ILabsOperations operations, string resourceGroupName, string labAccountName, string labName, Lab lab, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this ILabsOperations operations, LabUpdate body, string resourceGroupName, string labName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, lab, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(body, resourceGroupName, labName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Delete lab. This operation can take a while to complete + /// Deletes a lab resource. /// + /// + /// Operation to delete a lab resource. + /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// - /// - /// The name of the lab Account. + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + public static void Delete(this ILabsOperations operations, string resourceGroupName, string labName) + { + operations.DeleteAsync(resourceGroupName, labName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a lab resource. + /// + /// + /// Operation to delete a lab resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - public static void Delete(this ILabsOperations operations, string resourceGroupName, string labAccountName, string labName) + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ILabsOperations operations, string resourceGroupName, string labName, CancellationToken cancellationToken = default(CancellationToken)) { - operations.DeleteAsync(resourceGroupName, labAccountName, labName).GetAwaiter().GetResult(); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Delete lab. This operation can take a while to complete + /// Publish or re-publish a lab. /// + /// + /// Publish or re-publish a lab. This will create or update all lab resources, + /// such as virtual machines. + /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// - /// - /// The name of the lab Account. + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + public static void Publish(this ILabsOperations operations, string resourceGroupName, string labName) + { + operations.PublishAsync(resourceGroupName, labName).GetAwaiter().GetResult(); + } + + /// + /// Publish or re-publish a lab. + /// + /// + /// Publish or re-publish a lab. This will create or update all lab resources, + /// such as virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this ILabsOperations operations, string resourceGroupName, string labAccountName, string labName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task PublishAsync(this ILabsOperations operations, string resourceGroupName, string labName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.PublishWithHttpMessagesAsync(resourceGroupName, labName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Modify properties of labs. + /// Manually sync the lab group. /// + /// + /// Action used to manually kick off an AAD group sync job. + /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + public static void SyncGroup(this ILabsOperations operations, string resourceGroupName, string labName) + { + operations.SyncGroupAsync(resourceGroupName, labName).GetAwaiter().GetResult(); + } + + /// + /// Manually sync the lab group. + /// + /// + /// Action used to manually kick off an AAD group sync job. + /// + /// + /// The operations group for this extension method. /// - /// - /// The name of the lab Account. + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// Represents a lab. + /// + /// The cancellation token. /// - public static Lab Update(this ILabsOperations operations, string resourceGroupName, string labAccountName, string labName, LabFragment lab) + public static async Task SyncGroupAsync(this ILabsOperations operations, string resourceGroupName, string labName, CancellationToken cancellationToken = default(CancellationToken)) { - return operations.UpdateAsync(resourceGroupName, labAccountName, labName, lab).GetAwaiter().GetResult(); + (await operations.SyncGroupWithHttpMessagesAsync(resourceGroupName, labName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Modify properties of labs. + /// Create or update a lab resource. /// + /// + /// Operation to create or update a lab resource. + /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. + /// + /// The request body. /// - /// - /// The name of the lab Account. + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// Represents a lab. + public static Lab BeginCreateOrUpdate(this ILabsOperations operations, Lab body, string resourceGroupName, string labName) + { + return operations.BeginCreateOrUpdateAsync(body, resourceGroupName, labName).GetAwaiter().GetResult(); + } + + /// + /// Create or update a lab resource. + /// + /// + /// Operation to create or update a lab resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this ILabsOperations operations, string resourceGroupName, string labAccountName, string labName, LabFragment lab, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this ILabsOperations operations, Lab body, string resourceGroupName, string labName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, lab, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(body, resourceGroupName, labName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Add users to a lab + /// Update a lab resource. /// + /// + /// Operation to update a lab resource. + /// /// /// The operations group for this extension method. /// + /// + /// The request body. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// - /// - /// The name of the lab Account. + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + public static Lab BeginUpdate(this ILabsOperations operations, LabUpdate body, string resourceGroupName, string labName) + { + return operations.BeginUpdateAsync(body, resourceGroupName, labName).GetAwaiter().GetResult(); + } + + /// + /// Update a lab resource. + /// + /// + /// Operation to update a lab resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// Payload for Add Users operation on a Lab. + /// + /// The cancellation token. /// - public static void AddUsers(this ILabsOperations operations, string resourceGroupName, string labAccountName, string labName, AddUsersPayload addUsersPayload) + public static async Task BeginUpdateAsync(this ILabsOperations operations, LabUpdate body, string resourceGroupName, string labName, CancellationToken cancellationToken = default(CancellationToken)) { - operations.AddUsersAsync(resourceGroupName, labAccountName, labName, addUsersPayload).GetAwaiter().GetResult(); + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(body, resourceGroupName, labName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Add users to a lab + /// Deletes a lab resource. /// + /// + /// Operation to delete a lab resource. + /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// Payload for Add Users operation on a Lab. + public static void BeginDelete(this ILabsOperations operations, string resourceGroupName, string labName) + { + operations.BeginDeleteAsync(resourceGroupName, labName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a lab resource. + /// + /// + /// Operation to delete a lab resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// /// The cancellation token. /// - public static async Task AddUsersAsync(this ILabsOperations operations, string resourceGroupName, string labAccountName, string labName, AddUsersPayload addUsersPayload, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteAsync(this ILabsOperations operations, string resourceGroupName, string labName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.AddUsersWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, addUsersPayload, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Register to managed lab. + /// Publish or re-publish a lab. /// + /// + /// Publish or re-publish a lab. This will create or update all lab resources, + /// such as virtual machines. + /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - public static void Register(this ILabsOperations operations, string resourceGroupName, string labAccountName, string labName) + public static void BeginPublish(this ILabsOperations operations, string resourceGroupName, string labName) { - operations.RegisterAsync(resourceGroupName, labAccountName, labName).GetAwaiter().GetResult(); + operations.BeginPublishAsync(resourceGroupName, labName).GetAwaiter().GetResult(); } /// - /// Register to managed lab. + /// Publish or re-publish a lab. /// + /// + /// Publish or re-publish a lab. This will create or update all lab resources, + /// such as virtual machines. + /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// /// The cancellation token. /// - public static async Task RegisterAsync(this ILabsOperations operations, string resourceGroupName, string labAccountName, string labName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginPublishAsync(this ILabsOperations operations, string resourceGroupName, string labName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.RegisterWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginPublishWithHttpMessagesAsync(resourceGroupName, labName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Delete lab. This operation can take a while to complete + /// Manually sync the lab group. /// + /// + /// Action used to manually kick off an AAD group sync job. + /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - public static void BeginDelete(this ILabsOperations operations, string resourceGroupName, string labAccountName, string labName) + public static void BeginSyncGroup(this ILabsOperations operations, string resourceGroupName, string labName) { - operations.BeginDeleteAsync(resourceGroupName, labAccountName, labName).GetAwaiter().GetResult(); + operations.BeginSyncGroupAsync(resourceGroupName, labName).GetAwaiter().GetResult(); } /// - /// Delete lab. This operation can take a while to complete + /// Manually sync the lab group. /// + /// + /// Action used to manually kick off an AAD group sync job. + /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this ILabsOperations operations, string resourceGroupName, string labAccountName, string labName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginSyncGroupAsync(this ILabsOperations operations, string resourceGroupName, string labName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginSyncGroupWithHttpMessagesAsync(resourceGroupName, labName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get all labs for a subscription. + /// + /// + /// Returns a list of all labs for a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this ILabsOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all labs for a subscription. + /// + /// + /// Returns a list of all labs for a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this ILabsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// List labs in a given lab account. + /// Get all labs for a subscription and resource group. /// + /// + /// Returns a list of all labs in a resource group. + /// /// /// The operations group for this extension method. /// /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListNext(this ILabsOperations operations, string nextPageLink) + public static IPage ListByResourceGroupNext(this ILabsOperations operations, string nextPageLink) { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// List labs in a given lab account. + /// Get all labs for a subscription and resource group. /// + /// + /// Returns a list of all labs in a resource group. + /// /// /// The operations group for this extension method. /// @@ -428,9 +711,9 @@ public static IPage ListNext(this ILabsOperations operations, string nextPa /// /// The cancellation token. /// - public static async Task> ListNextAsync(this ILabsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupNextAsync(this ILabsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/AddRemove.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ActionType.cs similarity index 55% rename from sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/AddRemove.cs rename to sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ActionType.cs index f569bf6c0352..4b92ccca45ab 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/AddRemove.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ActionType.cs @@ -12,17 +12,10 @@ namespace Microsoft.Azure.Management.LabServices.Models { /// - /// Defines values for AddRemove. + /// Defines values for ActionType. /// - public static class AddRemove + public static class ActionType { - /// - /// Indicates that a user is adding a favorite lab - /// - public const string Add = "Add"; - /// - /// Indicates that a user is removing a favorite lab - /// - public const string Remove = "Remove"; + public const string Internal = "Internal"; } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/AddUsersPayload.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/AddUsersPayload.cs deleted file mode 100644 index b75748495b72..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/AddUsersPayload.cs +++ /dev/null @@ -1,68 +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.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Payload for Add Users operation on a Lab. - /// - public partial class AddUsersPayload - { - /// - /// Initializes a new instance of the AddUsersPayload class. - /// - public AddUsersPayload() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AddUsersPayload class. - /// - /// List of user emails addresses to add - /// to the lab. - public AddUsersPayload(IList emailAddresses) - { - EmailAddresses = emailAddresses; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of user emails addresses to add to the lab. - /// - [JsonProperty(PropertyName = "emailAddresses")] - public IList EmailAddresses { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (EmailAddresses == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "EmailAddresses"); - } - } - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/AutoShutdownProfile.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/AutoShutdownProfile.cs new file mode 100644 index 000000000000..23e586ae08c2 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/AutoShutdownProfile.cs @@ -0,0 +1,109 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Profile for how to handle shutting down virtual machines. + /// + public partial class AutoShutdownProfile + { + /// + /// Initializes a new instance of the AutoShutdownProfile class. + /// + public AutoShutdownProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoShutdownProfile class. + /// + /// Whether shutdown on disconnect + /// is enabled. Possible values include: 'Enabled', 'Disabled' + /// Whether a VM will get + /// shutdown when it hasn't been connected to after a period of time. + /// Possible values include: 'Enabled', 'Disabled' + /// Whether a VM will get shutdown when it + /// has idled for a period of time. Possible values include: 'None', + /// 'UserAbsence', 'LowUsage' + /// The amount of time a VM will stay + /// running after a user disconnects if this behavior is + /// enabled. + /// The amount of time a VM will stay + /// running before it is shutdown if no connection is made and this + /// behavior is enabled. + /// The amount of time a VM will idle before it + /// is shutdown if this behavior is enabled. + public AutoShutdownProfile(EnableState? shutdownOnDisconnect = default(EnableState?), EnableState? shutdownWhenNotConnected = default(EnableState?), ShutdownOnIdleMode? shutdownOnIdle = default(ShutdownOnIdleMode?), System.TimeSpan? disconnectDelay = default(System.TimeSpan?), System.TimeSpan? noConnectDelay = default(System.TimeSpan?), System.TimeSpan? idleDelay = default(System.TimeSpan?)) + { + ShutdownOnDisconnect = shutdownOnDisconnect; + ShutdownWhenNotConnected = shutdownWhenNotConnected; + ShutdownOnIdle = shutdownOnIdle; + DisconnectDelay = disconnectDelay; + NoConnectDelay = noConnectDelay; + IdleDelay = idleDelay; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether shutdown on disconnect is enabled. Possible + /// values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "shutdownOnDisconnect")] + public EnableState? ShutdownOnDisconnect { get; set; } + + /// + /// Gets or sets whether a VM will get shutdown when it hasn't been + /// connected to after a period of time. Possible values include: + /// 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "shutdownWhenNotConnected")] + public EnableState? ShutdownWhenNotConnected { get; set; } + + /// + /// Gets or sets whether a VM will get shutdown when it has idled for a + /// period of time. Possible values include: 'None', 'UserAbsence', + /// 'LowUsage' + /// + [JsonProperty(PropertyName = "shutdownOnIdle")] + public ShutdownOnIdleMode? ShutdownOnIdle { get; set; } + + /// + /// Gets or sets the amount of time a VM will stay running after a user + /// disconnects if this behavior is enabled. + /// + [JsonProperty(PropertyName = "disconnectDelay")] + public System.TimeSpan? DisconnectDelay { get; set; } + + /// + /// Gets or sets the amount of time a VM will stay running before it is + /// shutdown if no connection is made and this behavior is enabled. + /// + [JsonProperty(PropertyName = "noConnectDelay")] + public System.TimeSpan? NoConnectDelay { get; set; } + + /// + /// Gets or sets the amount of time a VM will idle before it is + /// shutdown if this behavior is enabled. + /// + [JsonProperty(PropertyName = "idleDelay")] + public System.TimeSpan? IdleDelay { get; set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/AzureEntityResource.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/AzureEntityResource.cs new file mode 100644 index 000000000000..c805d4176caa --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/AzureEntityResource.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Entity Resource + /// + /// + /// The resource model definition for an Azure Resource Manager resource + /// with an etag. + /// + public partial class AzureEntityResource : Resource + { + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + public AzureEntityResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Resource Etag. + public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + : base(id, name, type) + { + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Etag. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ConfigurationState.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ConfigurationState.cs deleted file mode 100644 index 2b286e24cf91..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ConfigurationState.cs +++ /dev/null @@ -1,29 +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.Models -{ - - /// - /// Defines values for ConfigurationState. - /// - public static class ConfigurationState - { - /// - /// User either hasn't started configuring their template - /// or they haven't started the configuration process. - /// - public const string NotApplicable = "NotApplicable"; - /// - /// User is finished modifying the template. - /// - public const string Completed = "Completed"; - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ConnectionProfile.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ConnectionProfile.cs new file mode 100644 index 000000000000..fcfd88b470c6 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ConnectionProfile.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Connection profile for how users connect to lab virtual machines. + /// + public partial class ConnectionProfile + { + /// + /// Initializes a new instance of the ConnectionProfile class. + /// + public ConnectionProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConnectionProfile class. + /// + /// The enabled access level for Web Access + /// over SSH. Possible values include: 'Public', 'Private', + /// 'None' + /// The enabled access level for Web Access + /// over RDP. Possible values include: 'Public', 'Private', + /// 'None' + /// The enabled access level for Client + /// Access over SSH. Possible values include: 'Public', 'Private', + /// 'None' + /// The enabled access level for Client + /// Access over RDP. Possible values include: 'Public', 'Private', + /// 'None' + public ConnectionProfile(ConnectionType? webSshAccess = default(ConnectionType?), ConnectionType? webRdpAccess = default(ConnectionType?), ConnectionType? clientSshAccess = default(ConnectionType?), ConnectionType? clientRdpAccess = default(ConnectionType?)) + { + WebSshAccess = webSshAccess; + WebRdpAccess = webRdpAccess; + ClientSshAccess = clientSshAccess; + ClientRdpAccess = clientRdpAccess; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the enabled access level for Web Access over SSH. + /// Possible values include: 'Public', 'Private', 'None' + /// + [JsonProperty(PropertyName = "webSshAccess")] + public ConnectionType? WebSshAccess { get; set; } + + /// + /// Gets or sets the enabled access level for Web Access over RDP. + /// Possible values include: 'Public', 'Private', 'None' + /// + [JsonProperty(PropertyName = "webRdpAccess")] + public ConnectionType? WebRdpAccess { get; set; } + + /// + /// Gets or sets the enabled access level for Client Access over SSH. + /// Possible values include: 'Public', 'Private', 'None' + /// + [JsonProperty(PropertyName = "clientSshAccess")] + public ConnectionType? ClientSshAccess { get; set; } + + /// + /// Gets or sets the enabled access level for Client Access over RDP. + /// Possible values include: 'Public', 'Private', 'None' + /// + [JsonProperty(PropertyName = "clientRdpAccess")] + public ConnectionType? ClientRdpAccess { get; set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ConnectionType.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ConnectionType.cs new file mode 100644 index 000000000000..2f29d6ea4b20 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ConnectionType.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ConnectionType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ConnectionType + { + [EnumMember(Value = "Public")] + Public, + [EnumMember(Value = "Private")] + Private, + [EnumMember(Value = "None")] + None + } + internal static class ConnectionTypeEnumExtension + { + internal static string ToSerializedValue(this ConnectionType? value) + { + return value == null ? null : ((ConnectionType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ConnectionType value) + { + switch( value ) + { + case ConnectionType.Public: + return "Public"; + case ConnectionType.Private: + return "Private"; + case ConnectionType.None: + return "None"; + } + return null; + } + + internal static ConnectionType? ParseConnectionType(this string value) + { + switch( value ) + { + case "Public": + return ConnectionType.Public; + case "Private": + return ConnectionType.Private; + case "None": + return ConnectionType.None; + } + return null; + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/CreateLabProperties.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/CreateLabProperties.cs deleted file mode 100644 index 753588e9c998..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/CreateLabProperties.cs +++ /dev/null @@ -1,109 +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.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Properties for creating a managed lab and a default environment setting - /// - public partial class CreateLabProperties - { - /// - /// Initializes a new instance of the CreateLabProperties class. - /// - public CreateLabProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the CreateLabProperties class. - /// - /// Settings related to creating a - /// lab - /// The name of the resource - /// Settings related - /// to creating an environment setting - /// The location of the resource - /// The tags of the resource. - public CreateLabProperties(LabCreationParameters labCreationParameters, string name, EnvironmentSettingCreationParameters environmentSettingCreationParameters = default(EnvironmentSettingCreationParameters), string location = default(string), IDictionary tags = default(IDictionary)) - { - EnvironmentSettingCreationParameters = environmentSettingCreationParameters; - LabCreationParameters = labCreationParameters; - Name = name; - Location = location; - Tags = tags; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets settings related to creating an environment setting - /// - [JsonProperty(PropertyName = "environmentSettingCreationParameters")] - public EnvironmentSettingCreationParameters EnvironmentSettingCreationParameters { get; set; } - - /// - /// Gets or sets settings related to creating a lab - /// - [JsonProperty(PropertyName = "labCreationParameters")] - public LabCreationParameters LabCreationParameters { get; set; } - - /// - /// Gets or sets the name of the resource - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the location of the resource - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets or sets the tags of the resource. - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (LabCreationParameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "LabCreationParameters"); - } - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (EnvironmentSettingCreationParameters != null) - { - EnvironmentSettingCreationParameters.Validate(); - } - } - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/CreateOption.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/CreateOption.cs new file mode 100644 index 000000000000..72d2fc2928be --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/CreateOption.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for CreateOption. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum CreateOption + { + /// + /// An image is used to create all lab user virtual machines. When this + /// option is set, no template VM will be created. + /// + [EnumMember(Value = "Image")] + Image, + /// + /// A template VM will be used to create all lab user virtual machines. + /// + [EnumMember(Value = "TemplateVM")] + TemplateVM + } + internal static class CreateOptionEnumExtension + { + internal static string ToSerializedValue(this CreateOption? value) + { + return value == null ? null : ((CreateOption)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this CreateOption value) + { + switch( value ) + { + case CreateOption.Image: + return "Image"; + case CreateOption.TemplateVM: + return "TemplateVM"; + } + return null; + } + + internal static CreateOption? ParseCreateOption(this string value) + { + switch( value ) + { + case "Image": + return CreateOption.Image; + case "TemplateVM": + return CreateOption.TemplateVM; + } + return null; + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabUserAccessMode.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/CreatedByType.cs similarity index 53% rename from sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabUserAccessMode.cs rename to sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/CreatedByType.cs index 52da5cf473c5..0a0d6b9a9d6d 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabUserAccessMode.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/CreatedByType.cs @@ -12,17 +12,13 @@ namespace Microsoft.Azure.Management.LabServices.Models { /// - /// Defines values for LabUserAccessMode. + /// Defines values for CreatedByType. /// - public static class LabUserAccessMode + public static class CreatedByType { - /// - /// Only users registered with the lab can access VMs. - /// - public const string Restricted = "Restricted"; - /// - /// Any user can register with the lab and access its VMs. - /// - public const string Open = "Open"; + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResetPasswordPayload.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Credentials.cs similarity index 57% rename from sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResetPasswordPayload.cs rename to sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Credentials.cs index 73ed26d3c0db..a44cde249f97 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResetPasswordPayload.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Credentials.cs @@ -15,30 +15,27 @@ namespace Microsoft.Azure.Management.LabServices.Models using System.Linq; /// - /// Represents the payload for resetting passwords. + /// Credentials for a user on a lab VM. /// - public partial class ResetPasswordPayload + public partial class Credentials { /// - /// Initializes a new instance of the ResetPasswordPayload class. + /// Initializes a new instance of the Credentials class. /// - public ResetPasswordPayload() + public Credentials() { CustomInit(); } /// - /// Initializes a new instance of the ResetPasswordPayload class. + /// Initializes a new instance of the Credentials class. /// - /// The resourceId of the - /// environment - /// The username for which the password will be - /// reset. - /// The password to assign to the user specified - /// in - public ResetPasswordPayload(string environmentId, string username = default(string), string password = default(string)) + /// The username to use when signing in to lab + /// VMs. + /// The password for the user. This is required + /// for the TemplateVM createOption. + public Credentials(string username, string password = default(string)) { - EnvironmentId = environmentId; Username = username; Password = password; CustomInit(); @@ -50,19 +47,14 @@ public ResetPasswordPayload() partial void CustomInit(); /// - /// Gets or sets the resourceId of the environment - /// - [JsonProperty(PropertyName = "environmentId")] - public string EnvironmentId { get; set; } - - /// - /// Gets or sets the username for which the password will be reset. + /// Gets or sets the username to use when signing in to lab VMs. /// [JsonProperty(PropertyName = "username")] public string Username { get; set; } /// - /// Gets or sets the password to assign to the user specified in + /// Gets or sets the password for the user. This is required for the + /// TemplateVM createOption. /// [JsonProperty(PropertyName = "password")] public string Password { get; set; } @@ -75,9 +67,9 @@ public ResetPasswordPayload() /// public virtual void Validate() { - if (EnvironmentId == null) + if (Username == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "EnvironmentId"); + throw new ValidationException(ValidationRules.CannotBeNull, "Username"); } } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnableState.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnableState.cs new file mode 100644 index 000000000000..205e9de0a938 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnableState.cs @@ -0,0 +1,60 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for EnableState. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EnableState + { + [EnumMember(Value = "Enabled")] + Enabled, + [EnumMember(Value = "Disabled")] + Disabled + } + internal static class EnableStateEnumExtension + { + internal static string ToSerializedValue(this EnableState? value) + { + return value == null ? null : ((EnableState)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this EnableState value) + { + switch( value ) + { + case EnableState.Enabled: + return "Enabled"; + case EnableState.Disabled: + return "Disabled"; + } + return null; + } + + internal static EnableState? ParseEnableState(this string value) + { + switch( value ) + { + case "Enabled": + return EnableState.Enabled; + case "Disabled": + return EnableState.Disabled; + } + return null; + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Environment.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Environment.cs deleted file mode 100644 index dd7ed485d619..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Environment.cs +++ /dev/null @@ -1,163 +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.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents an environment instance - /// - [Rest.Serialization.JsonTransformation] - public partial class Environment : Resource - { - /// - /// Initializes a new instance of the Environment class. - /// - public Environment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Environment class. - /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The set of a VM and the setting id it - /// was created for - /// The AAD object Id of the user - /// who has claimed the environment - /// The user principal Id of the - /// user who has claimed the environment - /// The name or email address of the - /// user who has claimed the environment - /// Is the environment claimed or not - /// Last known power state of the - /// environment - /// Network details of the - /// environment - /// How long the environment has been used by - /// a lab user - /// When the password was last reset on - /// the environment. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - /// The details of the latest - /// operation. ex: status, error - public Environment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), ResourceSet resourceSets = default(ResourceSet), string claimedByUserObjectId = default(string), string claimedByUserPrincipalId = default(string), string claimedByUserName = default(string), bool? isClaimed = default(bool?), string lastKnownPowerState = default(string), NetworkInterface networkInterface = default(NetworkInterface), System.TimeSpan? totalUsage = default(System.TimeSpan?), System.DateTime? passwordLastReset = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string), LatestOperationResult latestOperationResult = default(LatestOperationResult)) - : base(id, name, type, location, tags) - { - ResourceSets = resourceSets; - ClaimedByUserObjectId = claimedByUserObjectId; - ClaimedByUserPrincipalId = claimedByUserPrincipalId; - ClaimedByUserName = claimedByUserName; - IsClaimed = isClaimed; - LastKnownPowerState = lastKnownPowerState; - NetworkInterface = networkInterface; - TotalUsage = totalUsage; - PasswordLastReset = passwordLastReset; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - LatestOperationResult = latestOperationResult; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the set of a VM and the setting id it was created for - /// - [JsonProperty(PropertyName = "properties.resourceSets")] - public ResourceSet ResourceSets { get; set; } - - /// - /// Gets the AAD object Id of the user who has claimed the environment - /// - [JsonProperty(PropertyName = "properties.claimedByUserObjectId")] - public string ClaimedByUserObjectId { get; private set; } - - /// - /// Gets the user principal Id of the user who has claimed the - /// environment - /// - [JsonProperty(PropertyName = "properties.claimedByUserPrincipalId")] - public string ClaimedByUserPrincipalId { get; private set; } - - /// - /// Gets the name or email address of the user who has claimed the - /// environment - /// - [JsonProperty(PropertyName = "properties.claimedByUserName")] - public string ClaimedByUserName { get; private set; } - - /// - /// Gets is the environment claimed or not - /// - [JsonProperty(PropertyName = "properties.isClaimed")] - public bool? IsClaimed { get; private set; } - - /// - /// Gets last known power state of the environment - /// - [JsonProperty(PropertyName = "properties.lastKnownPowerState")] - public string LastKnownPowerState { get; private set; } - - /// - /// Gets network details of the environment - /// - [JsonProperty(PropertyName = "properties.networkInterface")] - public NetworkInterface NetworkInterface { get; private set; } - - /// - /// Gets how long the environment has been used by a lab user - /// - [JsonProperty(PropertyName = "properties.totalUsage")] - public System.TimeSpan? TotalUsage { get; private set; } - - /// - /// Gets when the password was last reset on the environment. - /// - [JsonProperty(PropertyName = "properties.passwordLastReset")] - public System.DateTime? PasswordLastReset { get; private set; } - - /// - /// Gets or sets the provisioning status of the resource. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } - - /// - /// Gets or sets the unique immutable identifier of a resource (Guid). - /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - - /// - /// Gets the details of the latest operation. ex: status, error - /// - [JsonProperty(PropertyName = "properties.latestOperationResult")] - public LatestOperationResult LatestOperationResult { get; private set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentDetails.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentDetails.cs deleted file mode 100644 index ad7189370ad0..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentDetails.cs +++ /dev/null @@ -1,125 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// This represents the details about a User's environment and its state. - /// - public partial class EnvironmentDetails - { - /// - /// Initializes a new instance of the EnvironmentDetails class. - /// - public EnvironmentDetails() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EnvironmentDetails class. - /// - /// Name of the Environment - /// Description of the Environment - /// Resource Id of the environment - /// The provisioning state of the - /// environment. This also includes LabIsFull and NotYetProvisioned - /// status. - /// Details of backing DTL virtual - /// machine with compute and network details. - /// The details of the latest - /// operation. ex: status, error - /// Publishing state of the environment - /// setting Possible values are Creating, Created, Failed - /// How long the environment has been used by - /// a lab user - /// When the password was last reset on - /// the environment. - public EnvironmentDetails(string name = default(string), string description = default(string), string id = default(string), string provisioningState = default(string), VirtualMachineDetails virtualMachineDetails = default(VirtualMachineDetails), LatestOperationResult latestOperationResult = default(LatestOperationResult), string environmentState = default(string), System.TimeSpan? totalUsage = default(System.TimeSpan?), System.DateTime? passwordLastReset = default(System.DateTime?)) - { - Name = name; - Description = description; - Id = id; - ProvisioningState = provisioningState; - VirtualMachineDetails = virtualMachineDetails; - LatestOperationResult = latestOperationResult; - EnvironmentState = environmentState; - TotalUsage = totalUsage; - PasswordLastReset = passwordLastReset; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets name of the Environment - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets description of the Environment - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - - /// - /// Gets resource Id of the environment - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets the provisioning state of the environment. This also includes - /// LabIsFull and NotYetProvisioned status. - /// - [JsonProperty(PropertyName = "provisioningState")] - public string ProvisioningState { get; private set; } - - /// - /// Gets details of backing DTL virtual machine with compute and - /// network details. - /// - [JsonProperty(PropertyName = "virtualMachineDetails")] - public VirtualMachineDetails VirtualMachineDetails { get; private set; } - - /// - /// Gets the details of the latest operation. ex: status, error - /// - [JsonProperty(PropertyName = "latestOperationResult")] - public LatestOperationResult LatestOperationResult { get; private set; } - - /// - /// Gets publishing state of the environment setting Possible values - /// are Creating, Created, Failed - /// - [JsonProperty(PropertyName = "environmentState")] - public string EnvironmentState { get; private set; } - - /// - /// Gets how long the environment has been used by a lab user - /// - [JsonProperty(PropertyName = "totalUsage")] - public System.TimeSpan? TotalUsage { get; private set; } - - /// - /// Gets when the password was last reset on the environment. - /// - [JsonProperty(PropertyName = "passwordLastReset")] - public System.DateTime? PasswordLastReset { get; private set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentFragment.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentFragment.cs deleted file mode 100644 index 3b300f29d218..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentFragment.cs +++ /dev/null @@ -1,81 +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.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents an environment instance - /// - [Rest.Serialization.JsonTransformation] - public partial class EnvironmentFragment : Resource - { - /// - /// Initializes a new instance of the EnvironmentFragment class. - /// - public EnvironmentFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EnvironmentFragment class. - /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The set of a VM and the setting id it - /// was created for - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public EnvironmentFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), ResourceSetFragment resourceSets = default(ResourceSetFragment), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) - { - ResourceSets = resourceSets; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the set of a VM and the setting id it was created for - /// - [JsonProperty(PropertyName = "properties.resourceSets")] - public ResourceSetFragment ResourceSets { get; set; } - - /// - /// Gets or sets the provisioning status of the resource. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } - - /// - /// Gets or sets the unique immutable identifier of a resource (Guid). - /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentOperationsPayload.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentOperationsPayload.cs deleted file mode 100644 index 80f0f9d7cd5a..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentOperationsPayload.cs +++ /dev/null @@ -1,69 +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.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents payload for any Environment operations like get, start, - /// stop, connect - /// - public partial class EnvironmentOperationsPayload - { - /// - /// Initializes a new instance of the EnvironmentOperationsPayload - /// class. - /// - public EnvironmentOperationsPayload() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EnvironmentOperationsPayload - /// class. - /// - /// The resourceId of the - /// environment - public EnvironmentOperationsPayload(string environmentId) - { - EnvironmentId = environmentId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the resourceId of the environment - /// - [JsonProperty(PropertyName = "environmentId")] - public string EnvironmentId { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (EnvironmentId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "EnvironmentId"); - } - } - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentSetting.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentSetting.cs deleted file mode 100644 index bca1d48abc11..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentSetting.cs +++ /dev/null @@ -1,169 +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.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents settings of an environment, from which environment instances - /// would be created - /// - [Rest.Serialization.JsonTransformation] - public partial class EnvironmentSetting : Resource - { - /// - /// Initializes a new instance of the EnvironmentSetting class. - /// - public EnvironmentSetting() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EnvironmentSetting class. - /// - /// The resource specific - /// settings - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// Describes the readiness of this - /// environment setting. Possible values include: 'Draft', - /// 'Publishing', 'Published', 'PublishFailed', 'Scaling' - /// Describes the user's progress in - /// configuring their environment setting. Possible values include: - /// 'NotApplicable', 'Completed' - /// Describes the environment and its - /// resource settings - /// Brief title describing the environment and its - /// resource settings - /// Time when the template VM was last - /// changed. - /// Time when the template VM was last sent - /// for publishing. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - /// The details of the latest - /// operation. ex: status, error - public EnvironmentSetting(ResourceSettings resourceSettings, string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string publishingState = default(string), string configurationState = default(string), string description = default(string), string title = default(string), System.DateTime? lastChanged = default(System.DateTime?), System.DateTime? lastPublished = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string), LatestOperationResult latestOperationResult = default(LatestOperationResult)) - : base(id, name, type, location, tags) - { - PublishingState = publishingState; - ConfigurationState = configurationState; - Description = description; - Title = title; - ResourceSettings = resourceSettings; - LastChanged = lastChanged; - LastPublished = lastPublished; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - LatestOperationResult = latestOperationResult; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets describes the readiness of this environment setting. Possible - /// values include: 'Draft', 'Publishing', 'Published', - /// 'PublishFailed', 'Scaling' - /// - [JsonProperty(PropertyName = "properties.publishingState")] - public string PublishingState { get; private set; } - - /// - /// Gets or sets describes the user's progress in configuring their - /// environment setting. Possible values include: 'NotApplicable', - /// 'Completed' - /// - [JsonProperty(PropertyName = "properties.configurationState")] - public string ConfigurationState { get; set; } - - /// - /// Gets or sets describes the environment and its resource settings - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } - - /// - /// Gets or sets brief title describing the environment and its - /// resource settings - /// - [JsonProperty(PropertyName = "properties.title")] - public string Title { get; set; } - - /// - /// Gets or sets the resource specific settings - /// - [JsonProperty(PropertyName = "properties.resourceSettings")] - public ResourceSettings ResourceSettings { get; set; } - - /// - /// Gets time when the template VM was last changed. - /// - [JsonProperty(PropertyName = "properties.lastChanged")] - public System.DateTime? LastChanged { get; private set; } - - /// - /// Gets time when the template VM was last sent for publishing. - /// - [JsonProperty(PropertyName = "properties.lastPublished")] - public System.DateTime? LastPublished { get; private set; } - - /// - /// Gets or sets the provisioning status of the resource. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } - - /// - /// Gets or sets the unique immutable identifier of a resource (Guid). - /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - - /// - /// Gets the details of the latest operation. ex: status, error - /// - [JsonProperty(PropertyName = "properties.latestOperationResult")] - public LatestOperationResult LatestOperationResult { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ResourceSettings == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ResourceSettings"); - } - if (ResourceSettings != null) - { - ResourceSettings.Validate(); - } - } - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentSettingCreationParameters.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentSettingCreationParameters.cs deleted file mode 100644 index da023393d194..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentSettingCreationParameters.cs +++ /dev/null @@ -1,72 +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.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Settings related to creating an environment setting - /// - public partial class EnvironmentSettingCreationParameters - { - /// - /// Initializes a new instance of the - /// EnvironmentSettingCreationParameters class. - /// - public EnvironmentSettingCreationParameters() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// EnvironmentSettingCreationParameters class. - /// - /// The resource - /// specific settings - public EnvironmentSettingCreationParameters(ResourceSettingCreationParameters resourceSettingCreationParameters) - { - ResourceSettingCreationParameters = resourceSettingCreationParameters; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the resource specific settings - /// - [JsonProperty(PropertyName = "resourceSettingCreationParameters")] - public ResourceSettingCreationParameters ResourceSettingCreationParameters { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ResourceSettingCreationParameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ResourceSettingCreationParameters"); - } - if (ResourceSettingCreationParameters != null) - { - ResourceSettingCreationParameters.Validate(); - } - } - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentSettingFragment.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentSettingFragment.cs deleted file mode 100644 index 70a9592b95e5..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentSettingFragment.cs +++ /dev/null @@ -1,113 +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.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents settings of an environment, from which environment instances - /// would be created - /// - [Rest.Serialization.JsonTransformation] - public partial class EnvironmentSettingFragment : Resource - { - /// - /// Initializes a new instance of the EnvironmentSettingFragment class. - /// - public EnvironmentSettingFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EnvironmentSettingFragment class. - /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// Describes the user's progress in - /// configuring their environment setting. Possible values include: - /// 'NotApplicable', 'Completed' - /// Describes the environment and its - /// resource settings - /// Brief title describing the environment and its - /// resource settings - /// The resource specific - /// settings - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public EnvironmentSettingFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string configurationState = default(string), string description = default(string), string title = default(string), ResourceSettingsFragment resourceSettings = default(ResourceSettingsFragment), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) - { - ConfigurationState = configurationState; - Description = description; - Title = title; - ResourceSettings = resourceSettings; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets describes the user's progress in configuring their - /// environment setting. Possible values include: 'NotApplicable', - /// 'Completed' - /// - [JsonProperty(PropertyName = "properties.configurationState")] - public string ConfigurationState { get; set; } - - /// - /// Gets or sets describes the environment and its resource settings - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } - - /// - /// Gets or sets brief title describing the environment and its - /// resource settings - /// - [JsonProperty(PropertyName = "properties.title")] - public string Title { get; set; } - - /// - /// Gets or sets the resource specific settings - /// - [JsonProperty(PropertyName = "properties.resourceSettings")] - public ResourceSettingsFragment ResourceSettings { get; set; } - - /// - /// Gets or sets the provisioning status of the resource. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } - - /// - /// Gets or sets the unique immutable identifier of a resource (Guid). - /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentSize.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentSize.cs deleted file mode 100644 index 722a9703c342..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentSize.cs +++ /dev/null @@ -1,101 +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.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents a size category supported by this Lab Account (small, medium - /// or large) - /// - public partial class EnvironmentSize - { - /// - /// Initializes a new instance of the EnvironmentSize class. - /// - public EnvironmentSize() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EnvironmentSize class. - /// - /// The size category. Possible values include: - /// 'Basic', 'Standard', 'Performance' - /// Represents a set of compute sizes that can - /// serve this given size type - /// The pay-as-you-go dollar price per hour this - /// size will cost. It does not include discounts and may not reflect - /// the actual price the size will cost. This is the maximum price of - /// all prices within this tier. - /// The number of cores a VM of this - /// size has. This is the minimum number of cores within this - /// tier. - /// The amount of memory available (in GB). - /// This is the minimum amount of memory within this tier. - public EnvironmentSize(string name = default(string), IList vmSizes = default(IList), decimal? maxPrice = default(decimal?), int? minNumberOfCores = default(int?), double? minMemory = default(double?)) - { - Name = name; - VmSizes = vmSizes; - MaxPrice = maxPrice; - MinNumberOfCores = minNumberOfCores; - MinMemory = minMemory; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the size category. Possible values include: 'Basic', - /// 'Standard', 'Performance' - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets represents a set of compute sizes that can serve this - /// given size type - /// - [JsonProperty(PropertyName = "vmSizes")] - public IList VmSizes { get; set; } - - /// - /// Gets the pay-as-you-go dollar price per hour this size will cost. - /// It does not include discounts and may not reflect the actual price - /// the size will cost. This is the maximum price of all prices within - /// this tier. - /// - [JsonProperty(PropertyName = "maxPrice")] - public decimal? MaxPrice { get; private set; } - - /// - /// Gets the number of cores a VM of this size has. This is the minimum - /// number of cores within this tier. - /// - [JsonProperty(PropertyName = "minNumberOfCores")] - public int? MinNumberOfCores { get; private set; } - - /// - /// Gets the amount of memory available (in GB). This is the minimum - /// amount of memory within this tier. - /// - [JsonProperty(PropertyName = "minMemory")] - public double? MinMemory { get; private set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentSizeFragment.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentSizeFragment.cs deleted file mode 100644 index b44cf5d2c535..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/EnvironmentSizeFragment.cs +++ /dev/null @@ -1,66 +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.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents a size category supported by this Lab Account (small, medium - /// or large) - /// - public partial class EnvironmentSizeFragment - { - /// - /// Initializes a new instance of the EnvironmentSizeFragment class. - /// - public EnvironmentSizeFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EnvironmentSizeFragment class. - /// - /// The size category. Possible values include: - /// 'Basic', 'Standard', 'Performance' - /// Represents a set of compute sizes that can - /// serve this given size type - public EnvironmentSizeFragment(string name = default(string), IList vmSizes = default(IList)) - { - Name = name; - VmSizes = vmSizes; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the size category. Possible values include: 'Basic', - /// 'Standard', 'Performance' - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets represents a set of compute sizes that can serve this - /// given size type - /// - [JsonProperty(PropertyName = "vmSizes")] - public IList VmSizes { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationError.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ErrorAdditionalInfo.cs similarity index 51% rename from sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationError.cs rename to sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ErrorAdditionalInfo.cs index 43e7eb721b21..69414cc7d8ff 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationError.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ErrorAdditionalInfo.cs @@ -14,28 +14,27 @@ namespace Microsoft.Azure.Management.LabServices.Models using System.Linq; /// - /// Error details for the operation in case of a failure. + /// The resource management error additional info. /// - public partial class OperationError + public partial class ErrorAdditionalInfo { /// - /// Initializes a new instance of the OperationError class. + /// Initializes a new instance of the ErrorAdditionalInfo class. /// - public OperationError() + public ErrorAdditionalInfo() { CustomInit(); } /// - /// Initializes a new instance of the OperationError class. + /// Initializes a new instance of the ErrorAdditionalInfo class. /// - /// The error code of the operation error. - /// The error message of the operation - /// error. - public OperationError(string code = default(string), string message = default(string)) + /// The additional info type. + /// The additional info. + public ErrorAdditionalInfo(string type = default(string), object info = default(object)) { - Code = code; - Message = message; + Type = type; + Info = info; CustomInit(); } @@ -45,16 +44,16 @@ public OperationError() partial void CustomInit(); /// - /// Gets or sets the error code of the operation error. + /// Gets the additional info type. /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } /// - /// Gets or sets the error message of the operation error. + /// Gets the additional info. /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } + [JsonProperty(PropertyName = "info")] + public object Info { get; private set; } } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ErrorDetail.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ErrorDetail.cs new file mode 100644 index 000000000000..0be460111400 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ErrorDetail.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The error detail. + /// + public partial class ErrorDetail + { + /// + /// Initializes a new instance of the ErrorDetail class. + /// + public ErrorDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetail class. + /// + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + public ErrorDetail(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + AdditionalInfo = additionalInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabCreationParameters.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ErrorResponse.cs similarity index 55% rename from sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabCreationParameters.cs rename to sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ErrorResponse.cs index 24d977e41d2e..95a3c11986d1 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabCreationParameters.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ErrorResponse.cs @@ -14,26 +14,30 @@ namespace Microsoft.Azure.Management.LabServices.Models using System.Linq; /// - /// Settings related to creating a lab + /// Error response /// - public partial class LabCreationParameters + /// + /// Common error response for all Azure Resource Manager APIs to return + /// error details for failed operations. (This also follows the OData error + /// response format.). + /// + public partial class ErrorResponse { /// - /// Initializes a new instance of the LabCreationParameters class. + /// Initializes a new instance of the ErrorResponse class. /// - public LabCreationParameters() + public ErrorResponse() { CustomInit(); } /// - /// Initializes a new instance of the LabCreationParameters class. + /// Initializes a new instance of the ErrorResponse class. /// - /// Maximum number of users allowed in the - /// lab. - public LabCreationParameters(int? maxUsersInLab = default(int?)) + /// The error object. + public ErrorResponse(ErrorDetail error = default(ErrorDetail)) { - MaxUsersInLab = maxUsersInLab; + Error = error; CustomInit(); } @@ -43,10 +47,10 @@ public LabCreationParameters() partial void CustomInit(); /// - /// Gets or sets maximum number of users allowed in the lab. + /// Gets or sets the error object. /// - [JsonProperty(PropertyName = "maxUsersInLab")] - public int? MaxUsersInLab { get; set; } + [JsonProperty(PropertyName = "error")] + public ErrorDetail Error { get; set; } } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ErrorResponseException.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..fa277dca3a5b --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GalleryImage.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GalleryImage.cs deleted file mode 100644 index d37ec48047b7..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GalleryImage.cs +++ /dev/null @@ -1,162 +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.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents an image from the Azure Marketplace - /// - [Rest.Serialization.JsonTransformation] - public partial class GalleryImage : Resource - { - /// - /// Initializes a new instance of the GalleryImage class. - /// - public GalleryImage() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the GalleryImage class. - /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The author of the gallery image. - /// The creation date of the gallery - /// image. - /// The description of the gallery - /// image. - /// The image reference of the gallery - /// image. - /// The icon of the gallery image. - /// Indicates whether this gallery image is - /// enabled. - /// Indicates whether this gallery has been - /// overridden for this lab account - /// The third party plan that applies to this - /// image - /// Indicates if the plan has been - /// authorized for programmatic deployment. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - /// The details of the latest - /// operation. ex: status, error - public GalleryImage(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string author = default(string), System.DateTime? createdDate = default(System.DateTime?), string description = default(string), GalleryImageReference imageReference = default(GalleryImageReference), string icon = default(string), bool? isEnabled = default(bool?), bool? isOverride = default(bool?), string planId = default(string), bool? isPlanAuthorized = default(bool?), string provisioningState = default(string), string uniqueIdentifier = default(string), LatestOperationResult latestOperationResult = default(LatestOperationResult)) - : base(id, name, type, location, tags) - { - Author = author; - CreatedDate = createdDate; - Description = description; - ImageReference = imageReference; - Icon = icon; - IsEnabled = isEnabled; - IsOverride = isOverride; - PlanId = planId; - IsPlanAuthorized = isPlanAuthorized; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - LatestOperationResult = latestOperationResult; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the author of the gallery image. - /// - [JsonProperty(PropertyName = "properties.author")] - public string Author { get; private set; } - - /// - /// Gets the creation date of the gallery image. - /// - [JsonProperty(PropertyName = "properties.createdDate")] - public System.DateTime? CreatedDate { get; private set; } - - /// - /// Gets the description of the gallery image. - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; private set; } - - /// - /// Gets the image reference of the gallery image. - /// - [JsonProperty(PropertyName = "properties.imageReference")] - public GalleryImageReference ImageReference { get; private set; } - - /// - /// Gets the icon of the gallery image. - /// - [JsonProperty(PropertyName = "properties.icon")] - public string Icon { get; private set; } - - /// - /// Gets or sets indicates whether this gallery image is enabled. - /// - [JsonProperty(PropertyName = "properties.isEnabled")] - public bool? IsEnabled { get; set; } - - /// - /// Gets or sets indicates whether this gallery has been overridden for - /// this lab account - /// - [JsonProperty(PropertyName = "properties.isOverride")] - public bool? IsOverride { get; set; } - - /// - /// Gets the third party plan that applies to this image - /// - [JsonProperty(PropertyName = "properties.planId")] - public string PlanId { get; private set; } - - /// - /// Gets or sets indicates if the plan has been authorized for - /// programmatic deployment. - /// - [JsonProperty(PropertyName = "properties.isPlanAuthorized")] - public bool? IsPlanAuthorized { get; set; } - - /// - /// Gets or sets the provisioning status of the resource. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } - - /// - /// Gets or sets the unique immutable identifier of a resource (Guid). - /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - - /// - /// Gets the details of the latest operation. ex: status, error - /// - [JsonProperty(PropertyName = "properties.latestOperationResult")] - public LatestOperationResult LatestOperationResult { get; private set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GalleryImageFragment.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GalleryImageFragment.cs deleted file mode 100644 index 728e66522fe3..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GalleryImageFragment.cs +++ /dev/null @@ -1,101 +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.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents an image from the Azure Marketplace - /// - [Rest.Serialization.JsonTransformation] - public partial class GalleryImageFragment : Resource - { - /// - /// Initializes a new instance of the GalleryImageFragment class. - /// - public GalleryImageFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the GalleryImageFragment class. - /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// Indicates whether this gallery image is - /// enabled. - /// Indicates whether this gallery has been - /// overridden for this lab account - /// Indicates if the plan has been - /// authorized for programmatic deployment. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public GalleryImageFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), bool? isEnabled = default(bool?), bool? isOverride = default(bool?), bool? isPlanAuthorized = default(bool?), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) - { - IsEnabled = isEnabled; - IsOverride = isOverride; - IsPlanAuthorized = isPlanAuthorized; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets indicates whether this gallery image is enabled. - /// - [JsonProperty(PropertyName = "properties.isEnabled")] - public bool? IsEnabled { get; set; } - - /// - /// Gets or sets indicates whether this gallery has been overridden for - /// this lab account - /// - [JsonProperty(PropertyName = "properties.isOverride")] - public bool? IsOverride { get; set; } - - /// - /// Gets or sets indicates if the plan has been authorized for - /// programmatic deployment. - /// - [JsonProperty(PropertyName = "properties.isPlanAuthorized")] - public bool? IsPlanAuthorized { get; set; } - - /// - /// Gets or sets the provisioning status of the resource. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } - - /// - /// Gets or sets the unique immutable identifier of a resource (Guid). - /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GalleryImageReferenceFragment.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GalleryImageReferenceFragment.cs deleted file mode 100644 index 17aaa0df3794..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GalleryImageReferenceFragment.cs +++ /dev/null @@ -1,85 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The reference information for an Azure Marketplace image. - /// - public partial class GalleryImageReferenceFragment - { - /// - /// Initializes a new instance of the GalleryImageReferenceFragment - /// class. - /// - public GalleryImageReferenceFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the GalleryImageReferenceFragment - /// class. - /// - /// The offer of the gallery image. - /// The publisher of the gallery image. - /// The SKU of the gallery image. - /// The OS type of the gallery image. - /// The version of the gallery image. - public GalleryImageReferenceFragment(string offer = default(string), string publisher = default(string), string sku = default(string), string osType = default(string), string version = default(string)) - { - Offer = offer; - Publisher = publisher; - Sku = sku; - OsType = osType; - Version = version; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the offer of the gallery image. - /// - [JsonProperty(PropertyName = "offer")] - public string Offer { get; set; } - - /// - /// Gets or sets the publisher of the gallery image. - /// - [JsonProperty(PropertyName = "publisher")] - public string Publisher { get; set; } - - /// - /// Gets or sets the SKU of the gallery image. - /// - [JsonProperty(PropertyName = "sku")] - public string Sku { get; set; } - - /// - /// Gets or sets the OS type of the gallery image. - /// - [JsonProperty(PropertyName = "osType")] - public string OsType { get; set; } - - /// - /// Gets or sets the version of the gallery image. - /// - [JsonProperty(PropertyName = "version")] - public string Version { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GetPersonalPreferencesResponse.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GetPersonalPreferencesResponse.cs deleted file mode 100644 index 22556ea81636..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GetPersonalPreferencesResponse.cs +++ /dev/null @@ -1,64 +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.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents the PersonalPreferences for the user - /// - public partial class GetPersonalPreferencesResponse - { - /// - /// Initializes a new instance of the GetPersonalPreferencesResponse - /// class. - /// - public GetPersonalPreferencesResponse() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the GetPersonalPreferencesResponse - /// class. - /// - /// Id to be used by the cache orchestrator - /// Array of favorite lab resource - /// ids - public GetPersonalPreferencesResponse(string id = default(string), IList favoriteLabResourceIds = default(IList)) - { - Id = id; - FavoriteLabResourceIds = favoriteLabResourceIds; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets id to be used by the cache orchestrator - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets array of favorite lab resource ids - /// - [JsonProperty(PropertyName = "favoriteLabResourceIds")] - public IList FavoriteLabResourceIds { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GetRegionalAvailabilityResponse.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GetRegionalAvailabilityResponse.cs deleted file mode 100644 index 3b1fe9a1c287..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GetRegionalAvailabilityResponse.cs +++ /dev/null @@ -1,57 +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.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The response model from the GetRegionalAvailability action - /// - public partial class GetRegionalAvailabilityResponse - { - /// - /// Initializes a new instance of the GetRegionalAvailabilityResponse - /// class. - /// - public GetRegionalAvailabilityResponse() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the GetRegionalAvailabilityResponse - /// class. - /// - /// Availability information for - /// different size categories per region - public GetRegionalAvailabilityResponse(IList regionalAvailability = default(IList)) - { - RegionalAvailability = regionalAvailability; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets availability information for different size categories - /// per region - /// - [JsonProperty(PropertyName = "regionalAvailability")] - public IList RegionalAvailability { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Identity.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Identity.cs new file mode 100644 index 000000000000..e2fffb42005c --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Identity.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Identity for the resource. + /// + public partial class Identity + { + /// + /// Initializes a new instance of the Identity class. + /// + public Identity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Identity class. + /// + /// The principal ID of resource + /// identity. + /// The tenant ID of resource. + /// The identity type. Possible values include: + /// 'SystemAssigned' + public Identity(string principalId = default(string), string tenantId = default(string), ResourceIdentityType? type = default(ResourceIdentityType?)) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal ID of resource identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the tenant ID of resource. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets the identity type. Possible values include: + /// 'SystemAssigned' + /// + [JsonProperty(PropertyName = "type")] + public ResourceIdentityType? Type { get; set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Image.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Image.cs new file mode 100644 index 000000000000..9e021178ec17 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Image.cs @@ -0,0 +1,213 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Lab services virtual machine image + /// + [Rest.Serialization.JsonTransformation] + public partial class Image : ProxyResource + { + /// + /// Initializes a new instance of the Image class. + /// + public Image() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Image class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Metadata pertaining to creation and last + /// modification of the image. + /// Is the image enabled. Possible values + /// include: 'Enabled', 'Disabled' + /// Current provisioning state of the + /// image. Possible values include: 'Creating', 'Updating', 'Deleting', + /// 'Succeeded', 'Failed', 'Locked' + /// The image display name. + /// A description of the image. + /// URL of the image icon. + /// The image author. + /// The OS Type of the image. Possible values + /// include: 'Windows', 'Linux' + /// The ID of marketplace plan associated with the + /// image (optional). + /// The status of image terms of use (enabled + /// = accepted, disabled = not accepted). Possible values include: + /// 'Enabled', 'Disabled' + /// The ID of an offer associated with the + /// image. + /// The ID of the publisher of the + /// image. + /// The image SKU. + /// The image version. + /// The ID for the image in the shared + /// gallery. + /// The available regions of the image + /// in the shared gallery. + /// The OS State of the image. Possible values + /// include: 'Generalized', 'Specialized' + public Image(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), EnableState? enabledState = default(EnableState?), ProvisioningState? provisioningState = default(ProvisioningState?), string displayName = default(string), string description = default(string), string iconUrl = default(string), string author = default(string), OsType? osType = default(OsType?), string plan = default(string), EnableState? termsStatus = default(EnableState?), string offer = default(string), string publisher = default(string), string sku = default(string), string version = default(string), string sharedGalleryId = default(string), IList availableRegions = default(IList), OsState? osState = default(OsState?)) + : base(id, name, type) + { + SystemData = systemData; + EnabledState = enabledState; + ProvisioningState = provisioningState; + DisplayName = displayName; + Description = description; + IconUrl = iconUrl; + Author = author; + OsType = osType; + Plan = plan; + TermsStatus = termsStatus; + Offer = offer; + Publisher = publisher; + Sku = sku; + Version = version; + SharedGalleryId = sharedGalleryId; + AvailableRegions = availableRegions; + OsState = osState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets metadata pertaining to creation and last modification of the + /// image. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Gets or sets is the image enabled. Possible values include: + /// 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.enabledState")] + public EnableState? EnabledState { get; set; } + + /// + /// Gets current provisioning state of the image. Possible values + /// include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', + /// 'Locked' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public ProvisioningState? ProvisioningState { get; private set; } + + /// + /// Gets the image display name. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets a description of the image. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets URL of the image icon. + /// + [JsonProperty(PropertyName = "properties.iconUrl")] + public string IconUrl { get; private set; } + + /// + /// Gets the image author. + /// + [JsonProperty(PropertyName = "properties.author")] + public string Author { get; private set; } + + /// + /// Gets the OS Type of the image. Possible values include: 'Windows', + /// 'Linux' + /// + [JsonProperty(PropertyName = "properties.osType")] + public OsType? OsType { get; private set; } + + /// + /// Gets the ID of marketplace plan associated with the image + /// (optional). + /// + [JsonProperty(PropertyName = "properties.plan")] + public string Plan { get; private set; } + + /// + /// Gets the status of image terms of use (enabled = accepted, disabled + /// = not accepted). Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.termsStatus")] + public EnableState? TermsStatus { get; private set; } + + /// + /// Gets the ID of an offer associated with the image. + /// + [JsonProperty(PropertyName = "properties.offer")] + public string Offer { get; private set; } + + /// + /// Gets the ID of the publisher of the image. + /// + [JsonProperty(PropertyName = "properties.publisher")] + public string Publisher { get; private set; } + + /// + /// Gets the image SKU. + /// + [JsonProperty(PropertyName = "properties.sku")] + public string Sku { get; private set; } + + /// + /// Gets the image version. + /// + [JsonProperty(PropertyName = "properties.version")] + public string Version { get; private set; } + + /// + /// Gets the ID for the image in the shared gallery. + /// + [JsonProperty(PropertyName = "properties.sharedGalleryId")] + public string SharedGalleryId { get; private set; } + + /// + /// Gets or sets the available regions of the image in the shared + /// gallery. + /// + [JsonProperty(PropertyName = "properties.availableRegions")] + public IList AvailableRegions { get; set; } + + /// + /// Gets the OS State of the image. Possible values include: + /// 'Generalized', 'Specialized' + /// + [JsonProperty(PropertyName = "properties.osState")] + public OsState? OsState { get; private set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GalleryImageReference.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ImageReference.cs similarity index 50% rename from sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GalleryImageReference.cs rename to sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ImageReference.cs index a4f61006bdad..cc7c4122b11f 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GalleryImageReference.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ImageReference.cs @@ -14,33 +14,37 @@ namespace Microsoft.Azure.Management.LabServices.Models using System.Linq; /// - /// The reference information for an Azure Marketplace image. + /// Image reference information. Used in the virtual machine profile. /// - public partial class GalleryImageReference + public partial class ImageReference { /// - /// Initializes a new instance of the GalleryImageReference class. + /// Initializes a new instance of the ImageReference class. /// - public GalleryImageReference() + public ImageReference() { CustomInit(); } /// - /// Initializes a new instance of the GalleryImageReference class. + /// Initializes a new instance of the ImageReference class. /// - /// The offer of the gallery image. - /// The publisher of the gallery image. - /// The SKU of the gallery image. - /// The OS type of the gallery image. - /// The version of the gallery image. - public GalleryImageReference(string offer = default(string), string publisher = default(string), string sku = default(string), string osType = default(string), string version = default(string)) + /// Image resource ID + /// The image offer if applicable. + /// The image publisher + /// The image SKU + /// The image version specified on + /// creation. + /// The actual version of the image after + /// use. + public ImageReference(string id = default(string), string offer = default(string), string publisher = default(string), string sku = default(string), string version = default(string), string exactVersion = default(string)) { + Id = id; Offer = offer; Publisher = publisher; Sku = sku; - OsType = osType; Version = version; + ExactVersion = exactVersion; CustomInit(); } @@ -50,34 +54,40 @@ public GalleryImageReference() partial void CustomInit(); /// - /// Gets or sets the offer of the gallery image. + /// Gets or sets image resource ID + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets the image offer if applicable. /// [JsonProperty(PropertyName = "offer")] public string Offer { get; set; } /// - /// Gets or sets the publisher of the gallery image. + /// Gets or sets the image publisher /// [JsonProperty(PropertyName = "publisher")] public string Publisher { get; set; } /// - /// Gets or sets the SKU of the gallery image. + /// Gets or sets the image SKU /// [JsonProperty(PropertyName = "sku")] public string Sku { get; set; } /// - /// Gets or sets the OS type of the gallery image. + /// Gets or sets the image version specified on creation. /// - [JsonProperty(PropertyName = "osType")] - public string OsType { get; set; } + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } /// - /// Gets or sets the version of the gallery image. + /// Gets the actual version of the image after use. /// - [JsonProperty(PropertyName = "version")] - public string Version { get; set; } + [JsonProperty(PropertyName = "exactVersion")] + public string ExactVersion { get; private set; } } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GetEnvironmentResponse.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ImageUpdate.cs similarity index 52% rename from sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GetEnvironmentResponse.cs rename to sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ImageUpdate.cs index ab340303d8ae..7716f9de25e5 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/GetEnvironmentResponse.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ImageUpdate.cs @@ -10,29 +10,33 @@ namespace Microsoft.Azure.Management.LabServices.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Linq; /// - /// Represents the environments details + /// Lab services virtual machine image for updates. /// - public partial class GetEnvironmentResponse + [Rest.Serialization.JsonTransformation] + public partial class ImageUpdate { /// - /// Initializes a new instance of the GetEnvironmentResponse class. + /// Initializes a new instance of the ImageUpdate class. /// - public GetEnvironmentResponse() + public ImageUpdate() { CustomInit(); } /// - /// Initializes a new instance of the GetEnvironmentResponse class. + /// Initializes a new instance of the ImageUpdate class. /// - /// Details of the environment - public GetEnvironmentResponse(EnvironmentDetails environment = default(EnvironmentDetails)) + /// Is the image enabled. Possible values + /// include: 'Enabled', 'Disabled' + public ImageUpdate(EnableState? enabledState = default(EnableState?)) { - Environment = environment; + EnabledState = enabledState; CustomInit(); } @@ -42,10 +46,11 @@ public GetEnvironmentResponse() partial void CustomInit(); /// - /// Gets details of the environment + /// Gets or sets is the image enabled. Possible values include: + /// 'Enabled', 'Disabled' /// - [JsonProperty(PropertyName = "environment")] - public EnvironmentDetails Environment { get; private set; } + [JsonProperty(PropertyName = "properties.enabledState")] + public EnableState? EnabledState { get; set; } } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/InvitationState.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/InvitationState.cs new file mode 100644 index 000000000000..fc3df234d882 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/InvitationState.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// 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.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for InvitationState. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum InvitationState + { + /// + /// The invitation has not been sent. + /// + [EnumMember(Value = "NotSent")] + NotSent, + /// + /// Currently sending the invitation. + /// + [EnumMember(Value = "Sending")] + Sending, + /// + /// The invitation has been successfully sent. + /// + [EnumMember(Value = "Sent")] + Sent, + /// + /// There was an error while sending the invitation. + /// + [EnumMember(Value = "Failed")] + Failed + } + internal static class InvitationStateEnumExtension + { + internal static string ToSerializedValue(this InvitationState? value) + { + return value == null ? null : ((InvitationState)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this InvitationState value) + { + switch( value ) + { + case InvitationState.NotSent: + return "NotSent"; + case InvitationState.Sending: + return "Sending"; + case InvitationState.Sent: + return "Sent"; + case InvitationState.Failed: + return "Failed"; + } + return null; + } + + internal static InvitationState? ParseInvitationState(this string value) + { + switch( value ) + { + case "NotSent": + return InvitationState.NotSent; + case "Sending": + return InvitationState.Sending; + case "Sent": + return InvitationState.Sent; + case "Failed": + return InvitationState.Failed; + } + return null; + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ListEnvironmentsPayload.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/InviteBody.cs similarity index 59% rename from sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ListEnvironmentsPayload.cs rename to sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/InviteBody.cs index 2c82acf17143..23885c7c43ba 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ListEnvironmentsPayload.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/InviteBody.cs @@ -14,25 +14,25 @@ namespace Microsoft.Azure.Management.LabServices.Models using System.Linq; /// - /// Represents the payload to list environments owned by a user + /// Body for a user invite request /// - public partial class ListEnvironmentsPayload + public partial class InviteBody { /// - /// Initializes a new instance of the ListEnvironmentsPayload class. + /// Initializes a new instance of the InviteBody class. /// - public ListEnvironmentsPayload() + public InviteBody() { CustomInit(); } /// - /// Initializes a new instance of the ListEnvironmentsPayload class. + /// Initializes a new instance of the InviteBody class. /// - /// The resource Id of the lab - public ListEnvironmentsPayload(string labId = default(string)) + /// Custom text for the invite email. + public InviteBody(string text = default(string)) { - LabId = labId; + Text = text; CustomInit(); } @@ -42,10 +42,10 @@ public ListEnvironmentsPayload() partial void CustomInit(); /// - /// Gets or sets the resource Id of the lab + /// Gets or sets custom text for the invite email. /// - [JsonProperty(PropertyName = "labId")] - public string LabId { get; set; } + [JsonProperty(PropertyName = "text")] + public string Text { get; set; } } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Lab.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Lab.cs index 30c000d93cc2..a135405f165a 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Lab.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Lab.cs @@ -18,10 +18,10 @@ namespace Microsoft.Azure.Management.LabServices.Models using System.Linq; /// - /// Represents a lab. + /// The lab resource. /// [Rest.Serialization.JsonTransformation] - public partial class Lab : Resource + public partial class Lab : TrackedResource { /// /// Initializes a new instance of the Lab class. @@ -34,46 +34,57 @@ public Lab() /// /// Initializes a new instance of the Lab class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// Maximum number of users allowed in the - /// lab. - /// Maximum value MaxUsersInLab can be set to, - /// as specified by the service - /// Invitation code that users can use to - /// join a lab. - /// Object id of the user that created - /// the lab. - /// Maximum duration a user can use an - /// environment for in the lab. - /// Lab user access mode (open to all vs. - /// restricted to those listed on the lab). Possible values include: - /// 'Restricted', 'Open' - /// Lab creator name - /// Creation date for the lab - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - /// The details of the latest - /// operation. ex: status, error - public Lab(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), int? maxUsersInLab = default(int?), int? userQuota = default(int?), string invitationCode = default(string), string createdByObjectId = default(string), System.TimeSpan? usageQuota = default(System.TimeSpan?), string userAccessMode = default(string), string createdByUserPrincipalName = default(string), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string), LatestOperationResult latestOperationResult = default(LatestOperationResult)) - : base(id, name, type, location, tags) + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Resource tags. + /// Metadata pertaining to creation and last + /// modification of the lab. + /// The resource auto shutdown + /// configuration for the lab. This controls whether actions are taken + /// on resources that are sitting idle. + /// The connection profile for the lab. + /// This controls settings such as web access to lab resources or + /// whether RDP or SSH ports are open. + /// The profile used for creating + /// lab virtual machines. + /// The lab security profile. + /// The lab user list management + /// profile. + /// The ID of the lab plan. Used during + /// resource creation to provide defaults and acts as a permission + /// container when creating a lab via labs.azure.com. Setting a + /// labPlanId on an existing lab provides organization.. + /// The title of the lab. + /// The description of the lab. + /// Current provisioning state of the + /// lab. Possible values include: 'Creating', 'Updating', 'Deleting', + /// 'Succeeded', 'Failed', 'Locked' + /// The network profile for the lab, + /// typically applied via a lab plan. This profile cannot be modified + /// once a lab has been created. + /// The lab state. Possible values include: + /// 'Draft', 'Publishing', 'Scaling', 'Syncing', 'Published' + public Lab(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData), AutoShutdownProfile autoShutdownProfile = default(AutoShutdownProfile), ConnectionProfile connectionProfile = default(ConnectionProfile), VirtualMachineProfile virtualMachineProfile = default(VirtualMachineProfile), SecurityProfile securityProfile = default(SecurityProfile), RosterProfile rosterProfile = default(RosterProfile), string labPlanId = default(string), string title = default(string), string description = default(string), ProvisioningState? provisioningState = default(ProvisioningState?), LabNetworkProfile networkProfile = default(LabNetworkProfile), LabState? state = default(LabState?)) + : base(location, id, name, type, tags) { - MaxUsersInLab = maxUsersInLab; - UserQuota = userQuota; - InvitationCode = invitationCode; - CreatedByObjectId = createdByObjectId; - UsageQuota = usageQuota; - UserAccessMode = userAccessMode; - CreatedByUserPrincipalName = createdByUserPrincipalName; - CreatedDate = createdDate; + SystemData = systemData; + AutoShutdownProfile = autoShutdownProfile; + ConnectionProfile = connectionProfile; + VirtualMachineProfile = virtualMachineProfile; + SecurityProfile = securityProfile; + RosterProfile = rosterProfile; + LabPlanId = labPlanId; + Title = title; + Description = description; ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - LatestOperationResult = latestOperationResult; + NetworkProfile = networkProfile; + State = state; CustomInit(); } @@ -83,74 +94,114 @@ public Lab() partial void CustomInit(); /// - /// Gets or sets maximum number of users allowed in the lab. + /// Gets metadata pertaining to creation and last modification of the + /// lab. /// - [JsonProperty(PropertyName = "properties.maxUsersInLab")] - public int? MaxUsersInLab { get; set; } + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } /// - /// Gets maximum value MaxUsersInLab can be set to, as specified by the - /// service + /// Gets or sets the resource auto shutdown configuration for the lab. + /// This controls whether actions are taken on resources that are + /// sitting idle. /// - [JsonProperty(PropertyName = "properties.userQuota")] - public int? UserQuota { get; private set; } + [JsonProperty(PropertyName = "properties.autoShutdownProfile")] + public AutoShutdownProfile AutoShutdownProfile { get; set; } /// - /// Gets invitation code that users can use to join a lab. + /// Gets or sets the connection profile for the lab. This controls + /// settings such as web access to lab resources or whether RDP or SSH + /// ports are open. /// - [JsonProperty(PropertyName = "properties.invitationCode")] - public string InvitationCode { get; private set; } + [JsonProperty(PropertyName = "properties.connectionProfile")] + public ConnectionProfile ConnectionProfile { get; set; } /// - /// Gets object id of the user that created the lab. + /// Gets or sets the profile used for creating lab virtual machines. /// - [JsonProperty(PropertyName = "properties.createdByObjectId")] - public string CreatedByObjectId { get; private set; } + [JsonProperty(PropertyName = "properties.virtualMachineProfile")] + public VirtualMachineProfile VirtualMachineProfile { get; set; } /// - /// Gets or sets maximum duration a user can use an environment for in - /// the lab. + /// Gets or sets the lab security profile. /// - [JsonProperty(PropertyName = "properties.usageQuota")] - public System.TimeSpan? UsageQuota { get; set; } + [JsonProperty(PropertyName = "properties.securityProfile")] + public SecurityProfile SecurityProfile { get; set; } /// - /// Gets or sets lab user access mode (open to all vs. restricted to - /// those listed on the lab). Possible values include: 'Restricted', - /// 'Open' + /// Gets or sets the lab user list management profile. /// - [JsonProperty(PropertyName = "properties.userAccessMode")] - public string UserAccessMode { get; set; } + [JsonProperty(PropertyName = "properties.rosterProfile")] + public RosterProfile RosterProfile { get; set; } /// - /// Gets lab creator name + /// Gets or sets the ID of the lab plan. Used during resource creation + /// to provide defaults and acts as a permission container when + /// creating a lab via labs.azure.com. Setting a labPlanId on an + /// existing lab provides organization.. /// - [JsonProperty(PropertyName = "properties.createdByUserPrincipalName")] - public string CreatedByUserPrincipalName { get; private set; } + [JsonProperty(PropertyName = "properties.labPlanId")] + public string LabPlanId { get; set; } /// - /// Gets creation date for the lab + /// Gets or sets the title of the lab. /// - [JsonProperty(PropertyName = "properties.createdDate")] - public System.DateTime? CreatedDate { get; private set; } + [JsonProperty(PropertyName = "properties.title")] + public string Title { get; set; } /// - /// Gets or sets the provisioning status of the resource. + /// Gets or sets the description of the lab. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets current provisioning state of the lab. Possible values + /// include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', + /// 'Locked' /// [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + public ProvisioningState? ProvisioningState { get; private set; } /// - /// Gets or sets the unique immutable identifier of a resource (Guid). + /// Gets or sets the network profile for the lab, typically applied via + /// a lab plan. This profile cannot be modified once a lab has been + /// created. /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } + [JsonProperty(PropertyName = "properties.networkProfile")] + public LabNetworkProfile NetworkProfile { get; set; } /// - /// Gets the details of the latest operation. ex: status, error + /// Gets the lab state. Possible values include: 'Draft', 'Publishing', + /// 'Scaling', 'Syncing', 'Published' /// - [JsonProperty(PropertyName = "properties.latestOperationResult")] - public LatestOperationResult LatestOperationResult { get; private set; } + [JsonProperty(PropertyName = "properties.state")] + public LabState? State { get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (VirtualMachineProfile != null) + { + VirtualMachineProfile.Validate(); + } + if (Title != null) + { + if (Title.Length > 120) + { + throw new ValidationException(ValidationRules.MaxLength, "Title", 120); + } + if (Title.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Title", 1); + } + } + } } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabAccount.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabAccount.cs deleted file mode 100644 index 80aac0401c1b..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabAccount.cs +++ /dev/null @@ -1,99 +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.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents a lab account. - /// - [Rest.Serialization.JsonTransformation] - public partial class LabAccount : Resource - { - /// - /// Initializes a new instance of the LabAccount class. - /// - public LabAccount() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LabAccount class. - /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// Represents the size configuration - /// under the lab account - /// Represents if region selection - /// is enabled - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - /// The details of the latest - /// operation. ex: status, error - public LabAccount(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), SizeConfigurationProperties sizeConfiguration = default(SizeConfigurationProperties), bool? enabledRegionSelection = default(bool?), string provisioningState = default(string), string uniqueIdentifier = default(string), LatestOperationResult latestOperationResult = default(LatestOperationResult)) - : base(id, name, type, location, tags) - { - SizeConfiguration = sizeConfiguration; - EnabledRegionSelection = enabledRegionSelection; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - LatestOperationResult = latestOperationResult; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets represents the size configuration under the lab account - /// - [JsonProperty(PropertyName = "properties.sizeConfiguration")] - public SizeConfigurationProperties SizeConfiguration { get; private set; } - - /// - /// Gets or sets represents if region selection is enabled - /// - [JsonProperty(PropertyName = "properties.enabledRegionSelection")] - public bool? EnabledRegionSelection { get; set; } - - /// - /// Gets or sets the provisioning status of the resource. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } - - /// - /// Gets or sets the unique immutable identifier of a resource (Guid). - /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - - /// - /// Gets the details of the latest operation. ex: status, error - /// - [JsonProperty(PropertyName = "properties.latestOperationResult")] - public LatestOperationResult LatestOperationResult { get; private set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabAccountFragment.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabAccountFragment.cs deleted file mode 100644 index ad6f8f58601d..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabAccountFragment.cs +++ /dev/null @@ -1,81 +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.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents a lab account. - /// - [Rest.Serialization.JsonTransformation] - public partial class LabAccountFragment : Resource - { - /// - /// Initializes a new instance of the LabAccountFragment class. - /// - public LabAccountFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LabAccountFragment class. - /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// Represents if region selection - /// is enabled - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public LabAccountFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), bool? enabledRegionSelection = default(bool?), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) - { - EnabledRegionSelection = enabledRegionSelection; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets represents if region selection is enabled - /// - [JsonProperty(PropertyName = "properties.enabledRegionSelection")] - public bool? EnabledRegionSelection { get; set; } - - /// - /// Gets or sets the provisioning status of the resource. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } - - /// - /// Gets or sets the unique immutable identifier of a resource (Guid). - /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabDetails.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabDetails.cs deleted file mode 100644 index 895eb2ac87b9..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabDetails.cs +++ /dev/null @@ -1,78 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// This represents the details about a lab that the User is in, and its - /// state. - /// - public partial class LabDetails - { - /// - /// Initializes a new instance of the LabDetails class. - /// - public LabDetails() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LabDetails class. - /// - /// Name of the lab - /// The provisioning state of the - /// lab. - /// The Id of the lab. - /// The maximum duration a user can use a VM - /// in this lab. - public LabDetails(string name = default(string), string provisioningState = default(string), string id = default(string), System.TimeSpan? usageQuota = default(System.TimeSpan?)) - { - Name = name; - ProvisioningState = provisioningState; - Id = id; - UsageQuota = usageQuota; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets name of the lab - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the provisioning state of the lab. - /// - [JsonProperty(PropertyName = "provisioningState")] - public string ProvisioningState { get; set; } - - /// - /// Gets or sets the Id of the lab. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets the maximum duration a user can use a VM in this lab. - /// - [JsonProperty(PropertyName = "usageQuota")] - public System.TimeSpan? UsageQuota { get; private set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabFragment.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabFragment.cs deleted file mode 100644 index ac90012ba003..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabFragment.cs +++ /dev/null @@ -1,103 +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.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents a lab. - /// - [Rest.Serialization.JsonTransformation] - public partial class LabFragment : Resource - { - /// - /// Initializes a new instance of the LabFragment class. - /// - public LabFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LabFragment class. - /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// Maximum number of users allowed in the - /// lab. - /// Maximum duration a user can use an - /// environment for in the lab. - /// Lab user access mode (open to all vs. - /// restricted to those listed on the lab). Possible values include: - /// 'Restricted', 'Open' - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public LabFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), int? maxUsersInLab = default(int?), System.TimeSpan? usageQuota = default(System.TimeSpan?), string userAccessMode = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) - { - MaxUsersInLab = maxUsersInLab; - UsageQuota = usageQuota; - UserAccessMode = userAccessMode; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets maximum number of users allowed in the lab. - /// - [JsonProperty(PropertyName = "properties.maxUsersInLab")] - public int? MaxUsersInLab { get; set; } - - /// - /// Gets or sets maximum duration a user can use an environment for in - /// the lab. - /// - [JsonProperty(PropertyName = "properties.usageQuota")] - public System.TimeSpan? UsageQuota { get; set; } - - /// - /// Gets or sets lab user access mode (open to all vs. restricted to - /// those listed on the lab). Possible values include: 'Restricted', - /// 'Open' - /// - [JsonProperty(PropertyName = "properties.userAccessMode")] - public string UserAccessMode { get; set; } - - /// - /// Gets or sets the provisioning status of the resource. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } - - /// - /// Gets or sets the unique immutable identifier of a resource (Guid). - /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabNetworkProfile.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabNetworkProfile.cs new file mode 100644 index 000000000000..c3e5db3bc89a --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabNetworkProfile.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Profile for how to handle networking for Labs. + /// + public partial class LabNetworkProfile + { + /// + /// Initializes a new instance of the LabNetworkProfile class. + /// + public LabNetworkProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabNetworkProfile class. + /// + /// The external subnet resource id + /// The external load balancer resource + /// id + /// The external public IP resource id + public LabNetworkProfile(string subnetId = default(string), string loadBalancerId = default(string), string publicIpId = default(string)) + { + SubnetId = subnetId; + LoadBalancerId = loadBalancerId; + PublicIpId = publicIpId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the external subnet resource id + /// + [JsonProperty(PropertyName = "subnetId")] + public string SubnetId { get; set; } + + /// + /// Gets or sets the external load balancer resource id + /// + [JsonProperty(PropertyName = "loadBalancerId")] + public string LoadBalancerId { get; set; } + + /// + /// Gets or sets the external public IP resource id + /// + [JsonProperty(PropertyName = "publicIpId")] + public string PublicIpId { get; set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabPlan.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabPlan.cs new file mode 100644 index 000000000000..4b5d2663eb42 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabPlan.cs @@ -0,0 +1,176 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Lab Plans act as a permission container for creating labs via + /// labs.azure.com. Additionally, they can provide a set of default + /// configurations that will apply at the time of creating a lab, but these + /// defaults can still be overwritten. + /// + [Rest.Serialization.JsonTransformation] + public partial class LabPlan : TrackedResource + { + /// + /// Initializes a new instance of the LabPlan class. + /// + public LabPlan() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabPlan class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Resource tags. + /// Metadata pertaining to creation and last + /// modification of the lab plan. + /// The default lab connection + /// profile. This can be changed on a lab resource and only provides a + /// default profile. + /// The default lab shutdown + /// profile. This can be changed on a lab resource and only provides a + /// default profile. + /// The lab plan network profile. + /// To enforce lab network policies they must be defined here and + /// cannot be changed when there are existing labs associated with this + /// lab plan. + /// The allowed regions for the lab + /// creator to use when creating labs using this lab plan. + /// Resource ID of the Shared Image + /// Gallery attached to this lab plan. When saving a lab template + /// virtual machine image it will be persisted in this gallery. Shared + /// images from the gallery can be made available to use when creating + /// new labs. + /// Support contact information and + /// instructions for users of the lab plan. This information is + /// displayed to lab owners and virtual machine users for all labs in + /// the lab plan. + /// Base Url of the lms instance this + /// lab plan can link lab rosters against. + /// Current provisioning state of the + /// lab plan. Possible values include: 'Creating', 'Updating', + /// 'Deleting', 'Succeeded', 'Failed', 'Locked' + public LabPlan(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData), ConnectionProfile defaultConnectionProfile = default(ConnectionProfile), AutoShutdownProfile defaultAutoShutdownProfile = default(AutoShutdownProfile), LabPlanNetworkProfile defaultNetworkProfile = default(LabPlanNetworkProfile), IList allowedRegions = default(IList), string sharedGalleryId = default(string), SupportInfo supportInfo = default(SupportInfo), string linkedLmsInstance = default(string), ProvisioningState? provisioningState = default(ProvisioningState?)) + : base(location, id, name, type, tags) + { + SystemData = systemData; + DefaultConnectionProfile = defaultConnectionProfile; + DefaultAutoShutdownProfile = defaultAutoShutdownProfile; + DefaultNetworkProfile = defaultNetworkProfile; + AllowedRegions = allowedRegions; + SharedGalleryId = sharedGalleryId; + SupportInfo = supportInfo; + LinkedLmsInstance = linkedLmsInstance; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets metadata pertaining to creation and last modification of the + /// lab plan. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Gets or sets the default lab connection profile. This can be + /// changed on a lab resource and only provides a default profile. + /// + [JsonProperty(PropertyName = "properties.defaultConnectionProfile")] + public ConnectionProfile DefaultConnectionProfile { get; set; } + + /// + /// Gets or sets the default lab shutdown profile. This can be changed + /// on a lab resource and only provides a default profile. + /// + [JsonProperty(PropertyName = "properties.defaultAutoShutdownProfile")] + public AutoShutdownProfile DefaultAutoShutdownProfile { get; set; } + + /// + /// Gets or sets the lab plan network profile. To enforce lab network + /// policies they must be defined here and cannot be changed when there + /// are existing labs associated with this lab plan. + /// + [JsonProperty(PropertyName = "properties.defaultNetworkProfile")] + public LabPlanNetworkProfile DefaultNetworkProfile { get; set; } + + /// + /// Gets or sets the allowed regions for the lab creator to use when + /// creating labs using this lab plan. + /// + [JsonProperty(PropertyName = "properties.allowedRegions")] + public IList AllowedRegions { get; set; } + + /// + /// Gets or sets resource ID of the Shared Image Gallery attached to + /// this lab plan. When saving a lab template virtual machine image it + /// will be persisted in this gallery. Shared images from the gallery + /// can be made available to use when creating new labs. + /// + [JsonProperty(PropertyName = "properties.sharedGalleryId")] + public string SharedGalleryId { get; set; } + + /// + /// Gets or sets support contact information and instructions for users + /// of the lab plan. This information is displayed to lab owners and + /// virtual machine users for all labs in the lab plan. + /// + [JsonProperty(PropertyName = "properties.supportInfo")] + public SupportInfo SupportInfo { get; set; } + + /// + /// Gets or sets base Url of the lms instance this lab plan can link + /// lab rosters against. + /// + [JsonProperty(PropertyName = "properties.linkedLmsInstance")] + public string LinkedLmsInstance { get; set; } + + /// + /// Gets current provisioning state of the lab plan. Possible values + /// include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', + /// 'Locked' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public ProvisioningState? ProvisioningState { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RegisterPayload.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabPlanNetworkProfile.cs similarity index 58% rename from sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RegisterPayload.cs rename to sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabPlanNetworkProfile.cs index 74808148f3aa..9687a06b49ad 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RegisterPayload.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabPlanNetworkProfile.cs @@ -14,26 +14,25 @@ namespace Microsoft.Azure.Management.LabServices.Models using System.Linq; /// - /// Represents payload for Register action. + /// Profile for how to handle networking for Lab Plans. /// - public partial class RegisterPayload + public partial class LabPlanNetworkProfile { /// - /// Initializes a new instance of the RegisterPayload class. + /// Initializes a new instance of the LabPlanNetworkProfile class. /// - public RegisterPayload() + public LabPlanNetworkProfile() { CustomInit(); } /// - /// Initializes a new instance of the RegisterPayload class. + /// Initializes a new instance of the LabPlanNetworkProfile class. /// - /// The registration code of the - /// lab. - public RegisterPayload(string registrationCode = default(string)) + /// The external subnet resource id + public LabPlanNetworkProfile(string subnetId = default(string)) { - RegistrationCode = registrationCode; + SubnetId = subnetId; CustomInit(); } @@ -43,10 +42,10 @@ public RegisterPayload() partial void CustomInit(); /// - /// Gets or sets the registration code of the lab. + /// Gets or sets the external subnet resource id /// - [JsonProperty(PropertyName = "registrationCode")] - public string RegistrationCode { get; set; } + [JsonProperty(PropertyName = "subnetId")] + public string SubnetId { get; set; } } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabPlanUpdate.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabPlanUpdate.cs new file mode 100644 index 000000000000..91bf4e594e7a --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabPlanUpdate.cs @@ -0,0 +1,134 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Contains lab configuration and default settings. This variant is used + /// for PATCH. + /// + [Rest.Serialization.JsonTransformation] + public partial class LabPlanUpdate : TrackedResourceUpdate + { + /// + /// Initializes a new instance of the LabPlanUpdate class. + /// + public LabPlanUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabPlanUpdate class. + /// + /// Resource tags. + /// The default lab connection + /// profile. This can be changed on a lab resource and only provides a + /// default profile. + /// The default lab shutdown + /// profile. This can be changed on a lab resource and only provides a + /// default profile. + /// The lab plan network profile. + /// To enforce lab network policies they must be defined here and + /// cannot be changed when there are existing labs associated with this + /// lab plan. + /// The allowed regions for the lab + /// creator to use when creating labs using this lab plan. + /// Resource ID of the Shared Image + /// Gallery attached to this lab plan. When saving a lab template + /// virtual machine image it will be persisted in this gallery. Shared + /// images from the gallery can be made available to use when creating + /// new labs. + /// Support contact information and + /// instructions for users of the lab plan. This information is + /// displayed to lab owners and virtual machine users for all labs in + /// the lab plan. + /// Base Url of the lms instance this + /// lab plan can link lab rosters against. + public LabPlanUpdate(IList tags = default(IList), ConnectionProfile defaultConnectionProfile = default(ConnectionProfile), AutoShutdownProfile defaultAutoShutdownProfile = default(AutoShutdownProfile), LabPlanNetworkProfile defaultNetworkProfile = default(LabPlanNetworkProfile), IList allowedRegions = default(IList), string sharedGalleryId = default(string), SupportInfo supportInfo = default(SupportInfo), string linkedLmsInstance = default(string)) + : base(tags) + { + DefaultConnectionProfile = defaultConnectionProfile; + DefaultAutoShutdownProfile = defaultAutoShutdownProfile; + DefaultNetworkProfile = defaultNetworkProfile; + AllowedRegions = allowedRegions; + SharedGalleryId = sharedGalleryId; + SupportInfo = supportInfo; + LinkedLmsInstance = linkedLmsInstance; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the default lab connection profile. This can be + /// changed on a lab resource and only provides a default profile. + /// + [JsonProperty(PropertyName = "properties.defaultConnectionProfile")] + public ConnectionProfile DefaultConnectionProfile { get; set; } + + /// + /// Gets or sets the default lab shutdown profile. This can be changed + /// on a lab resource and only provides a default profile. + /// + [JsonProperty(PropertyName = "properties.defaultAutoShutdownProfile")] + public AutoShutdownProfile DefaultAutoShutdownProfile { get; set; } + + /// + /// Gets or sets the lab plan network profile. To enforce lab network + /// policies they must be defined here and cannot be changed when there + /// are existing labs associated with this lab plan. + /// + [JsonProperty(PropertyName = "properties.defaultNetworkProfile")] + public LabPlanNetworkProfile DefaultNetworkProfile { get; set; } + + /// + /// Gets or sets the allowed regions for the lab creator to use when + /// creating labs using this lab plan. + /// + [JsonProperty(PropertyName = "properties.allowedRegions")] + public IList AllowedRegions { get; set; } + + /// + /// Gets or sets resource ID of the Shared Image Gallery attached to + /// this lab plan. When saving a lab template virtual machine image it + /// will be persisted in this gallery. Shared images from the gallery + /// can be made available to use when creating new labs. + /// + [JsonProperty(PropertyName = "properties.sharedGalleryId")] + public string SharedGalleryId { get; set; } + + /// + /// Gets or sets support contact information and instructions for users + /// of the lab plan. This information is displayed to lab owners and + /// virtual machine users for all labs in the lab plan. + /// + [JsonProperty(PropertyName = "properties.supportInfo")] + public SupportInfo SupportInfo { get; set; } + + /// + /// Gets or sets base Url of the lms instance this lab plan can link + /// lab rosters against. + /// + [JsonProperty(PropertyName = "properties.linkedLmsInstance")] + public string LinkedLmsInstance { get; set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabState.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabState.cs new file mode 100644 index 000000000000..4d785a5ea78a --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabState.cs @@ -0,0 +1,93 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for LabState. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum LabState + { + /// + /// The lab is currently in draft (has not been published). + /// + [EnumMember(Value = "Draft")] + Draft, + /// + /// The lab is publishing. + /// + [EnumMember(Value = "Publishing")] + Publishing, + /// + /// The lab is scaling. + /// + [EnumMember(Value = "Scaling")] + Scaling, + /// + /// The lab is syncing users. + /// + [EnumMember(Value = "Syncing")] + Syncing, + /// + /// The lab has been published. + /// + [EnumMember(Value = "Published")] + Published + } + internal static class LabStateEnumExtension + { + internal static string ToSerializedValue(this LabState? value) + { + return value == null ? null : ((LabState)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this LabState value) + { + switch( value ) + { + case LabState.Draft: + return "Draft"; + case LabState.Publishing: + return "Publishing"; + case LabState.Scaling: + return "Scaling"; + case LabState.Syncing: + return "Syncing"; + case LabState.Published: + return "Published"; + } + return null; + } + + internal static LabState? ParseLabState(this string value) + { + switch( value ) + { + case "Draft": + return LabState.Draft; + case "Publishing": + return LabState.Publishing; + case "Scaling": + return LabState.Scaling; + case "Syncing": + return LabState.Syncing; + case "Published": + return LabState.Published; + } + return null; + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabUpdate.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabUpdate.cs new file mode 100644 index 000000000000..b9ae670c12d2 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabUpdate.cs @@ -0,0 +1,154 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The lab resource for updates. + /// + [Rest.Serialization.JsonTransformation] + public partial class LabUpdate : TrackedResourceUpdate + { + /// + /// Initializes a new instance of the LabUpdate class. + /// + public LabUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabUpdate class. + /// + /// Resource tags. + /// The resource auto shutdown + /// configuration for the lab. This controls whether actions are taken + /// on resources that are sitting idle. + /// The connection profile for the lab. + /// This controls settings such as web access to lab resources or + /// whether RDP or SSH ports are open. + /// The profile used for creating + /// lab virtual machines. + /// The lab security profile. + /// The lab user list management + /// profile. + /// The ID of the lab plan. Used during + /// resource creation to provide defaults and acts as a permission + /// container when creating a lab via labs.azure.com. Setting a + /// labPlanId on an existing lab provides organization.. + /// The title of the lab. + /// The description of the lab. + public LabUpdate(IList tags = default(IList), AutoShutdownProfile autoShutdownProfile = default(AutoShutdownProfile), ConnectionProfile connectionProfile = default(ConnectionProfile), VirtualMachineProfile virtualMachineProfile = default(VirtualMachineProfile), SecurityProfile securityProfile = default(SecurityProfile), RosterProfile rosterProfile = default(RosterProfile), string labPlanId = default(string), string title = default(string), string description = default(string)) + : base(tags) + { + AutoShutdownProfile = autoShutdownProfile; + ConnectionProfile = connectionProfile; + VirtualMachineProfile = virtualMachineProfile; + SecurityProfile = securityProfile; + RosterProfile = rosterProfile; + LabPlanId = labPlanId; + Title = title; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource auto shutdown configuration for the lab. + /// This controls whether actions are taken on resources that are + /// sitting idle. + /// + [JsonProperty(PropertyName = "properties.autoShutdownProfile")] + public AutoShutdownProfile AutoShutdownProfile { get; set; } + + /// + /// Gets or sets the connection profile for the lab. This controls + /// settings such as web access to lab resources or whether RDP or SSH + /// ports are open. + /// + [JsonProperty(PropertyName = "properties.connectionProfile")] + public ConnectionProfile ConnectionProfile { get; set; } + + /// + /// Gets or sets the profile used for creating lab virtual machines. + /// + [JsonProperty(PropertyName = "properties.virtualMachineProfile")] + public VirtualMachineProfile VirtualMachineProfile { get; set; } + + /// + /// Gets or sets the lab security profile. + /// + [JsonProperty(PropertyName = "properties.securityProfile")] + public SecurityProfile SecurityProfile { get; set; } + + /// + /// Gets or sets the lab user list management profile. + /// + [JsonProperty(PropertyName = "properties.rosterProfile")] + public RosterProfile RosterProfile { get; set; } + + /// + /// Gets or sets the ID of the lab plan. Used during resource creation + /// to provide defaults and acts as a permission container when + /// creating a lab via labs.azure.com. Setting a labPlanId on an + /// existing lab provides organization.. + /// + [JsonProperty(PropertyName = "properties.labPlanId")] + public string LabPlanId { get; set; } + + /// + /// Gets or sets the title of the lab. + /// + [JsonProperty(PropertyName = "properties.title")] + public string Title { get; set; } + + /// + /// Gets or sets the description of the lab. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (VirtualMachineProfile != null) + { + VirtualMachineProfile.Validate(); + } + if (Title != null) + { + if (Title.Length > 120) + { + throw new ValidationException(ValidationRules.MaxLength, "Title", 120); + } + if (Title.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Title", 1); + } + } + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LatestOperationResult.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LatestOperationResult.cs deleted file mode 100644 index 3c2cf8a49d91..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LatestOperationResult.cs +++ /dev/null @@ -1,93 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Details of the status of an operation. - /// - public partial class LatestOperationResult - { - /// - /// Initializes a new instance of the LatestOperationResult class. - /// - public LatestOperationResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LatestOperationResult class. - /// - /// The current status of the operation. - /// Error code on failure. - /// The error message. - /// Request URI of the operation. - /// The HttpMethod - PUT/POST/DELETE for the - /// operation. - /// The URL to use to check long-running - /// operation status - public LatestOperationResult(string status = default(string), string errorCode = default(string), string errorMessage = default(string), string requestUri = default(string), string httpMethod = default(string), string operationUrl = default(string)) - { - Status = status; - ErrorCode = errorCode; - ErrorMessage = errorMessage; - RequestUri = requestUri; - HttpMethod = httpMethod; - OperationUrl = operationUrl; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the current status of the operation. - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - - /// - /// Gets error code on failure. - /// - [JsonProperty(PropertyName = "errorCode")] - public string ErrorCode { get; private set; } - - /// - /// Gets the error message. - /// - [JsonProperty(PropertyName = "errorMessage")] - public string ErrorMessage { get; private set; } - - /// - /// Gets request URI of the operation. - /// - [JsonProperty(PropertyName = "requestUri")] - public string RequestUri { get; private set; } - - /// - /// Gets the HttpMethod - PUT/POST/DELETE for the operation. - /// - [JsonProperty(PropertyName = "httpMethod")] - public string HttpMethod { get; private set; } - - /// - /// Gets the URL to use to check long-running operation status - /// - [JsonProperty(PropertyName = "operationUrl")] - public string OperationUrl { get; private set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ListEnvironmentsResponse.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ListEnvironmentsResponse.cs deleted file mode 100644 index 87685b885d02..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ListEnvironmentsResponse.cs +++ /dev/null @@ -1,53 +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.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents the list of environments owned by a user - /// - public partial class ListEnvironmentsResponse - { - /// - /// Initializes a new instance of the ListEnvironmentsResponse class. - /// - public ListEnvironmentsResponse() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ListEnvironmentsResponse class. - /// - /// List of all the evironments - public ListEnvironmentsResponse(IList environments = default(IList)) - { - Environments = environments; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of all the evironments - /// - [JsonProperty(PropertyName = "environments")] - public IList Environments { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ManagedLabVmSize.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ManagedLabVmSize.cs deleted file mode 100644 index 9e6ddc7ef086..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ManagedLabVmSize.cs +++ /dev/null @@ -1,32 +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.Models -{ - - /// - /// Defines values for ManagedLabVmSize. - /// - public static class ManagedLabVmSize - { - /// - /// The base VM size - /// - public const string Basic = "Basic"; - /// - /// The standard or default VM size - /// - public const string Standard = "Standard"; - /// - /// The most performant VM size - /// - public const string Performance = "Performance"; - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/NetworkInterface.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/NetworkInterface.cs deleted file mode 100644 index 104f15954a9d..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/NetworkInterface.cs +++ /dev/null @@ -1,77 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Network details of the environment - /// - public partial class NetworkInterface - { - /// - /// Initializes a new instance of the NetworkInterface class. - /// - public NetworkInterface() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the NetworkInterface class. - /// - /// PrivateIp address of the Compute - /// VM - /// Connection information for Linux - /// Connection information for - /// Windows - /// Username of the VM - public NetworkInterface(string privateIpAddress = default(string), string sshAuthority = default(string), string rdpAuthority = default(string), string username = default(string)) - { - PrivateIpAddress = privateIpAddress; - SshAuthority = sshAuthority; - RdpAuthority = rdpAuthority; - Username = username; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets privateIp address of the Compute VM - /// - [JsonProperty(PropertyName = "privateIpAddress")] - public string PrivateIpAddress { get; private set; } - - /// - /// Gets connection information for Linux - /// - [JsonProperty(PropertyName = "sshAuthority")] - public string SshAuthority { get; private set; } - - /// - /// Gets connection information for Windows - /// - [JsonProperty(PropertyName = "rdpAuthority")] - public string RdpAuthority { get; private set; } - - /// - /// Gets username of the VM - /// - [JsonProperty(PropertyName = "username")] - public string Username { get; private set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Operation.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Operation.cs new file mode 100644 index 000000000000..ec3f472d3caa --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Operation.cs @@ -0,0 +1,109 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// REST API Operation + /// + /// + /// Details of a REST API operation, returned from the Resource Provider + /// Operations API + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + /// The name of the operation, as per Resource-Based + /// Access Control (RBAC). Examples: + /// "Microsoft.Compute/virtualMachines/write", + /// "Microsoft.Compute/virtualMachines/capture/action" + /// Whether the operation applies to + /// data-plane. This is "true" for data-plane operations and "false" + /// for ARM/control-plane operations. + /// Localized display information for this + /// particular operation. + /// The intended executor of the operation; as in + /// Resource Based Access Control (RBAC) and audit logs UX. Default + /// value is "user,system". Possible values include: 'user', 'system', + /// 'user,system' + /// Enum. Indicates the action type. + /// "Internal" refers to actions that are for internal only APIs. + /// Possible values include: 'Internal' + public Operation(string name = default(string), bool? isDataAction = default(bool?), OperationDisplay display = default(OperationDisplay), string origin = default(string), string actionType = default(string)) + { + Name = name; + IsDataAction = isDataAction; + Display = display; + Origin = origin; + ActionType = actionType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the operation, as per Resource-Based Access + /// Control (RBAC). Examples: + /// "Microsoft.Compute/virtualMachines/write", + /// "Microsoft.Compute/virtualMachines/capture/action" + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets whether the operation applies to data-plane. This is "true" + /// for data-plane operations and "false" for ARM/control-plane + /// operations. + /// + [JsonProperty(PropertyName = "isDataAction")] + public bool? IsDataAction { get; private set; } + + /// + /// Gets or sets localized display information for this particular + /// operation. + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + /// + /// Gets the intended executor of the operation; as in Resource Based + /// Access Control (RBAC) and audit logs UX. Default value is + /// "user,system". Possible values include: 'user', 'system', + /// 'user,system' + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; private set; } + + /// + /// Gets enum. Indicates the action type. "Internal" refers to actions + /// that are for internal only APIs. Possible values include: + /// 'Internal' + /// + [JsonProperty(PropertyName = "actionType")] + public string ActionType { get; private set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationBatchStatusPayload.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationBatchStatusPayload.cs deleted file mode 100644 index f909b33140bb..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationBatchStatusPayload.cs +++ /dev/null @@ -1,70 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.LabServices.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Payload to get the status of an operation - /// - public partial class OperationBatchStatusPayload - { - /// - /// Initializes a new instance of the OperationBatchStatusPayload - /// class. - /// - public OperationBatchStatusPayload() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OperationBatchStatusPayload - /// class. - /// - /// The operation url of long running - /// operation - public OperationBatchStatusPayload(IList urls) - { - Urls = urls; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the operation url of long running operation - /// - [JsonProperty(PropertyName = "urls")] - public IList Urls { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Urls == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Urls"); - } - } - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationBatchStatusResponse.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationBatchStatusResponse.cs deleted file mode 100644 index ac1a3c6e432b..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationBatchStatusResponse.cs +++ /dev/null @@ -1,57 +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.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Status Details of the long running operation for an environment - /// - public partial class OperationBatchStatusResponse - { - /// - /// Initializes a new instance of the OperationBatchStatusResponse - /// class. - /// - public OperationBatchStatusResponse() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OperationBatchStatusResponse - /// class. - /// - /// Gets a collection of items that contain the - /// operation url and status. - public OperationBatchStatusResponse(IList items = default(IList)) - { - Items = items; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets a collection of items that contain the operation url and - /// status. - /// - [JsonProperty(PropertyName = "items")] - public IList Items { get; private set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationBatchStatusResponseItem.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationBatchStatusResponseItem.cs deleted file mode 100644 index 0d3a52be95e4..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationBatchStatusResponseItem.cs +++ /dev/null @@ -1,63 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents the status of an operation that used the batch API. - /// - public partial class OperationBatchStatusResponseItem - { - /// - /// Initializes a new instance of the OperationBatchStatusResponseItem - /// class. - /// - public OperationBatchStatusResponseItem() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OperationBatchStatusResponseItem - /// class. - /// - /// status of the long running operation for - /// an environment - /// status of the long running operation for an - /// environment - public OperationBatchStatusResponseItem(string operationUrl = default(string), string status = default(string)) - { - OperationUrl = operationUrl; - Status = status; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets status of the long running operation for an environment - /// - [JsonProperty(PropertyName = "operationUrl")] - public string OperationUrl { get; private set; } - - /// - /// Gets status of the long running operation for an environment - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationDisplay.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..b966c8931753 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,89 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Localized display information for this particular operation. + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + /// The localized friendly form of the resource + /// provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + /// Compute". + /// The localized friendly name of the resource + /// type related to this operation. E.g. "Virtual Machines" or "Job + /// Schedule Collections". + /// The concise, localized friendly name for + /// the operation; suitable for dropdowns. E.g. "Create or Update + /// Virtual Machine", "Restart Virtual Machine". + /// The short, localized friendly description + /// of the operation; suitable for tool tips and detailed + /// views. + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the localized friendly form of the resource provider name, + /// e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; private set; } + + /// + /// Gets the localized friendly name of the resource type related to + /// this operation. E.g. "Virtual Machines" or "Job Schedule + /// Collections". + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; private set; } + + /// + /// Gets the concise, localized friendly name for the operation; + /// suitable for dropdowns. E.g. "Create or Update Virtual Machine", + /// "Restart Virtual Machine". + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; private set; } + + /// + /// Gets the short, localized friendly description of the operation; + /// suitable for tool tips and detailed views. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationMetadataDisplay.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationMetadataDisplay.cs deleted file mode 100644 index 8d75c14151e0..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationMetadataDisplay.cs +++ /dev/null @@ -1,79 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The object that describes the operations - /// - public partial class OperationMetadataDisplay - { - /// - /// Initializes a new instance of the OperationMetadataDisplay class. - /// - public OperationMetadataDisplay() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OperationMetadataDisplay class. - /// - /// Friendly name of the resource - /// provider - /// Resource type on which the operation is - /// performed. - /// Operation type: read, write, delete, - /// listKeys/action, etc. - /// Friendly name of the operation - public OperationMetadataDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) - { - Provider = provider; - Resource = resource; - Operation = operation; - Description = description; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets friendly name of the resource provider - /// - [JsonProperty(PropertyName = "provider")] - public string Provider { get; set; } - - /// - /// Gets or sets resource type on which the operation is performed. - /// - [JsonProperty(PropertyName = "resource")] - public string Resource { get; set; } - - /// - /// Gets or sets operation type: read, write, delete, listKeys/action, - /// etc. - /// - [JsonProperty(PropertyName = "operation")] - public string Operation { get; set; } - - /// - /// Gets or sets friendly name of the operation - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationResult.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationResult.cs index 0180eb81b326..4e8b362a8cae 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationResult.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationResult.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.Management.LabServices.Models using System.Linq; /// - /// An Operation Result + /// A long running operation result /// public partial class OperationResult { @@ -29,12 +29,25 @@ public OperationResult() /// /// Initializes a new instance of the OperationResult class. /// - /// The operation status. - /// Error details for the operation in case of a - /// failure. - public OperationResult(string status = default(string), OperationError error = default(OperationError)) + /// The operation status. Possible values include: + /// 'NotStarted', 'InProgress', 'Succeeded', 'Failed', + /// 'Canceled' + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// Start time + /// End time + /// Percent completion + /// The error for a failure if the operation + /// failed. + public OperationResult(OperationStatus status, string id = default(string), string name = default(string), System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?), double? percentComplete = default(double?), ErrorDetail error = default(ErrorDetail)) { + Id = id; + Name = name; Status = status; + StartTime = startTime; + EndTime = endTime; + PercentComplete = percentComplete; Error = error; CustomInit(); } @@ -45,16 +58,57 @@ public OperationResult() partial void CustomInit(); /// - /// Gets or sets the operation status. + /// Gets fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets or sets the operation status. Possible values include: + /// 'NotStarted', 'InProgress', 'Succeeded', 'Failed', 'Canceled' /// [JsonProperty(PropertyName = "status")] - public string Status { get; set; } + public OperationStatus Status { get; set; } /// - /// Gets or sets error details for the operation in case of a failure. + /// Gets or sets start time + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; set; } + + /// + /// Gets or sets end time + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime? EndTime { get; set; } + + /// + /// Gets or sets percent completion + /// + [JsonProperty(PropertyName = "percentComplete")] + public double? PercentComplete { get; set; } + + /// + /// Gets or sets the error for a failure if the operation failed. /// [JsonProperty(PropertyName = "error")] - public OperationError Error { get; set; } + public ErrorDetail Error { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationStatus.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationStatus.cs new file mode 100644 index 000000000000..a4ded51c4cdd --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationStatus.cs @@ -0,0 +1,93 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for OperationStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum OperationStatus + { + /// + /// The operation has been accepted but hasn't started. + /// + [EnumMember(Value = "NotStarted")] + NotStarted, + /// + /// The operation is running + /// + [EnumMember(Value = "InProgress")] + InProgress, + /// + /// The operation Succeeded + /// + [EnumMember(Value = "Succeeded")] + Succeeded, + /// + /// The operation failed + /// + [EnumMember(Value = "Failed")] + Failed, + /// + /// Not supported yet + /// + [EnumMember(Value = "Canceled")] + Canceled + } + internal static class OperationStatusEnumExtension + { + internal static string ToSerializedValue(this OperationStatus? value) + { + return value == null ? null : ((OperationStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this OperationStatus value) + { + switch( value ) + { + case OperationStatus.NotStarted: + return "NotStarted"; + case OperationStatus.InProgress: + return "InProgress"; + case OperationStatus.Succeeded: + return "Succeeded"; + case OperationStatus.Failed: + return "Failed"; + case OperationStatus.Canceled: + return "Canceled"; + } + return null; + } + + internal static OperationStatus? ParseOperationStatus(this string value) + { + switch( value ) + { + case "NotStarted": + return OperationStatus.NotStarted; + case "InProgress": + return OperationStatus.InProgress; + case "Succeeded": + return OperationStatus.Succeeded; + case "Failed": + return OperationStatus.Failed; + case "Canceled": + return OperationStatus.Canceled; + } + return null; + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationStatusPayload.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationStatusPayload.cs deleted file mode 100644 index b2e20f183049..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationStatusPayload.cs +++ /dev/null @@ -1,66 +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.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Payload to get the status of an operation - /// - public partial class OperationStatusPayload - { - /// - /// Initializes a new instance of the OperationStatusPayload class. - /// - public OperationStatusPayload() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OperationStatusPayload class. - /// - /// The operation url of long running - /// operation - public OperationStatusPayload(string operationUrl) - { - OperationUrl = operationUrl; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the operation url of long running operation - /// - [JsonProperty(PropertyName = "operationUrl")] - public string OperationUrl { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (OperationUrl == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "OperationUrl"); - } - } - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationStatusResponse.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationStatusResponse.cs deleted file mode 100644 index 2adb751e6d51..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationStatusResponse.cs +++ /dev/null @@ -1,52 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Status Details of the long running operation for an environment - /// - public partial class OperationStatusResponse - { - /// - /// Initializes a new instance of the OperationStatusResponse class. - /// - public OperationStatusResponse() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OperationStatusResponse class. - /// - /// status of the long running operation for an - /// environment - public OperationStatusResponse(string status = default(string)) - { - Status = status; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets status of the long running operation for an environment - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Origin.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Origin.cs new file mode 100644 index 000000000000..a2f7b6fae94e --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Origin.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + + /// + /// Defines values for Origin. + /// + public static class Origin + { + public const string User = "user"; + public const string System = "system"; + public const string Usersystem = "user,system"; + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OsState.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OsState.cs new file mode 100644 index 000000000000..223fe0ca28d9 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OsState.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for OsState. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum OsState + { + /// + /// Image does not contain any machine and user specific information. + /// + [EnumMember(Value = "Generalized")] + Generalized, + /// + /// Image contains machine and user specific information. + /// + [EnumMember(Value = "Specialized")] + Specialized + } + internal static class OsStateEnumExtension + { + internal static string ToSerializedValue(this OsState? value) + { + return value == null ? null : ((OsState)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this OsState value) + { + switch( value ) + { + case OsState.Generalized: + return "Generalized"; + case OsState.Specialized: + return "Specialized"; + } + return null; + } + + internal static OsState? ParseOsState(this string value) + { + switch( value ) + { + case "Generalized": + return OsState.Generalized; + case "Specialized": + return OsState.Specialized; + } + return null; + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OsType.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OsType.cs new file mode 100644 index 000000000000..f95d5a12a72b --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OsType.cs @@ -0,0 +1,60 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for OsType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum OsType + { + [EnumMember(Value = "Windows")] + Windows, + [EnumMember(Value = "Linux")] + Linux + } + internal static class OsTypeEnumExtension + { + internal static string ToSerializedValue(this OsType? value) + { + return value == null ? null : ((OsType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this OsType value) + { + switch( value ) + { + case OsType.Windows: + return "Windows"; + case OsType.Linux: + return "Linux"; + } + return null; + } + + internal static OsType? ParseOsType(this string value) + { + switch( value ) + { + case "Windows": + return OsType.Windows; + case "Linux": + return OsType.Linux; + } + return null; + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/PersonalPerferencesOperationsPayload.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/PersonalPerferencesOperationsPayload.cs deleted file mode 100644 index 9fb40d324c4a..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/PersonalPerferencesOperationsPayload.cs +++ /dev/null @@ -1,76 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents payload for any Environment operations like get, start, - /// stop, connect - /// - public partial class PersonalPerferencesOperationsPayload - { - /// - /// Initializes a new instance of the - /// PersonalPerferencesOperationsPayload class. - /// - public PersonalPerferencesOperationsPayload() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// PersonalPerferencesOperationsPayload class. - /// - /// Resource Id of the lab - /// account - /// Enum indicating if user is adding or - /// removing a favorite lab. Possible values include: 'Add', - /// 'Remove' - /// Resource Id of the lab to add/remove - /// from the favorites list - public PersonalPerferencesOperationsPayload(string labAccountResourceId = default(string), string addRemove = default(string), string labResourceId = default(string)) - { - LabAccountResourceId = labAccountResourceId; - AddRemove = addRemove; - LabResourceId = labResourceId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets resource Id of the lab account - /// - [JsonProperty(PropertyName = "labAccountResourceId")] - public string LabAccountResourceId { get; set; } - - /// - /// Gets or sets enum indicating if user is adding or removing a - /// favorite lab. Possible values include: 'Add', 'Remove' - /// - [JsonProperty(PropertyName = "addRemove")] - public string AddRemove { get; set; } - - /// - /// Gets or sets resource Id of the lab to add/remove from the - /// favorites list - /// - [JsonProperty(PropertyName = "labResourceId")] - public string LabResourceId { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Plan.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Plan.cs new file mode 100644 index 000000000000..9ddcd36305c8 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Plan.cs @@ -0,0 +1,116 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Plan for the resource. + /// + public partial class Plan + { + /// + /// Initializes a new instance of the Plan class. + /// + public Plan() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Plan class. + /// + /// A user defined name of the 3rd Party Artifact + /// that is being procured. + /// The publisher of the 3rd Party Artifact + /// that is being bought. E.g. NewRelic + /// The 3rd Party artifact that is being + /// procured. E.g. NewRelic. Product maps to the OfferID specified for + /// the artifact at the time of Data Market onboarding. + /// A publisher provided promotion code as + /// provisioned in Data Market for the said product/artifact. + /// The version of the desired + /// product/artifact. + public Plan(string name, string publisher, string product, string promotionCode = default(string), string version = default(string)) + { + Name = name; + Publisher = publisher; + Product = product; + PromotionCode = promotionCode; + Version = version; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a user defined name of the 3rd Party Artifact that is + /// being procured. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the publisher of the 3rd Party Artifact that is being + /// bought. E.g. NewRelic + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets the 3rd Party artifact that is being procured. E.g. + /// NewRelic. Product maps to the OfferID specified for the artifact at + /// the time of Data Market onboarding. + /// + [JsonProperty(PropertyName = "product")] + public string Product { get; set; } + + /// + /// Gets or sets a publisher provided promotion code as provisioned in + /// Data Market for the said product/artifact. + /// + [JsonProperty(PropertyName = "promotionCode")] + public string PromotionCode { get; set; } + + /// + /// Gets or sets the version of the desired product/artifact. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Publisher == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Publisher"); + } + if (Product == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Product"); + } + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ProvisioningState.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..edd92cddf86d --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,105 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ProvisioningState. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ProvisioningState + { + /// + /// Resource is in the process of being created. + /// + [EnumMember(Value = "Creating")] + Creating, + /// + /// New property values are being applied to the resource. + /// + [EnumMember(Value = "Updating")] + Updating, + /// + /// Resource is in the process of being deleted. + /// + [EnumMember(Value = "Deleting")] + Deleting, + /// + /// Resource is in healthy state after creation or update operation. + /// + [EnumMember(Value = "Succeeded")] + Succeeded, + /// + /// Previous operation on the resource has failed leaving resource in + /// unhealthy state. + /// + [EnumMember(Value = "Failed")] + Failed, + /// + /// The resource is locked and changes are currently blocked. This + /// could be due to maintenance or a scheduled operation. The state + /// will go back to succeeded once the locking operation has finished. + /// + [EnumMember(Value = "Locked")] + Locked + } + internal static class ProvisioningStateEnumExtension + { + internal static string ToSerializedValue(this ProvisioningState? value) + { + return value == null ? null : ((ProvisioningState)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ProvisioningState value) + { + switch( value ) + { + case ProvisioningState.Creating: + return "Creating"; + case ProvisioningState.Updating: + return "Updating"; + case ProvisioningState.Deleting: + return "Deleting"; + case ProvisioningState.Succeeded: + return "Succeeded"; + case ProvisioningState.Failed: + return "Failed"; + case ProvisioningState.Locked: + return "Locked"; + } + return null; + } + + internal static ProvisioningState? ParseProvisioningState(this string value) + { + switch( value ) + { + case "Creating": + return ProvisioningState.Creating; + case "Updating": + return ProvisioningState.Updating; + case "Deleting": + return ProvisioningState.Deleting; + case "Succeeded": + return ProvisioningState.Succeeded; + case "Failed": + return ProvisioningState.Failed; + case "Locked": + return ProvisioningState.Locked; + } + return null; + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ProxyResource.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ProxyResource.cs new file mode 100644 index 000000000000..ad6c4b89d22d --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ProxyResource.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using System.Linq; + + /// + /// Proxy Resource + /// + /// + /// The resource model definition for a Azure Resource Manager proxy + /// resource. It will not have tags and a location + /// + public partial class ProxyResource : Resource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/PublishPayload.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/PublishPayload.cs deleted file mode 100644 index f1c65bea5516..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/PublishPayload.cs +++ /dev/null @@ -1,53 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Payload for Publish operation on EnvironmentSetting. - /// - public partial class PublishPayload - { - /// - /// Initializes a new instance of the PublishPayload class. - /// - public PublishPayload() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the PublishPayload class. - /// - /// Whether to use existing VM custom - /// image when publishing. - public PublishPayload(bool? useExistingImage = default(bool?)) - { - UseExistingImage = useExistingImage; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets whether to use existing VM custom image when - /// publishing. - /// - [JsonProperty(PropertyName = "useExistingImage")] - public bool? UseExistingImage { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/PublishingState.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/PublishingState.cs deleted file mode 100644 index 98e8612f4a93..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/PublishingState.cs +++ /dev/null @@ -1,40 +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.Models -{ - - /// - /// Defines values for PublishingState. - /// - public static class PublishingState - { - /// - /// Initial state of an environment setting. - /// - public const string Draft = "Draft"; - /// - /// Currently provisioning resources. - /// - public const string Publishing = "Publishing"; - /// - /// All resources are currently provisioned. - /// - public const string Published = "Published"; - /// - /// Failed to provision all the necessary resources. - /// - public const string PublishFailed = "PublishFailed"; - /// - /// Currently provisioning resources without recreating VM image. - /// - public const string Scaling = "Scaling"; - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RecurrenceFrequency.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RecurrenceFrequency.cs new file mode 100644 index 000000000000..2bf46d6908c1 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RecurrenceFrequency.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for RecurrenceFrequency. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RecurrenceFrequency + { + /// + /// Schedule will run every days. + /// + [EnumMember(Value = "Daily")] + Daily, + /// + /// Schedule will run every week on days specified in weekDays. + /// + [EnumMember(Value = "Weekly")] + Weekly + } + internal static class RecurrenceFrequencyEnumExtension + { + internal static string ToSerializedValue(this RecurrenceFrequency? value) + { + return value == null ? null : ((RecurrenceFrequency)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this RecurrenceFrequency value) + { + switch( value ) + { + case RecurrenceFrequency.Daily: + return "Daily"; + case RecurrenceFrequency.Weekly: + return "Weekly"; + } + return null; + } + + internal static RecurrenceFrequency? ParseRecurrenceFrequency(this string value) + { + switch( value ) + { + case "Daily": + return RecurrenceFrequency.Daily; + case "Weekly": + return RecurrenceFrequency.Weekly; + } + return null; + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RecurrencePattern.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RecurrencePattern.cs new file mode 100644 index 000000000000..06b03e08da93 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RecurrencePattern.cs @@ -0,0 +1,108 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Recurrence pattern of a lab schedule. + /// + public partial class RecurrencePattern + { + /// + /// Initializes a new instance of the RecurrencePattern class. + /// + public RecurrencePattern() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecurrencePattern class. + /// + /// The frequency of the recurrence. Possible + /// values include: 'Daily', 'Weekly' + /// When the recurrence will expire. This + /// date is inclusive. + /// The week days the schedule runs. Used for + /// when the Frequency is set to Weekly. + /// The interval to invoke the schedule on. For + /// example, interval = 2 and RecurrenceFrequency.Daily will run every + /// 2 days. When no interval is supplied, an interval of 1 is + /// used. + public RecurrencePattern(RecurrenceFrequency frequency, System.DateTime expirationDate, IList weekDays = default(IList), int? interval = default(int?)) + { + Frequency = frequency; + WeekDays = weekDays; + Interval = interval; + ExpirationDate = expirationDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the frequency of the recurrence. Possible values + /// include: 'Daily', 'Weekly' + /// + [JsonProperty(PropertyName = "frequency")] + public RecurrenceFrequency Frequency { get; set; } + + /// + /// Gets or sets the week days the schedule runs. Used for when the + /// Frequency is set to Weekly. + /// + [JsonProperty(PropertyName = "weekDays")] + public IList WeekDays { get; set; } + + /// + /// Gets or sets the interval to invoke the schedule on. For example, + /// interval = 2 and RecurrenceFrequency.Daily will run every 2 days. + /// When no interval is supplied, an interval of 1 is used. + /// + [JsonProperty(PropertyName = "interval")] + public int? Interval { get; set; } + + /// + /// Gets or sets when the recurrence will expire. This date is + /// inclusive. + /// + [JsonConverter(typeof(DateJsonConverter))] + [JsonProperty(PropertyName = "expirationDate")] + public System.DateTime ExpirationDate { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Interval > 365) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Interval", 365); + } + if (Interval < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Interval", 1); + } + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ReferenceVm.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ReferenceVm.cs deleted file mode 100644 index 0d36348d4821..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ReferenceVm.cs +++ /dev/null @@ -1,93 +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.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Details of a Reference Vm - /// - public partial class ReferenceVm - { - /// - /// Initializes a new instance of the ReferenceVm class. - /// - public ReferenceVm() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ReferenceVm class. - /// - /// The username of the virtual machine - /// The password of the virtual machine. This - /// will be set to null in GET resource API - /// The state details for the reference - /// virtual machine. - /// VM resource Id for the - /// environment - public ReferenceVm(string userName, string password = default(string), VmStateDetails vmStateDetails = default(VmStateDetails), string vmResourceId = default(string)) - { - UserName = userName; - Password = password; - VmStateDetails = vmStateDetails; - VmResourceId = vmResourceId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the username of the virtual machine - /// - [JsonProperty(PropertyName = "userName")] - public string UserName { get; set; } - - /// - /// Gets or sets the password of the virtual machine. This will be set - /// to null in GET resource API - /// - [JsonProperty(PropertyName = "password")] - public string Password { get; set; } - - /// - /// Gets the state details for the reference virtual machine. - /// - [JsonProperty(PropertyName = "vmStateDetails")] - public VmStateDetails VmStateDetails { get; private set; } - - /// - /// Gets VM resource Id for the environment - /// - [JsonProperty(PropertyName = "vmResourceId")] - public string VmResourceId { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (UserName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "UserName"); - } - } - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ReferenceVmFragment.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ReferenceVmFragment.cs deleted file mode 100644 index 241f533417a3..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ReferenceVmFragment.cs +++ /dev/null @@ -1,61 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Details of a Reference Vm - /// - public partial class ReferenceVmFragment - { - /// - /// Initializes a new instance of the ReferenceVmFragment class. - /// - public ReferenceVmFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ReferenceVmFragment class. - /// - /// The username of the virtual machine - /// The password of the virtual machine. This - /// will be set to null in GET resource API - public ReferenceVmFragment(string userName = default(string), string password = default(string)) - { - UserName = userName; - Password = password; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the username of the virtual machine - /// - [JsonProperty(PropertyName = "userName")] - public string UserName { get; set; } - - /// - /// Gets or sets the password of the virtual machine. This will be set - /// to null in GET resource API - /// - [JsonProperty(PropertyName = "password")] - public string Password { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RegionalAvailability.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RegionalAvailability.cs deleted file mode 100644 index 35cf9a42a72a..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RegionalAvailability.cs +++ /dev/null @@ -1,62 +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.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The availability information of sizes across regions - /// - public partial class RegionalAvailability - { - /// - /// Initializes a new instance of the RegionalAvailability class. - /// - public RegionalAvailability() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RegionalAvailability class. - /// - /// Corresponding region - /// List of all the size information - /// for the region - public RegionalAvailability(string region = default(string), IList sizeAvailabilities = default(IList)) - { - Region = region; - SizeAvailabilities = sizeAvailabilities; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets corresponding region - /// - [JsonProperty(PropertyName = "region")] - public string Region { get; set; } - - /// - /// Gets or sets list of all the size information for the region - /// - [JsonProperty(PropertyName = "sizeAvailabilities")] - public IList SizeAvailabilities { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RegistrationState.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RegistrationState.cs new file mode 100644 index 000000000000..164c3ab5aef2 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RegistrationState.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for RegistrationState. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RegistrationState + { + /// + /// User has not yet registered with the lab. + /// + [EnumMember(Value = "Registered")] + Registered, + /// + /// User has registered with the lab. + /// + [EnumMember(Value = "NotRegistered")] + NotRegistered + } + internal static class RegistrationStateEnumExtension + { + internal static string ToSerializedValue(this RegistrationState? value) + { + return value == null ? null : ((RegistrationState)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this RegistrationState value) + { + switch( value ) + { + case RegistrationState.Registered: + return "Registered"; + case RegistrationState.NotRegistered: + return "NotRegistered"; + } + return null; + } + + internal static RegistrationState? ParseRegistrationState(this string value) + { + switch( value ) + { + case "Registered": + return RegistrationState.Registered; + case "NotRegistered": + return RegistrationState.NotRegistered; + } + return null; + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ReferenceVmCreationParameters.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResetPasswordBody.cs similarity index 64% rename from sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ReferenceVmCreationParameters.cs rename to sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResetPasswordBody.cs index 704dd43d04d6..8d2af9b6924c 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ReferenceVmCreationParameters.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResetPasswordBody.cs @@ -15,28 +15,27 @@ namespace Microsoft.Azure.Management.LabServices.Models using System.Linq; /// - /// Creation parameters for Reference Vm + /// Body of a reset password request. /// - public partial class ReferenceVmCreationParameters + public partial class ResetPasswordBody { /// - /// Initializes a new instance of the ReferenceVmCreationParameters - /// class. + /// Initializes a new instance of the ResetPasswordBody class. /// - public ReferenceVmCreationParameters() + public ResetPasswordBody() { CustomInit(); } /// - /// Initializes a new instance of the ReferenceVmCreationParameters - /// class. + /// Initializes a new instance of the ResetPasswordBody class. /// - /// The username of the virtual machine - /// The password of the virtual machine. - public ReferenceVmCreationParameters(string userName, string password) + /// The user whose password is being + /// reset + /// The password + public ResetPasswordBody(string username, string password) { - UserName = userName; + Username = username; Password = password; CustomInit(); } @@ -47,13 +46,13 @@ public ReferenceVmCreationParameters(string userName, string password) partial void CustomInit(); /// - /// Gets or sets the username of the virtual machine + /// Gets or sets the user whose password is being reset /// - [JsonProperty(PropertyName = "userName")] - public string UserName { get; set; } + [JsonProperty(PropertyName = "username")] + public string Username { get; set; } /// - /// Gets or sets the password of the virtual machine. + /// Gets or sets the password /// [JsonProperty(PropertyName = "password")] public string Password { get; set; } @@ -66,9 +65,9 @@ public ReferenceVmCreationParameters(string userName, string password) /// public virtual void Validate() { - if (UserName == null) + if (Username == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "UserName"); + throw new ValidationException(ValidationRules.CannotBeNull, "Username"); } if (Password == null) { diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Resource.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Resource.cs index 8c09b7bf4a2e..070b84ad8781 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Resource.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Resource.cs @@ -13,13 +13,15 @@ namespace Microsoft.Azure.Management.LabServices.Models using Microsoft.Rest; using Microsoft.Rest.Azure; using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// - /// An Azure resource. + /// Resource /// + /// + /// Common fields that are returned in the response for all Azure Resource + /// Manager resources + /// public partial class Resource : IResource { /// @@ -33,18 +35,17 @@ public Resource() /// /// Initializes a new instance of the Resource class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - public Resource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + public Resource(string id = default(string), string name = default(string), string type = default(string)) { Id = id; Name = name; Type = type; - Location = location; - Tags = tags; CustomInit(); } @@ -54,34 +55,25 @@ public Resource() partial void CustomInit(); /// - /// Gets the identifier of the resource. + /// Gets fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// - /// Gets the name of the resource. + /// Gets the name of the resource /// [JsonProperty(PropertyName = "name")] public string Name { get; private set; } /// - /// Gets the type of the resource. + /// Gets the type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// [JsonProperty(PropertyName = "type")] public string Type { get; private set; } - /// - /// Gets or sets the location of the resource. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets or sets the tags of the resource. - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceIdentityType.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceIdentityType.cs new file mode 100644 index 000000000000..d048cc6da6b4 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceIdentityType.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ResourceIdentityType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ResourceIdentityType + { + [EnumMember(Value = "SystemAssigned")] + SystemAssigned + } + internal static class ResourceIdentityTypeEnumExtension + { + internal static string ToSerializedValue(this ResourceIdentityType? value) + { + return value == null ? null : ((ResourceIdentityType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ResourceIdentityType value) + { + switch( value ) + { + case ResourceIdentityType.SystemAssigned: + return "SystemAssigned"; + } + return null; + } + + internal static ResourceIdentityType? ParseResourceIdentityType(this string value) + { + switch( value ) + { + case "SystemAssigned": + return ResourceIdentityType.SystemAssigned; + } + return null; + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceModelWithAllowedPropertySet.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceModelWithAllowedPropertySet.cs new file mode 100644 index 000000000000..6353f53f0d0c --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceModelWithAllowedPropertySet.cs @@ -0,0 +1,190 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource model definition containing the full set of allowed + /// properties for a resource. Except properties bag, there cannot be a top + /// level property outside of this set. + /// + public partial class ResourceModelWithAllowedPropertySet : IResource + { + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySet class. + /// + public ResourceModelWithAllowedPropertySet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySet class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// The geo-location where the resource + /// lives + /// The fully qualified resource ID of the + /// resource that manages this resource. Indicates if this resource is + /// managed by another Azure resource. If this is present, complete + /// mode deployment will not delete the resource if it is removed from + /// the template since it is managed by another resource. + /// Metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type; e.g. + /// ApiApps are a kind of Microsoft.Web/sites type. If supported, the + /// resource provider must validate and persist this value. + /// The etag field is *not* required. If it is + /// provided in the response body, it must also be provided as a header + /// per the normal etag convention. Entity tags are used for comparing + /// two or more entities from the same requested resource. HTTP/1.1 + /// uses entity tags in the etag (section 14.19), If-Match (section + /// 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) + /// header fields. + /// Resource tags. + public ResourceModelWithAllowedPropertySet(string id = default(string), string name = default(string), string type = default(string), string location = default(string), string managedBy = default(string), string kind = default(string), string etag = default(string), IDictionary tags = default(IDictionary), ResourceModelWithAllowedPropertySetIdentity identity = default(ResourceModelWithAllowedPropertySetIdentity), ResourceModelWithAllowedPropertySetSku sku = default(ResourceModelWithAllowedPropertySetSku), ResourceModelWithAllowedPropertySetPlan plan = default(ResourceModelWithAllowedPropertySetPlan)) + { + Id = id; + Name = name; + Type = type; + Location = location; + ManagedBy = managedBy; + Kind = kind; + Etag = etag; + Tags = tags; + Identity = identity; + Sku = sku; + Plan = plan; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets the geo-location where the resource lives + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets the fully qualified resource ID of the resource that + /// manages this resource. Indicates if this resource is managed by + /// another Azure resource. If this is present, complete mode + /// deployment will not delete the resource if it is removed from the + /// template since it is managed by another resource. + /// + [JsonProperty(PropertyName = "managedBy")] + public string ManagedBy { get; set; } + + /// + /// Gets or sets metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type; e.g. + /// ApiApps are a kind of Microsoft.Web/sites type. If supported, the + /// resource provider must validate and persist this value. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets the etag field is *not* required. If it is provided in the + /// response body, it must also be provided as a header per the normal + /// etag convention. Entity tags are used for comparing two or more + /// entities from the same requested resource. HTTP/1.1 uses entity + /// tags in the etag (section 14.19), If-Match (section 14.24), + /// If-None-Match (section 14.26), and If-Range (section 14.27) header + /// fields. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// + [JsonProperty(PropertyName = "identity")] + public ResourceModelWithAllowedPropertySetIdentity Identity { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public ResourceModelWithAllowedPropertySetSku Sku { get; set; } + + /// + /// + [JsonProperty(PropertyName = "plan")] + public ResourceModelWithAllowedPropertySetPlan Plan { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Kind != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Kind, "^[-\\w\\._,\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "Kind", "^[-\\w\\._,\\(\\)]+$"); + } + } + if (Sku != null) + { + Sku.Validate(); + } + if (Plan != null) + { + Plan.Validate(); + } + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs new file mode 100644 index 000000000000..45c8c5227789 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs @@ -0,0 +1,47 @@ +// +// 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.Models +{ + using System.Linq; + + public partial class ResourceModelWithAllowedPropertySetIdentity : Identity + { + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetIdentity class. + /// + public ResourceModelWithAllowedPropertySetIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetIdentity class. + /// + /// The principal ID of resource + /// identity. + /// The tenant ID of resource. + /// The identity type. Possible values include: + /// 'SystemAssigned' + public ResourceModelWithAllowedPropertySetIdentity(string principalId = default(string), string tenantId = default(string), ResourceIdentityType? type = default(ResourceIdentityType?)) + : base(principalId, tenantId, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceModelWithAllowedPropertySetPlan.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceModelWithAllowedPropertySetPlan.cs new file mode 100644 index 000000000000..4b5b5689699f --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceModelWithAllowedPropertySetPlan.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using System.Linq; + + public partial class ResourceModelWithAllowedPropertySetPlan : Plan + { + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetPlan class. + /// + public ResourceModelWithAllowedPropertySetPlan() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetPlan class. + /// + /// A user defined name of the 3rd Party Artifact + /// that is being procured. + /// The publisher of the 3rd Party Artifact + /// that is being bought. E.g. NewRelic + /// The 3rd Party artifact that is being + /// procured. E.g. NewRelic. Product maps to the OfferID specified for + /// the artifact at the time of Data Market onboarding. + /// A publisher provided promotion code as + /// provisioned in Data Market for the said product/artifact. + /// The version of the desired + /// product/artifact. + public ResourceModelWithAllowedPropertySetPlan(string name, string publisher, string product, string promotionCode = default(string), string version = default(string)) + : base(name, publisher, product, promotionCode, version) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceModelWithAllowedPropertySetSku.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceModelWithAllowedPropertySetSku.cs new file mode 100644 index 000000000000..8c8ad9f95cb3 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceModelWithAllowedPropertySetSku.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using System.Linq; + + public partial class ResourceModelWithAllowedPropertySetSku : Sku + { + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetSku class. + /// + public ResourceModelWithAllowedPropertySetSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetSku class. + /// + /// The name of the SKU. Ex - P3. It is typically a + /// letter+number code + /// This field is required to be implemented by the + /// Resource Provider if the service has more than one tier, but is not + /// required on a PUT. Possible values include: 'Free', 'Basic', + /// 'Standard', 'Premium' + /// The SKU size. When the name field is the + /// combination of tier and some other value, this would be the + /// standalone code. + /// If the service has different generations of + /// hardware, for the same SKU, then that can be captured here. + /// If the SKU supports scale out/in then the + /// capacity integer should be included. If scale out/in is not + /// possible for the resource this may be omitted. + public ResourceModelWithAllowedPropertySetSku(string name, SkuTier? tier = default(SkuTier?), string size = default(string), string family = default(string), int? capacity = default(int?)) + : base(name, tier, size, family, capacity) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceSet.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceSet.cs deleted file mode 100644 index 29d329eb4a18..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceSet.cs +++ /dev/null @@ -1,61 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a VM and the setting Id it was created for. - /// - public partial class ResourceSet - { - /// - /// Initializes a new instance of the ResourceSet class. - /// - public ResourceSet() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ResourceSet class. - /// - /// VM resource Id for the - /// environment - /// resourceSettingId for the - /// environment - public ResourceSet(string vmResourceId = default(string), string resourceSettingId = default(string)) - { - VmResourceId = vmResourceId; - ResourceSettingId = resourceSettingId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets VM resource Id for the environment - /// - [JsonProperty(PropertyName = "vmResourceId")] - public string VmResourceId { get; set; } - - /// - /// Gets or sets resourceSettingId for the environment - /// - [JsonProperty(PropertyName = "resourceSettingId")] - public string ResourceSettingId { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceSetFragment.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceSetFragment.cs deleted file mode 100644 index ee9653ff60ac..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceSetFragment.cs +++ /dev/null @@ -1,61 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a VM and the setting Id it was created for. - /// - public partial class ResourceSetFragment - { - /// - /// Initializes a new instance of the ResourceSetFragment class. - /// - public ResourceSetFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ResourceSetFragment class. - /// - /// VM resource Id for the - /// environment - /// resourceSettingId for the - /// environment - public ResourceSetFragment(string vmResourceId = default(string), string resourceSettingId = default(string)) - { - VmResourceId = vmResourceId; - ResourceSettingId = resourceSettingId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets VM resource Id for the environment - /// - [JsonProperty(PropertyName = "vmResourceId")] - public string VmResourceId { get; set; } - - /// - /// Gets or sets resourceSettingId for the environment - /// - [JsonProperty(PropertyName = "resourceSettingId")] - public string ResourceSettingId { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceSettingCreationParameters.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceSettingCreationParameters.cs deleted file mode 100644 index d634923bf613..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceSettingCreationParameters.cs +++ /dev/null @@ -1,113 +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.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents resource specific settings - /// - public partial class ResourceSettingCreationParameters - { - /// - /// Initializes a new instance of the ResourceSettingCreationParameters - /// class. - /// - public ResourceSettingCreationParameters() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ResourceSettingCreationParameters - /// class. - /// - /// The resource id of the gallery - /// image used for creating the virtual machine - /// Creation parameters for - /// Reference Vm - /// The location where the virtual machine will - /// live - /// The name of the resource setting - /// The size of the virtual machine. Possible values - /// include: 'Basic', 'Standard', 'Performance' - public ResourceSettingCreationParameters(string galleryImageResourceId, ReferenceVmCreationParameters referenceVmCreationParameters, string location = default(string), string name = default(string), string size = default(string)) - { - Location = location; - Name = name; - GalleryImageResourceId = galleryImageResourceId; - Size = size; - ReferenceVmCreationParameters = referenceVmCreationParameters; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the location where the virtual machine will live - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets or sets the name of the resource setting - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the resource id of the gallery image used for creating - /// the virtual machine - /// - [JsonProperty(PropertyName = "galleryImageResourceId")] - public string GalleryImageResourceId { get; set; } - - /// - /// Gets or sets the size of the virtual machine. Possible values - /// include: 'Basic', 'Standard', 'Performance' - /// - [JsonProperty(PropertyName = "size")] - public string Size { get; set; } - - /// - /// Gets or sets creation parameters for Reference Vm - /// - [JsonProperty(PropertyName = "referenceVmCreationParameters")] - public ReferenceVmCreationParameters ReferenceVmCreationParameters { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (GalleryImageResourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "GalleryImageResourceId"); - } - if (ReferenceVmCreationParameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ReferenceVmCreationParameters"); - } - if (ReferenceVmCreationParameters != null) - { - ReferenceVmCreationParameters.Validate(); - } - } - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceSettings.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceSettings.cs deleted file mode 100644 index ad394d60d069..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceSettings.cs +++ /dev/null @@ -1,115 +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.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents resource specific settings - /// - public partial class ResourceSettings - { - /// - /// Initializes a new instance of the ResourceSettings class. - /// - public ResourceSettings() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ResourceSettings class. - /// - /// Details specific to Reference Vm - /// The unique id of the resource setting - /// The resource id of the gallery - /// image used for creating the virtual machine - /// The name of the image used to created the - /// environment setting - /// The size of the virtual machine. Possible values - /// include: 'Basic', 'Standard', 'Performance' - /// The translated compute cores of the virtual - /// machine - public ResourceSettings(ReferenceVm referenceVm, string id = default(string), string galleryImageResourceId = default(string), string imageName = default(string), string size = default(string), int? cores = default(int?)) - { - Id = id; - GalleryImageResourceId = galleryImageResourceId; - ImageName = imageName; - Size = size; - Cores = cores; - ReferenceVm = referenceVm; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the unique id of the resource setting - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets or sets the resource id of the gallery image used for creating - /// the virtual machine - /// - [JsonProperty(PropertyName = "galleryImageResourceId")] - public string GalleryImageResourceId { get; set; } - - /// - /// Gets the name of the image used to created the environment setting - /// - [JsonProperty(PropertyName = "imageName")] - public string ImageName { get; private set; } - - /// - /// Gets or sets the size of the virtual machine. Possible values - /// include: 'Basic', 'Standard', 'Performance' - /// - [JsonProperty(PropertyName = "size")] - public string Size { get; set; } - - /// - /// Gets the translated compute cores of the virtual machine - /// - [JsonProperty(PropertyName = "cores")] - public int? Cores { get; private set; } - - /// - /// Gets or sets details specific to Reference Vm - /// - [JsonProperty(PropertyName = "referenceVm")] - public ReferenceVm ReferenceVm { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ReferenceVm == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ReferenceVm"); - } - if (ReferenceVm != null) - { - ReferenceVm.Validate(); - } - } - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceSettingsFragment.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceSettingsFragment.cs deleted file mode 100644 index 3729af59794c..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ResourceSettingsFragment.cs +++ /dev/null @@ -1,71 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents resource specific settings - /// - public partial class ResourceSettingsFragment - { - /// - /// Initializes a new instance of the ResourceSettingsFragment class. - /// - public ResourceSettingsFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ResourceSettingsFragment class. - /// - /// The resource id of the gallery - /// image used for creating the virtual machine - /// The size of the virtual machine. Possible values - /// include: 'Basic', 'Standard', 'Performance' - /// Details specific to Reference Vm - public ResourceSettingsFragment(string galleryImageResourceId = default(string), string size = default(string), ReferenceVmFragment referenceVm = default(ReferenceVmFragment)) - { - GalleryImageResourceId = galleryImageResourceId; - Size = size; - ReferenceVm = referenceVm; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the resource id of the gallery image used for creating - /// the virtual machine - /// - [JsonProperty(PropertyName = "galleryImageResourceId")] - public string GalleryImageResourceId { get; set; } - - /// - /// Gets or sets the size of the virtual machine. Possible values - /// include: 'Basic', 'Standard', 'Performance' - /// - [JsonProperty(PropertyName = "size")] - public string Size { get; set; } - - /// - /// Gets or sets details specific to Reference Vm - /// - [JsonProperty(PropertyName = "referenceVm")] - public ReferenceVmFragment ReferenceVm { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RosterProfile.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RosterProfile.cs new file mode 100644 index 000000000000..9589708e5aaf --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RosterProfile.cs @@ -0,0 +1,93 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The lab user list management profile. + /// + public partial class RosterProfile + { + /// + /// Initializes a new instance of the RosterProfile class. + /// + public RosterProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RosterProfile class. + /// + /// The AAD group ID which this + /// lab roster is populated from. Having this set enables AAD sync + /// mode. + /// The unique context identifier for the + /// lab in the lms. + /// The base URI identifying the lms + /// instance. + /// The unique id of the azure lab services + /// tool in the lms. + /// The uri of the names and roles + /// service endpoint on the lms for the class attached to this + /// lab. + public RosterProfile(string activeDirectoryGroupId = default(string), string ltiContextId = default(string), string lmsInstance = default(string), string ltiClientId = default(string), string ltiRosterEndpoint = default(string)) + { + ActiveDirectoryGroupId = activeDirectoryGroupId; + LtiContextId = ltiContextId; + LmsInstance = lmsInstance; + LtiClientId = ltiClientId; + LtiRosterEndpoint = ltiRosterEndpoint; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the AAD group ID which this lab roster is populated + /// from. Having this set enables AAD sync mode. + /// + [JsonProperty(PropertyName = "activeDirectoryGroupId")] + public string ActiveDirectoryGroupId { get; set; } + + /// + /// Gets or sets the unique context identifier for the lab in the lms. + /// + [JsonProperty(PropertyName = "ltiContextId")] + public string LtiContextId { get; set; } + + /// + /// Gets or sets the base URI identifying the lms instance. + /// + [JsonProperty(PropertyName = "lmsInstance")] + public string LmsInstance { get; set; } + + /// + /// Gets or sets the unique id of the azure lab services tool in the + /// lms. + /// + [JsonProperty(PropertyName = "ltiClientId")] + public string LtiClientId { get; set; } + + /// + /// Gets or sets the uri of the names and roles service endpoint on the + /// lms for the class attached to this lab. + /// + [JsonProperty(PropertyName = "ltiRosterEndpoint")] + public string LtiRosterEndpoint { get; set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationMetadata.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SaveImageBody.cs similarity index 54% rename from sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationMetadata.cs rename to sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SaveImageBody.cs index 6bf9c00e2c65..4044269188c1 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/OperationMetadata.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SaveImageBody.cs @@ -14,29 +14,28 @@ namespace Microsoft.Azure.Management.LabServices.Models using System.Linq; /// - /// The REST API operation supported by ManagedLab ResourceProvider. + /// Body for the save image POST /// - public partial class OperationMetadata + public partial class SaveImageBody { /// - /// Initializes a new instance of the OperationMetadata class. + /// Initializes a new instance of the SaveImageBody class. /// - public OperationMetadata() + public SaveImageBody() { CustomInit(); } /// - /// Initializes a new instance of the OperationMetadata class. + /// Initializes a new instance of the SaveImageBody class. /// - /// Operation name: - /// {provider}/{resource}/{operation} - /// The object that describes the - /// operations - public OperationMetadata(string name = default(string), OperationMetadataDisplay display = default(OperationMetadataDisplay)) + /// The name for the image we create. + /// The ID of the lab virtual machine + /// you want to save an image from. + public SaveImageBody(string name = default(string), string labVirtualMachineId = default(string)) { Name = name; - Display = display; + LabVirtualMachineId = labVirtualMachineId; CustomInit(); } @@ -46,16 +45,17 @@ public OperationMetadata() partial void CustomInit(); /// - /// Gets or sets operation name: {provider}/{resource}/{operation} + /// Gets or sets the name for the image we create. /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// - /// Gets or sets the object that describes the operations + /// Gets or sets the ID of the lab virtual machine you want to save an + /// image from. /// - [JsonProperty(PropertyName = "display")] - public OperationMetadataDisplay Display { get; set; } + [JsonProperty(PropertyName = "labVirtualMachineId")] + public string LabVirtualMachineId { get; set; } } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Schedule.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Schedule.cs new file mode 100644 index 000000000000..59d0008e32a0 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Schedule.cs @@ -0,0 +1,151 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Schedule for automatically turning virtual machines in a lab on and off + /// at specified times. + /// + [Rest.Serialization.JsonTransformation] + public partial class Schedule : ProxyResource + { + /// + /// Initializes a new instance of the Schedule class. + /// + public Schedule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Schedule class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Metadata pertaining to creation and last + /// modification of the schedule. + /// When lab user virtual machines will be + /// started. Timestamp offsets will be ignored and timeZoneId is used + /// instead. + /// When lab user virtual machines will be + /// stopped. Timestamp offsets will be ignored and timeZoneId is used + /// instead. + /// The recurrence pattern of the + /// scheduled actions. + /// The IANA timezone id for the + /// schedule. + /// Notes for this schedule. + /// Current provisioning state of the + /// schedule. Possible values include: 'Creating', 'Updating', + /// 'Deleting', 'Succeeded', 'Failed', 'Locked' + public Schedule(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), System.DateTime? startAt = default(System.DateTime?), System.DateTime? stopAt = default(System.DateTime?), RecurrencePattern recurrencePattern = default(RecurrencePattern), string timeZoneId = default(string), string notes = default(string), ProvisioningState? provisioningState = default(ProvisioningState?)) + : base(id, name, type) + { + SystemData = systemData; + StartAt = startAt; + StopAt = stopAt; + RecurrencePattern = recurrencePattern; + TimeZoneId = timeZoneId; + Notes = notes; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets metadata pertaining to creation and last modification of the + /// schedule. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Gets or sets when lab user virtual machines will be started. + /// Timestamp offsets will be ignored and timeZoneId is used instead. + /// + [JsonProperty(PropertyName = "properties.startAt")] + public System.DateTime? StartAt { get; set; } + + /// + /// Gets or sets when lab user virtual machines will be stopped. + /// Timestamp offsets will be ignored and timeZoneId is used instead. + /// + [JsonProperty(PropertyName = "properties.stopAt")] + public System.DateTime? StopAt { get; set; } + + /// + /// Gets or sets the recurrence pattern of the scheduled actions. + /// + [JsonProperty(PropertyName = "properties.recurrencePattern")] + public RecurrencePattern RecurrencePattern { get; set; } + + /// + /// Gets or sets the IANA timezone id for the schedule. + /// + [JsonProperty(PropertyName = "properties.timeZoneId")] + public string TimeZoneId { get; set; } + + /// + /// Gets or sets notes for this schedule. + /// + [JsonProperty(PropertyName = "properties.notes")] + public string Notes { get; set; } + + /// + /// Gets current provisioning state of the schedule. Possible values + /// include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', + /// 'Locked' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public ProvisioningState? ProvisioningState { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RecurrencePattern != null) + { + RecurrencePattern.Validate(); + } + if (TimeZoneId != null) + { + if (TimeZoneId.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "TimeZoneId", 50); + } + } + if (Notes != null) + { + if (Notes.Length > 1000) + { + throw new ValidationException(ValidationRules.MaxLength, "Notes", 1000); + } + } + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ScheduleUpdate.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ScheduleUpdate.cs new file mode 100644 index 000000000000..4b0a1c499d00 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ScheduleUpdate.cs @@ -0,0 +1,122 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Schedule for automatically turning virtual machines in a lab on and off + /// at specified times. Used for updates. + /// + [Rest.Serialization.JsonTransformation] + public partial class ScheduleUpdate + { + /// + /// Initializes a new instance of the ScheduleUpdate class. + /// + public ScheduleUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScheduleUpdate class. + /// + /// When lab user virtual machines will be + /// started. Timestamp offsets will be ignored and timeZoneId is used + /// instead. + /// When lab user virtual machines will be + /// stopped. Timestamp offsets will be ignored and timeZoneId is used + /// instead. + /// The recurrence pattern of the + /// scheduled actions. + /// The IANA timezone id for the + /// schedule. + /// Notes for this schedule. + public ScheduleUpdate(System.DateTime? startAt = default(System.DateTime?), System.DateTime? stopAt = default(System.DateTime?), RecurrencePattern recurrencePattern = default(RecurrencePattern), string timeZoneId = default(string), string notes = default(string)) + { + StartAt = startAt; + StopAt = stopAt; + RecurrencePattern = recurrencePattern; + TimeZoneId = timeZoneId; + Notes = notes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets when lab user virtual machines will be started. + /// Timestamp offsets will be ignored and timeZoneId is used instead. + /// + [JsonProperty(PropertyName = "properties.startAt")] + public System.DateTime? StartAt { get; set; } + + /// + /// Gets or sets when lab user virtual machines will be stopped. + /// Timestamp offsets will be ignored and timeZoneId is used instead. + /// + [JsonProperty(PropertyName = "properties.stopAt")] + public System.DateTime? StopAt { get; set; } + + /// + /// Gets or sets the recurrence pattern of the scheduled actions. + /// + [JsonProperty(PropertyName = "properties.recurrencePattern")] + public RecurrencePattern RecurrencePattern { get; set; } + + /// + /// Gets or sets the IANA timezone id for the schedule. + /// + [JsonProperty(PropertyName = "properties.timeZoneId")] + public string TimeZoneId { get; set; } + + /// + /// Gets or sets notes for this schedule. + /// + [JsonProperty(PropertyName = "properties.notes")] + public string Notes { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RecurrencePattern != null) + { + RecurrencePattern.Validate(); + } + if (TimeZoneId != null) + { + if (TimeZoneId.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "TimeZoneId", 50); + } + } + if (Notes != null) + { + if (Notes.Length > 1000) + { + throw new ValidationException(ValidationRules.MaxLength, "Notes", 1000); + } + } + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SecurityProfile.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SecurityProfile.cs new file mode 100644 index 000000000000..45ce31346c3a --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SecurityProfile.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The lab security profile. + /// + public partial class SecurityProfile + { + /// + /// Initializes a new instance of the SecurityProfile class. + /// + public SecurityProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecurityProfile class. + /// + /// The registration code for the + /// lab. + /// Whether any user or only specified users + /// can register to a lab. Possible values include: 'Enabled', + /// 'Disabled' + public SecurityProfile(string registrationCode = default(string), EnableState? openAccess = default(EnableState?)) + { + RegistrationCode = registrationCode; + OpenAccess = openAccess; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the registration code for the lab. + /// + [JsonProperty(PropertyName = "registrationCode")] + public string RegistrationCode { get; private set; } + + /// + /// Gets or sets whether any user or only specified users can register + /// to a lab. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "openAccess")] + public EnableState? OpenAccess { get; set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ShutdownOnIdleMode.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ShutdownOnIdleMode.cs new file mode 100644 index 000000000000..70bc22848ae2 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ShutdownOnIdleMode.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ShutdownOnIdleMode. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ShutdownOnIdleMode + { + /// + /// The VM won't be shut down when it is idle. + /// + [EnumMember(Value = "None")] + None, + /// + /// The VM will be considered as idle when there is no keyboard or + /// mouse input. + /// + [EnumMember(Value = "UserAbsence")] + UserAbsence, + /// + /// The VM will be considered as idle when user is absent and the + /// resource (CPU and disk) consumption is low. + /// + [EnumMember(Value = "LowUsage")] + LowUsage + } + internal static class ShutdownOnIdleModeEnumExtension + { + internal static string ToSerializedValue(this ShutdownOnIdleMode? value) + { + return value == null ? null : ((ShutdownOnIdleMode)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ShutdownOnIdleMode value) + { + switch( value ) + { + case ShutdownOnIdleMode.None: + return "None"; + case ShutdownOnIdleMode.UserAbsence: + return "UserAbsence"; + case ShutdownOnIdleMode.LowUsage: + return "LowUsage"; + } + return null; + } + + internal static ShutdownOnIdleMode? ParseShutdownOnIdleMode(this string value) + { + switch( value ) + { + case "None": + return ShutdownOnIdleMode.None; + case "UserAbsence": + return ShutdownOnIdleMode.UserAbsence; + case "LowUsage": + return ShutdownOnIdleMode.LowUsage; + } + return null; + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SizeAvailability.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SizeAvailability.cs deleted file mode 100644 index a307410f44f1..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SizeAvailability.cs +++ /dev/null @@ -1,64 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents the size information - /// - public partial class SizeAvailability - { - /// - /// Initializes a new instance of the SizeAvailability class. - /// - public SizeAvailability() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SizeAvailability class. - /// - /// The category of the size (Basic, - /// Standard, Performance). Possible values include: 'Basic', - /// 'Standard', 'Performance' - /// Whether or not this size category is - /// available - public SizeAvailability(string sizeCategory = default(string), bool? isAvailable = default(bool?)) - { - SizeCategory = sizeCategory; - IsAvailable = isAvailable; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the category of the size (Basic, Standard, - /// Performance). Possible values include: 'Basic', 'Standard', - /// 'Performance' - /// - [JsonProperty(PropertyName = "sizeCategory")] - public string SizeCategory { get; set; } - - /// - /// Gets or sets whether or not this size category is available - /// - [JsonProperty(PropertyName = "isAvailable")] - public bool? IsAvailable { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SizeConfigurationProperties.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SizeConfigurationProperties.cs deleted file mode 100644 index 956c74745ca4..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SizeConfigurationProperties.cs +++ /dev/null @@ -1,57 +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.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents the size configuration under the lab account - /// - public partial class SizeConfigurationProperties - { - /// - /// Initializes a new instance of the SizeConfigurationProperties - /// class. - /// - public SizeConfigurationProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SizeConfigurationProperties - /// class. - /// - /// Represents a list of size categories - /// supported by this Lab Account (Small, Medium, Large) - public SizeConfigurationProperties(IList environmentSizes = default(IList)) - { - EnvironmentSizes = environmentSizes; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets represents a list of size categories supported by this - /// Lab Account (Small, Medium, Large) - /// - [JsonProperty(PropertyName = "environmentSizes")] - public IList EnvironmentSizes { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SizeInfo.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SizeInfo.cs deleted file mode 100644 index b7d7021f4c34..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SizeInfo.cs +++ /dev/null @@ -1,83 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Contains detailed information about a size - /// - public partial class SizeInfo - { - /// - /// Initializes a new instance of the SizeInfo class. - /// - public SizeInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SizeInfo class. - /// - /// Represents the actual compute size, e.g. - /// Standard_A2_v2. - /// The pay-as-you-go price per hour this size will - /// cost. It does not include discounts and may not reflect the actual - /// price the size will cost. - /// The number of cores a VM of this size - /// has. - /// The amount of memory available (in - /// GB). - public SizeInfo(string computeSize = default(string), decimal? price = default(decimal?), int? numberOfCores = default(int?), double? memory = default(double?)) - { - ComputeSize = computeSize; - Price = price; - NumberOfCores = numberOfCores; - Memory = memory; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets represents the actual compute size, e.g. - /// Standard_A2_v2. - /// - [JsonProperty(PropertyName = "computeSize")] - public string ComputeSize { get; set; } - - /// - /// Gets or sets the pay-as-you-go price per hour this size will cost. - /// It does not include discounts and may not reflect the actual price - /// the size will cost. - /// - [JsonProperty(PropertyName = "price")] - public decimal? Price { get; set; } - - /// - /// Gets or sets the number of cores a VM of this size has. - /// - [JsonProperty(PropertyName = "numberOfCores")] - public int? NumberOfCores { get; set; } - - /// - /// Gets or sets the amount of memory available (in GB). - /// - [JsonProperty(PropertyName = "memory")] - public double? Memory { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SizeInfoFragment.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SizeInfoFragment.cs deleted file mode 100644 index 052f958a81fa..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SizeInfoFragment.cs +++ /dev/null @@ -1,83 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Contains detailed information about a size - /// - public partial class SizeInfoFragment - { - /// - /// Initializes a new instance of the SizeInfoFragment class. - /// - public SizeInfoFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SizeInfoFragment class. - /// - /// Represents the actual compute size, e.g. - /// Standard_A2_v2. - /// The pay-as-you-go price per hour this size will - /// cost. It does not include discounts and may not reflect the actual - /// price the size will cost. - /// The number of cores a VM of this size - /// has. - /// The amount of memory available (in - /// GB). - public SizeInfoFragment(string computeSize = default(string), decimal? price = default(decimal?), int? numberOfCores = default(int?), double? memory = default(double?)) - { - ComputeSize = computeSize; - Price = price; - NumberOfCores = numberOfCores; - Memory = memory; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets represents the actual compute size, e.g. - /// Standard_A2_v2. - /// - [JsonProperty(PropertyName = "computeSize")] - public string ComputeSize { get; set; } - - /// - /// Gets or sets the pay-as-you-go price per hour this size will cost. - /// It does not include discounts and may not reflect the actual price - /// the size will cost. - /// - [JsonProperty(PropertyName = "price")] - public decimal? Price { get; set; } - - /// - /// Gets or sets the number of cores a VM of this size has. - /// - [JsonProperty(PropertyName = "numberOfCores")] - public int? NumberOfCores { get; set; } - - /// - /// Gets or sets the amount of memory available (in GB). - /// - [JsonProperty(PropertyName = "memory")] - public double? Memory { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Sku.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Sku.cs new file mode 100644 index 000000000000..ef508e762566 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Sku.cs @@ -0,0 +1,114 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource model definition representing SKU + /// + public partial class Sku + { + /// + /// Initializes a new instance of the Sku class. + /// + public Sku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Sku class. + /// + /// The name of the SKU. Ex - P3. It is typically a + /// letter+number code + /// This field is required to be implemented by the + /// Resource Provider if the service has more than one tier, but is not + /// required on a PUT. Possible values include: 'Free', 'Basic', + /// 'Standard', 'Premium' + /// The SKU size. When the name field is the + /// combination of tier and some other value, this would be the + /// standalone code. + /// If the service has different generations of + /// hardware, for the same SKU, then that can be captured here. + /// If the SKU supports scale out/in then the + /// capacity integer should be included. If scale out/in is not + /// possible for the resource this may be omitted. + public Sku(string name, SkuTier? tier = default(SkuTier?), string size = default(string), string family = default(string), int? capacity = default(int?)) + { + Name = name; + Tier = tier; + Size = size; + Family = family; + Capacity = capacity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the SKU. Ex - P3. It is typically a + /// letter+number code + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets this field is required to be implemented by the + /// Resource Provider if the service has more than one tier, but is not + /// required on a PUT. Possible values include: 'Free', 'Basic', + /// 'Standard', 'Premium' + /// + [JsonProperty(PropertyName = "tier")] + public SkuTier? Tier { get; set; } + + /// + /// Gets or sets the SKU size. When the name field is the combination + /// of tier and some other value, this would be the standalone code. + /// + [JsonProperty(PropertyName = "size")] + public string Size { get; set; } + + /// + /// Gets or sets if the service has different generations of hardware, + /// for the same SKU, then that can be captured here. + /// + [JsonProperty(PropertyName = "family")] + public string Family { get; set; } + + /// + /// Gets or sets if the SKU supports scale out/in then the capacity + /// integer should be included. If scale out/in is not possible for the + /// resource this may be omitted. + /// + [JsonProperty(PropertyName = "capacity")] + public int? Capacity { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SkuTier.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SkuTier.cs new file mode 100644 index 000000000000..b0ea55fb39a7 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SkuTier.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for SkuTier. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SkuTier + { + [EnumMember(Value = "Free")] + Free, + [EnumMember(Value = "Basic")] + Basic, + [EnumMember(Value = "Standard")] + Standard, + [EnumMember(Value = "Premium")] + Premium + } + internal static class SkuTierEnumExtension + { + internal static string ToSerializedValue(this SkuTier? value) + { + return value == null ? null : ((SkuTier)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this SkuTier value) + { + switch( value ) + { + case SkuTier.Free: + return "Free"; + case SkuTier.Basic: + return "Basic"; + case SkuTier.Standard: + return "Standard"; + case SkuTier.Premium: + return "Premium"; + } + return null; + } + + internal static SkuTier? ParseSkuTier(this string value) + { + switch( value ) + { + case "Free": + return SkuTier.Free; + case "Basic": + return SkuTier.Basic; + case "Standard": + return SkuTier.Standard; + case "Premium": + return SkuTier.Premium; + } + return null; + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SupportInfo.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SupportInfo.cs new file mode 100644 index 000000000000..c90a4aee1346 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SupportInfo.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Support contact information and instructions. + /// + public partial class SupportInfo + { + /// + /// Initializes a new instance of the SupportInfo class. + /// + public SupportInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SupportInfo class. + /// + /// Support web address. + /// Support contact email address. + /// Support contact phone number. + /// Support instructions. + public SupportInfo(string url = default(string), string email = default(string), string phone = default(string), string instructions = default(string)) + { + Url = url; + Email = email; + Phone = phone; + Instructions = instructions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets support web address. + /// + [JsonProperty(PropertyName = "url")] + public string Url { get; set; } + + /// + /// Gets or sets support contact email address. + /// + [JsonProperty(PropertyName = "email")] + public string Email { get; set; } + + /// + /// Gets or sets support contact phone number. + /// + [JsonProperty(PropertyName = "phone")] + public string Phone { get; set; } + + /// + /// Gets or sets support instructions. + /// + [JsonProperty(PropertyName = "instructions")] + public string Instructions { get; set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SystemData.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SystemData.cs new file mode 100644 index 000000000000..938c9ab922c3 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SystemData.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata pertaining to creation and last modification of the resource. + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// The identity that created the + /// resource. + /// The type of identity that created the + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// The timestamp of resource creation + /// (UTC). + /// The identity that last modified the + /// resource. + /// The type of identity that last + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The timestamp of resource last + /// modification (UTC) + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity that created the resource. + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource creation (UTC). + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTime? CreatedAt { get; set; } + + /// + /// Gets or sets the identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource last modification (UTC) + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTime? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/TrackedResource.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/TrackedResource.cs new file mode 100644 index 000000000000..eb9c52d4133e --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/TrackedResource.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Tracked Resource + /// + /// + /// The resource model definition for an Azure Resource Manager tracked top + /// level resource which has 'tags' and a 'location' + /// + public partial class TrackedResource : Resource + { + /// + /// Initializes a new instance of the TrackedResource class. + /// + public TrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TrackedResource class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Resource tags. + public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + : base(id, name, type) + { + Tags = tags; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the geo-location where the resource lives + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ListLabsResponse.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/TrackedResourceUpdate.cs similarity index 62% rename from sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ListLabsResponse.cs rename to sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/TrackedResourceUpdate.cs index 859e802a6ba0..837be4579831 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ListLabsResponse.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/TrackedResourceUpdate.cs @@ -16,25 +16,25 @@ namespace Microsoft.Azure.Management.LabServices.Models using System.Linq; /// - /// Lists the labs owned by a user + /// Base tracked resource type for all PATCH updates. /// - public partial class ListLabsResponse + public partial class TrackedResourceUpdate { /// - /// Initializes a new instance of the ListLabsResponse class. + /// Initializes a new instance of the TrackedResourceUpdate class. /// - public ListLabsResponse() + public TrackedResourceUpdate() { CustomInit(); } /// - /// Initializes a new instance of the ListLabsResponse class. + /// Initializes a new instance of the TrackedResourceUpdate class. /// - /// List of all the labs - public ListLabsResponse(IList labs = default(IList)) + /// Resource tags. + public TrackedResourceUpdate(IList tags = default(IList)) { - Labs = labs; + Tags = tags; CustomInit(); } @@ -44,10 +44,10 @@ public ListLabsResponse() partial void CustomInit(); /// - /// Gets or sets list of all the labs + /// Gets or sets resource tags. /// - [JsonProperty(PropertyName = "labs")] - public IList Labs { get; set; } + [JsonProperty(PropertyName = "tags")] + public IList Tags { get; set; } } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/User.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/User.cs index cc58c4a26363..6f91ab29f160 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/User.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/User.cs @@ -13,15 +13,14 @@ namespace Microsoft.Azure.Management.LabServices.Models using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// - /// The User registered to a lab + /// User of a lab that can register for and use virtual machines within the + /// lab. /// [Rest.Serialization.JsonTransformation] - public partial class User : Resource + public partial class User : ProxyResource { /// /// Initializes a new instance of the User class. @@ -34,38 +33,44 @@ public User() /// /// Initializes a new instance of the User class. /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The user email address, as it was specified - /// during registration. - /// The user family name, as it was specified - /// during registration. - /// The user given name, as it was specified - /// during registration. - /// The user tenant ID, as it was specified - /// during registration. - /// How long the user has used his VMs in this - /// lab - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - /// The details of the latest - /// operation. ex: status, error - public User(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string email = default(string), string familyName = default(string), string givenName = default(string), string tenantId = default(string), System.TimeSpan? totalUsage = default(System.TimeSpan?), string provisioningState = default(string), string uniqueIdentifier = default(string), LatestOperationResult latestOperationResult = default(LatestOperationResult)) - : base(id, name, type, location, tags) + /// Email address of the user. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Metadata pertaining to creation and last + /// modification of the user resource. + /// The amount of usage quota time + /// the user gets in addition to the lab usage quota. + /// Current provisioning state of the + /// user resource. Possible values include: 'Creating', 'Updating', + /// 'Deleting', 'Succeeded', 'Failed', 'Locked' + /// Display name of the user, for example + /// user's full name. + /// State of the user's registration + /// within the lab. Possible values include: 'Registered', + /// 'NotRegistered' + /// State of the invitation message for + /// the user. Possible values include: 'NotSent', 'Sending', 'Sent', + /// 'Failed' + /// Date and time when the invitation + /// message was sent to the user. + /// How long the user has used their virtual + /// machines in this lab. + public User(string email, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), System.TimeSpan? additionalUsageQuota = default(System.TimeSpan?), ProvisioningState? provisioningState = default(ProvisioningState?), string displayName = default(string), RegistrationState? registrationState = default(RegistrationState?), InvitationState? invitationState = default(InvitationState?), System.DateTime? invitationSent = default(System.DateTime?), System.TimeSpan? totalUsage = default(System.TimeSpan?)) + : base(id, name, type) { + SystemData = systemData; + AdditionalUsageQuota = additionalUsageQuota; + ProvisioningState = provisioningState; + DisplayName = displayName; Email = email; - FamilyName = familyName; - GivenName = givenName; - TenantId = tenantId; + RegistrationState = registrationState; + InvitationState = invitationState; + InvitationSent = invitationSent; TotalUsage = totalUsage; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - LatestOperationResult = latestOperationResult; CustomInit(); } @@ -75,53 +80,78 @@ public User() partial void CustomInit(); /// - /// Gets the user email address, as it was specified during - /// registration. + /// Gets metadata pertaining to creation and last modification of the + /// user resource. /// - [JsonProperty(PropertyName = "properties.email")] - public string Email { get; private set; } + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } /// - /// Gets the user family name, as it was specified during registration. + /// Gets or sets the amount of usage quota time the user gets in + /// addition to the lab usage quota. /// - [JsonProperty(PropertyName = "properties.familyName")] - public string FamilyName { get; private set; } + [JsonProperty(PropertyName = "properties.additionalUsageQuota")] + public System.TimeSpan? AdditionalUsageQuota { get; set; } /// - /// Gets the user given name, as it was specified during registration. + /// Gets current provisioning state of the user resource. Possible + /// values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + /// 'Failed', 'Locked' /// - [JsonProperty(PropertyName = "properties.givenName")] - public string GivenName { get; private set; } + [JsonProperty(PropertyName = "properties.provisioningState")] + public ProvisioningState? ProvisioningState { get; private set; } /// - /// Gets the user tenant ID, as it was specified during registration. + /// Gets display name of the user, for example user's full name. /// - [JsonProperty(PropertyName = "properties.tenantId")] - public string TenantId { get; private set; } + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; private set; } /// - /// Gets how long the user has used his VMs in this lab + /// Gets or sets email address of the user. /// - [JsonProperty(PropertyName = "properties.totalUsage")] - public System.TimeSpan? TotalUsage { get; private set; } + [JsonProperty(PropertyName = "properties.email")] + public string Email { get; set; } /// - /// Gets or sets the provisioning status of the resource. + /// Gets state of the user's registration within the lab. Possible + /// values include: 'Registered', 'NotRegistered' /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [JsonProperty(PropertyName = "properties.registrationState")] + public RegistrationState? RegistrationState { get; private set; } /// - /// Gets or sets the unique immutable identifier of a resource (Guid). + /// Gets state of the invitation message for the user. Possible values + /// include: 'NotSent', 'Sending', 'Sent', 'Failed' /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } + [JsonProperty(PropertyName = "properties.invitationState")] + public InvitationState? InvitationState { get; private set; } /// - /// Gets the details of the latest operation. ex: status, error + /// Gets date and time when the invitation message was sent to the + /// user. /// - [JsonProperty(PropertyName = "properties.latestOperationResult")] - public LatestOperationResult LatestOperationResult { get; private set; } + [JsonProperty(PropertyName = "properties.invitationSent")] + public System.DateTime? InvitationSent { get; private set; } + /// + /// Gets how long the user has used their virtual machines in this lab. + /// + [JsonProperty(PropertyName = "properties.totalUsage")] + public System.TimeSpan? TotalUsage { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Email == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Email"); + } + } } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/UserFragment.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/UserFragment.cs deleted file mode 100644 index 45ee8a6c9cb9..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/UserFragment.cs +++ /dev/null @@ -1,72 +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.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The User registered to a lab - /// - [Rest.Serialization.JsonTransformation] - public partial class UserFragment : Resource - { - /// - /// Initializes a new instance of the UserFragment class. - /// - public UserFragment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UserFragment class. - /// - /// The identifier of the resource. - /// The name of the resource. - /// The type of the resource. - /// The location of the resource. - /// The tags of the resource. - /// The provisioning status of the - /// resource. - /// The unique immutable identifier of a - /// resource (Guid). - public UserFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), string uniqueIdentifier = default(string)) - : base(id, name, type, location, tags) - { - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the provisioning status of the resource. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } - - /// - /// Gets or sets the unique immutable identifier of a resource (Guid). - /// - [JsonProperty(PropertyName = "properties.uniqueIdentifier")] - public string UniqueIdentifier { get; set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/UserUpdate.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/UserUpdate.cs new file mode 100644 index 000000000000..360823316b2e --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/UserUpdate.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// User of a lab that can register for and use virtual machines within the + /// lab. Used for updates. + /// + [Rest.Serialization.JsonTransformation] + public partial class UserUpdate + { + /// + /// Initializes a new instance of the UserUpdate class. + /// + public UserUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserUpdate class. + /// + /// The amount of usage quota time + /// the user gets in addition to the lab usage quota. + public UserUpdate(System.TimeSpan? additionalUsageQuota = default(System.TimeSpan?)) + { + AdditionalUsageQuota = additionalUsageQuota; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the amount of usage quota time the user gets in + /// addition to the lab usage quota. + /// + [JsonProperty(PropertyName = "properties.additionalUsageQuota")] + public System.TimeSpan? AdditionalUsageQuota { get; set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachine.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachine.cs new file mode 100644 index 000000000000..2ee20e1d88e2 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachine.cs @@ -0,0 +1,116 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A lab virtual machine resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachine : ProxyResource + { + /// + /// Initializes a new instance of the VirtualMachine class. + /// + public VirtualMachine() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachine class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// System data of the Lab virtual + /// machine. + /// Current provisioning state of the + /// virtual machine. Possible values include: 'Creating', 'Updating', + /// 'Deleting', 'Succeeded', 'Failed', 'Locked' + /// The current state of the virtual machine. + /// Possible values include: 'Stopped', 'Starting', 'Running', + /// 'Stopping', 'ResettingPassword', 'Reimaging', 'Redeploying' + /// Profile for information about + /// connecting to the virtual machine. + /// The lab user ID (not the PUID!) of + /// who claimed the virtual machine. + /// The type of this VM resource. Possible values + /// include: 'User', 'Template' + public VirtualMachine(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), ProvisioningState? provisioningState = default(ProvisioningState?), VirtualMachineState? state = default(VirtualMachineState?), VirtualMachineConnectionProfile connectionProfile = default(VirtualMachineConnectionProfile), string claimedByUserId = default(string), VirtualMachineType? vmType = default(VirtualMachineType?)) + : base(id, name, type) + { + SystemData = systemData; + ProvisioningState = provisioningState; + State = state; + ConnectionProfile = connectionProfile; + ClaimedByUserId = claimedByUserId; + VmType = vmType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets system data of the Lab virtual machine. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Gets current provisioning state of the virtual machine. Possible + /// values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + /// 'Failed', 'Locked' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public ProvisioningState? ProvisioningState { get; private set; } + + /// + /// Gets the current state of the virtual machine. Possible values + /// include: 'Stopped', 'Starting', 'Running', 'Stopping', + /// 'ResettingPassword', 'Reimaging', 'Redeploying' + /// + [JsonProperty(PropertyName = "properties.state")] + public VirtualMachineState? State { get; private set; } + + /// + /// Gets profile for information about connecting to the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.connectionProfile")] + public VirtualMachineConnectionProfile ConnectionProfile { get; private set; } + + /// + /// Gets the lab user ID (not the PUID!) of who claimed the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.claimedByUserId")] + public string ClaimedByUserId { get; private set; } + + /// + /// Gets the type of this VM resource. Possible values include: 'User', + /// 'Template' + /// + [JsonProperty(PropertyName = "properties.vmType")] + public VirtualMachineType? VmType { get; private set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SizeConfigurationPropertiesFragment.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachineAdditionalCapabilities.cs similarity index 51% rename from sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SizeConfigurationPropertiesFragment.cs rename to sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachineAdditionalCapabilities.cs index db0f9815796b..68a6d6838f23 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/SizeConfigurationPropertiesFragment.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachineAdditionalCapabilities.cs @@ -11,33 +11,31 @@ namespace Microsoft.Azure.Management.LabServices.Models { using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// - /// Represents the size configuration under the lab account + /// The additional capabilities for a lab VM. /// - public partial class SizeConfigurationPropertiesFragment + public partial class VirtualMachineAdditionalCapabilities { /// /// Initializes a new instance of the - /// SizeConfigurationPropertiesFragment class. + /// VirtualMachineAdditionalCapabilities class. /// - public SizeConfigurationPropertiesFragment() + public VirtualMachineAdditionalCapabilities() { CustomInit(); } /// /// Initializes a new instance of the - /// SizeConfigurationPropertiesFragment class. + /// VirtualMachineAdditionalCapabilities class. /// - /// Represents a list of size categories - /// supported by this Lab Account (Small, Medium, Large) - public SizeConfigurationPropertiesFragment(IList environmentSizes = default(IList)) + /// Flag to pre-install dedicated GPU + /// drivers. Possible values include: 'Enabled', 'Disabled' + public VirtualMachineAdditionalCapabilities(EnableState? installGpuDrivers = default(EnableState?)) { - EnvironmentSizes = environmentSizes; + InstallGpuDrivers = installGpuDrivers; CustomInit(); } @@ -47,11 +45,11 @@ public SizeConfigurationPropertiesFragment() partial void CustomInit(); /// - /// Gets or sets represents a list of size categories supported by this - /// Lab Account (Small, Medium, Large) + /// Gets or sets flag to pre-install dedicated GPU drivers. Possible + /// values include: 'Enabled', 'Disabled' /// - [JsonProperty(PropertyName = "environmentSizes")] - public IList EnvironmentSizes { get; set; } + [JsonProperty(PropertyName = "installGpuDrivers")] + public EnableState? InstallGpuDrivers { get; set; } } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachineConnectionProfile.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachineConnectionProfile.cs new file mode 100644 index 000000000000..27eddd817bca --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachineConnectionProfile.cs @@ -0,0 +1,115 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The connection information for the virtual machine + /// + public partial class VirtualMachineConnectionProfile + { + /// + /// Initializes a new instance of the VirtualMachineConnectionProfile + /// class. + /// + public VirtualMachineConnectionProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineConnectionProfile + /// class. + /// + /// The private IP address of the + /// virtual machine. + /// Port and host name separated by + /// semicolon for connecting via SSH protocol to the virtual + /// machine. + /// URL for connecting via SSH protocol + /// to the virtual machine in browser. + /// Port and host name separated by + /// semicolon for connecting via RDP protocol to the virtual + /// machine. + /// URL for connecting via RDP protocol + /// to the virtual machine in browser. + /// The username used to log on to the + /// virtual machine as admin. + /// The username used to log on to the + /// virtual machine as non-admin, if one exists. + public VirtualMachineConnectionProfile(string privateIpAddress = default(string), string sshAuthority = default(string), string sshInBrowserUrl = default(string), string rdpAuthority = default(string), string rdpInBrowserUrl = default(string), string adminUsername = default(string), string nonAdminUsername = default(string)) + { + PrivateIpAddress = privateIpAddress; + SshAuthority = sshAuthority; + SshInBrowserUrl = sshInBrowserUrl; + RdpAuthority = rdpAuthority; + RdpInBrowserUrl = rdpInBrowserUrl; + AdminUsername = adminUsername; + NonAdminUsername = nonAdminUsername; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the private IP address of the virtual machine. + /// + [JsonProperty(PropertyName = "privateIpAddress")] + public string PrivateIpAddress { get; private set; } + + /// + /// Gets port and host name separated by semicolon for connecting via + /// SSH protocol to the virtual machine. + /// + [JsonProperty(PropertyName = "sshAuthority")] + public string SshAuthority { get; private set; } + + /// + /// Gets URL for connecting via SSH protocol to the virtual machine in + /// browser. + /// + [JsonProperty(PropertyName = "sshInBrowserUrl")] + public string SshInBrowserUrl { get; private set; } + + /// + /// Gets port and host name separated by semicolon for connecting via + /// RDP protocol to the virtual machine. + /// + [JsonProperty(PropertyName = "rdpAuthority")] + public string RdpAuthority { get; private set; } + + /// + /// Gets URL for connecting via RDP protocol to the virtual machine in + /// browser. + /// + [JsonProperty(PropertyName = "rdpInBrowserUrl")] + public string RdpInBrowserUrl { get; private set; } + + /// + /// Gets the username used to log on to the virtual machine as admin. + /// + [JsonProperty(PropertyName = "adminUsername")] + public string AdminUsername { get; private set; } + + /// + /// Gets the username used to log on to the virtual machine as + /// non-admin, if one exists. + /// + [JsonProperty(PropertyName = "nonAdminUsername")] + public string NonAdminUsername { get; private set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachineDetails.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachineDetails.cs deleted file mode 100644 index e0c0b8bfec18..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachineDetails.cs +++ /dev/null @@ -1,95 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Details of the backing virtual machine. - /// - public partial class VirtualMachineDetails - { - /// - /// Initializes a new instance of the VirtualMachineDetails class. - /// - public VirtualMachineDetails() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the VirtualMachineDetails class. - /// - /// Provisioning state of the Dtl - /// VM - /// Connection information for - /// Windows - /// Connection information for Linux - /// PrivateIp address of the compute - /// VM - /// Compute VM login user name - /// Last known compute power state - /// captured in DTL - public VirtualMachineDetails(string provisioningState = default(string), string rdpAuthority = default(string), string sshAuthority = default(string), string privateIpAddress = default(string), string userName = default(string), string lastKnownPowerState = default(string)) - { - ProvisioningState = provisioningState; - RdpAuthority = rdpAuthority; - SshAuthority = sshAuthority; - PrivateIpAddress = privateIpAddress; - UserName = userName; - LastKnownPowerState = lastKnownPowerState; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets provisioning state of the Dtl VM - /// - [JsonProperty(PropertyName = "provisioningState")] - public string ProvisioningState { get; private set; } - - /// - /// Gets connection information for Windows - /// - [JsonProperty(PropertyName = "rdpAuthority")] - public string RdpAuthority { get; private set; } - - /// - /// Gets connection information for Linux - /// - [JsonProperty(PropertyName = "sshAuthority")] - public string SshAuthority { get; private set; } - - /// - /// Gets privateIp address of the compute VM - /// - [JsonProperty(PropertyName = "privateIpAddress")] - public string PrivateIpAddress { get; private set; } - - /// - /// Gets compute VM login user name - /// - [JsonProperty(PropertyName = "userName")] - public string UserName { get; private set; } - - /// - /// Gets last known compute power state captured in DTL - /// - [JsonProperty(PropertyName = "lastKnownPowerState")] - public string LastKnownPowerState { get; private set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachineProfile.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachineProfile.cs new file mode 100644 index 000000000000..c317394127b6 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachineProfile.cs @@ -0,0 +1,166 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The base virtual machine configuration for a lab. + /// + public partial class VirtualMachineProfile + { + /// + /// Initializes a new instance of the VirtualMachineProfile class. + /// + public VirtualMachineProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineProfile class. + /// + /// Indicates what lab virtual machines are + /// created from. Possible values include: 'Image', + /// 'TemplateVM' + /// The image configuration for lab + /// virtual machines. + /// The SKU for the lab. Defines the type of virtual + /// machines used in the lab. + /// The initial quota alloted to each lab + /// user. Must be a time span between 0 and 9999 hours. + /// Credentials for the admin user on the + /// VM. + /// The OS type of the image. Possible values + /// include: 'Windows', 'Linux' + /// Additional VM + /// capabilities. + /// Enabling this option will use the + /// same password for all user VMs. Possible values include: 'Enabled', + /// 'Disabled' + /// Credentials for the non-admin user on + /// the VM, if one exists. + public VirtualMachineProfile(CreateOption createOption, ImageReference imageReference, Sku sku, System.TimeSpan usageQuota, Credentials adminUser, OsType? osType = default(OsType?), VirtualMachineAdditionalCapabilities additionalCapabilities = default(VirtualMachineAdditionalCapabilities), EnableState? useSharedPassword = default(EnableState?), Credentials nonAdminUser = default(Credentials)) + { + CreateOption = createOption; + ImageReference = imageReference; + OsType = osType; + Sku = sku; + AdditionalCapabilities = additionalCapabilities; + UsageQuota = usageQuota; + UseSharedPassword = useSharedPassword; + AdminUser = adminUser; + NonAdminUser = nonAdminUser; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates what lab virtual machines are created from. + /// Possible values include: 'Image', 'TemplateVM' + /// + [JsonProperty(PropertyName = "createOption")] + public CreateOption CreateOption { get; set; } + + /// + /// Gets or sets the image configuration for lab virtual machines. + /// + [JsonProperty(PropertyName = "imageReference")] + public ImageReference ImageReference { get; set; } + + /// + /// Gets the OS type of the image. Possible values include: 'Windows', + /// 'Linux' + /// + [JsonProperty(PropertyName = "osType")] + public OsType? OsType { get; private set; } + + /// + /// Gets or sets the SKU for the lab. Defines the type of virtual + /// machines used in the lab. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// Gets or sets additional VM capabilities. + /// + [JsonProperty(PropertyName = "additionalCapabilities")] + public VirtualMachineAdditionalCapabilities AdditionalCapabilities { get; set; } + + /// + /// Gets or sets the initial quota alloted to each lab user. Must be a + /// time span between 0 and 9999 hours. + /// + [JsonProperty(PropertyName = "usageQuota")] + public System.TimeSpan UsageQuota { get; set; } + + /// + /// Gets or sets enabling this option will use the same password for + /// all user VMs. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "useSharedPassword")] + public EnableState? UseSharedPassword { get; set; } + + /// + /// Gets or sets credentials for the admin user on the VM. + /// + [JsonProperty(PropertyName = "adminUser")] + public Credentials AdminUser { get; set; } + + /// + /// Gets or sets credentials for the non-admin user on the VM, if one + /// exists. + /// + [JsonProperty(PropertyName = "nonAdminUser")] + public Credentials NonAdminUser { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ImageReference == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ImageReference"); + } + if (Sku == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Sku"); + } + if (AdminUser == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AdminUser"); + } + if (Sku != null) + { + Sku.Validate(); + } + if (AdminUser != null) + { + AdminUser.Validate(); + } + if (NonAdminUser != null) + { + NonAdminUser.Validate(); + } + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachineState.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachineState.cs new file mode 100644 index 000000000000..6e4fc90582fb --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachineState.cs @@ -0,0 +1,111 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for VirtualMachineState. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum VirtualMachineState + { + /// + /// The VM is currently stopped. + /// + [EnumMember(Value = "Stopped")] + Stopped, + /// + /// The VM is starting. + /// + [EnumMember(Value = "Starting")] + Starting, + /// + /// The VM is running. + /// + [EnumMember(Value = "Running")] + Running, + /// + /// The VM is stopping. + /// + [EnumMember(Value = "Stopping")] + Stopping, + /// + /// The VM password is being reset. + /// + [EnumMember(Value = "ResettingPassword")] + ResettingPassword, + /// + /// The VM is being reimaged. + /// + [EnumMember(Value = "Reimaging")] + Reimaging, + /// + /// The VM is being redeployed. + /// + [EnumMember(Value = "Redeploying")] + Redeploying + } + internal static class VirtualMachineStateEnumExtension + { + internal static string ToSerializedValue(this VirtualMachineState? value) + { + return value == null ? null : ((VirtualMachineState)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this VirtualMachineState value) + { + switch( value ) + { + case VirtualMachineState.Stopped: + return "Stopped"; + case VirtualMachineState.Starting: + return "Starting"; + case VirtualMachineState.Running: + return "Running"; + case VirtualMachineState.Stopping: + return "Stopping"; + case VirtualMachineState.ResettingPassword: + return "ResettingPassword"; + case VirtualMachineState.Reimaging: + return "Reimaging"; + case VirtualMachineState.Redeploying: + return "Redeploying"; + } + return null; + } + + internal static VirtualMachineState? ParseVirtualMachineState(this string value) + { + switch( value ) + { + case "Stopped": + return VirtualMachineState.Stopped; + case "Starting": + return VirtualMachineState.Starting; + case "Running": + return VirtualMachineState.Running; + case "Stopping": + return VirtualMachineState.Stopping; + case "ResettingPassword": + return VirtualMachineState.ResettingPassword; + case "Reimaging": + return VirtualMachineState.Reimaging; + case "Redeploying": + return VirtualMachineState.Redeploying; + } + return null; + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachineType.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachineType.cs new file mode 100644 index 000000000000..02c4a498fd0a --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VirtualMachineType.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for VirtualMachineType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum VirtualMachineType + { + /// + /// A user VM + /// + [EnumMember(Value = "User")] + User, + /// + /// A template VM + /// + [EnumMember(Value = "Template")] + Template + } + internal static class VirtualMachineTypeEnumExtension + { + internal static string ToSerializedValue(this VirtualMachineType? value) + { + return value == null ? null : ((VirtualMachineType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this VirtualMachineType value) + { + switch( value ) + { + case VirtualMachineType.User: + return "User"; + case VirtualMachineType.Template: + return "Template"; + } + return null; + } + + internal static VirtualMachineType? ParseVirtualMachineType(this string value) + { + switch( value ) + { + case "User": + return VirtualMachineType.User; + case "Template": + return VirtualMachineType.Template; + } + return null; + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VmStateDetails.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VmStateDetails.cs deleted file mode 100644 index 277fa1b01fd0..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/VmStateDetails.cs +++ /dev/null @@ -1,84 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Details about the state of the reference virtual machine. - /// - public partial class VmStateDetails - { - /// - /// Initializes a new instance of the VmStateDetails class. - /// - public VmStateDetails() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the VmStateDetails class. - /// - /// The RdpAuthority property is a server - /// DNS host name or IP address followed by the service port number for - /// RDP (Remote Desktop Protocol). - /// The SshAuthority property is a server - /// DNS host name or IP address followed by the service port number for - /// SSH. - /// The power state of the reference virtual - /// machine. - /// Last known compute power state - /// captured in DTL - public VmStateDetails(string rdpAuthority = default(string), string sshAuthority = default(string), string powerState = default(string), string lastKnownPowerState = default(string)) - { - RdpAuthority = rdpAuthority; - SshAuthority = sshAuthority; - PowerState = powerState; - LastKnownPowerState = lastKnownPowerState; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the RdpAuthority property is a server DNS host name or IP - /// address followed by the service port number for RDP (Remote Desktop - /// Protocol). - /// - [JsonProperty(PropertyName = "rdpAuthority")] - public string RdpAuthority { get; private set; } - - /// - /// Gets the SshAuthority property is a server DNS host name or IP - /// address followed by the service port number for SSH. - /// - [JsonProperty(PropertyName = "sshAuthority")] - public string SshAuthority { get; private set; } - - /// - /// Gets the power state of the reference virtual machine. - /// - [JsonProperty(PropertyName = "powerState")] - public string PowerState { get; private set; } - - /// - /// Gets last known compute power state captured in DTL - /// - [JsonProperty(PropertyName = "lastKnownPowerState")] - public string LastKnownPowerState { get; private set; } - - } -} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/WeekDay.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/WeekDay.cs new file mode 100644 index 000000000000..f4ca7854e17d --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/WeekDay.cs @@ -0,0 +1,111 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for WeekDay. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum WeekDay + { + /// + /// Schedule will run on Sunday + /// + [EnumMember(Value = "Sunday")] + Sunday, + /// + /// Schedule will run on Monday + /// + [EnumMember(Value = "Monday")] + Monday, + /// + /// Schedule will run on Tuesday + /// + [EnumMember(Value = "Tuesday")] + Tuesday, + /// + /// Schedule will run on Wednesday + /// + [EnumMember(Value = "Wednesday")] + Wednesday, + /// + /// Schedule will run on Thursday + /// + [EnumMember(Value = "Thursday")] + Thursday, + /// + /// Schedule will run on Friday + /// + [EnumMember(Value = "Friday")] + Friday, + /// + /// Schedule will run on Saturday + /// + [EnumMember(Value = "Saturday")] + Saturday + } + internal static class WeekDayEnumExtension + { + internal static string ToSerializedValue(this WeekDay? value) + { + return value == null ? null : ((WeekDay)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this WeekDay value) + { + switch( value ) + { + case WeekDay.Sunday: + return "Sunday"; + case WeekDay.Monday: + return "Monday"; + case WeekDay.Tuesday: + return "Tuesday"; + case WeekDay.Wednesday: + return "Wednesday"; + case WeekDay.Thursday: + return "Thursday"; + case WeekDay.Friday: + return "Friday"; + case WeekDay.Saturday: + return "Saturday"; + } + return null; + } + + internal static WeekDay? ParseWeekDay(this string value) + { + switch( value ) + { + case "Sunday": + return WeekDay.Sunday; + case "Monday": + return WeekDay.Monday; + case "Tuesday": + return WeekDay.Tuesday; + case "Wednesday": + return WeekDay.Wednesday; + case "Thursday": + return WeekDay.Thursday; + case "Friday": + return WeekDay.Friday; + case "Saturday": + return WeekDay.Saturday; + } + return null; + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/OperationResultsOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/OperationResultsOperations.cs new file mode 100644 index 000000000000..db9584776a47 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/OperationResultsOperations.cs @@ -0,0 +1,268 @@ +// +// 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; + + /// + /// OperationResultsOperations operations. + /// + internal partial class OperationResultsOperations : IServiceOperations, IOperationResultsOperations + { + /// + /// Initializes a new instance of the OperationResultsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal OperationResultsOperations(LabServicesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the LabServicesClient + /// + public LabServicesClient Client { get; private set; } + + /// + /// Get an azure operation result. + /// + /// + /// Returns an azure operation result. + /// + /// + /// The operation result ID / name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (operationResultId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationResultId"); + } + if (operationResultId != null) + { + if (operationResultId.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "operationResultId", 100); + } + if (operationResultId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "operationResultId", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(operationResultId, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "operationResultId", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("operationResultId", operationResultId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.LabServices/operationResults/{operationResultId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{operationResultId}", System.Uri.EscapeDataString(operationResultId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 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/OperationResultsOperationsExtensions.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/OperationResultsOperationsExtensions.cs new file mode 100644 index 000000000000..4e8a356bb107 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/OperationResultsOperationsExtensions.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.LabServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for OperationResultsOperations. + /// + public static partial class OperationResultsOperationsExtensions + { + /// + /// Get an azure operation result. + /// + /// + /// Returns an azure operation result. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The operation result ID / name. + /// + public static OperationResult Get(this IOperationResultsOperations operations, string operationResultId) + { + return operations.GetAsync(operationResultId).GetAwaiter().GetResult(); + } + + /// + /// Get an azure operation result. + /// + /// + /// Returns an azure operation result. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The operation result ID / name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IOperationResultsOperations operations, string operationResultId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(operationResultId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Operations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Operations.cs index 371cf5532382..04c91159946d 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Operations.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Operations.cs @@ -25,7 +25,7 @@ namespace Microsoft.Azure.Management.LabServices /// /// Operations operations. /// - internal partial class Operations : IServiceOperations, IOperations + internal partial class Operations : IServiceOperations, IOperations { /// /// Initializes a new instance of the Operations class. @@ -36,7 +36,7 @@ internal partial class Operations : IServiceOperations, IOper /// /// Thrown when a required parameter is null /// - internal Operations(ManagedLabsClient client) + internal Operations(LabServicesClient client) { if (client == null) { @@ -46,26 +46,23 @@ internal Operations(ManagedLabsClient client) } /// - /// Gets a reference to the ManagedLabsClient + /// Gets a reference to the LabServicesClient /// - public ManagedLabsClient Client { get; private set; } + public LabServicesClient Client { get; private set; } /// - /// Get operation + /// Get all operations /// - /// - /// The name of the location. - /// - /// - /// The name of the operation. - /// + /// + /// Returns a list of all operations. + /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -80,24 +77,19 @@ internal Operations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string locationName, string operationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (locationName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); - } - if (operationName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "operationName"); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -105,17 +97,12 @@ internal Operations(ManagedLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("locationName", locationName); - tracingParameters.Add("operationName", operationName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.LabServices/locations/{locationName}/operations/{operationName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); - _url = _url.Replace("{operationName}", System.Uri.EscapeDataString(operationName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.LabServices/operations").ToString(); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -181,14 +168,13 @@ internal Operations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -198,10 +184,177 @@ internal Operations(ManagedLabsClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get all operations + /// + /// + /// Returns a list of all operations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + // Ignore the exception } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -214,7 +367,7 @@ internal Operations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -227,7 +380,7 @@ internal Operations(ManagedLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/OperationsExtensions.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/OperationsExtensions.cs index ae944d70a046..c7b4c57ac5ec 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/OperationsExtensions.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/OperationsExtensions.cs @@ -22,40 +22,74 @@ namespace Microsoft.Azure.Management.LabServices public static partial class OperationsExtensions { /// - /// Get operation + /// Get all operations /// + /// + /// Returns a list of all operations. + /// /// /// The operations group for this extension method. /// - /// - /// The name of the location. + public static IPage List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Get all operations + /// + /// + /// Returns a list of all operations. + /// + /// + /// The operations group for this extension method. /// - /// - /// The name of the operation. + /// + /// The cancellation token. /// - public static OperationResult Get(this IOperations operations, string locationName, string operationName) + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { - return operations.GetAsync(locationName, operationName).GetAwaiter().GetResult(); + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Get operation + /// Get all operations /// + /// + /// Returns a list of all operations. + /// /// /// The operations group for this extension method. /// - /// - /// The name of the location. + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all operations + /// + /// + /// Returns a list of all operations. + /// + /// + /// The operations group for this extension method. /// - /// - /// The name of the operation. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// The cancellation token. /// - public static async Task GetAsync(this IOperations operations, string locationName, string operationName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(locationName, operationName, null, cancellationToken).ConfigureAwait(false)) + 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/ProviderOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ProviderOperations.cs deleted file mode 100644 index aa7a3f0900a6..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ProviderOperations.cs +++ /dev/null @@ -1,400 +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; - - /// - /// ProviderOperations operations. - /// - internal partial class ProviderOperations : IServiceOperations, IProviderOperations - { - /// - /// Initializes a new instance of the ProviderOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ProviderOperations(ManagedLabsClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the ManagedLabsClient - /// - public ManagedLabsClient Client { get; private set; } - - /// - /// Result of the request to list REST API operations - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.LabServices/operations").ToString(); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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; - } - - /// - /// Result of the request to list REST API operations - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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/ProviderOperationsExtensions.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ProviderOperationsExtensions.cs deleted file mode 100644 index 9898e292a2f7..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ProviderOperationsExtensions.cs +++ /dev/null @@ -1,87 +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 ProviderOperations. - /// - public static partial class ProviderOperationsExtensions - { - /// - /// Result of the request to list REST API operations - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IProviderOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Result of the request to list REST API operations - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IProviderOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Result of the request to list REST API operations - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IProviderOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Result of the request to list REST API operations - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListNextAsync(this IProviderOperations 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/GalleryImagesOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SchedulesOperations.cs similarity index 68% rename from sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/GalleryImagesOperations.cs rename to sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SchedulesOperations.cs index 0fab14d265fc..f2470d503af6 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/GalleryImagesOperations.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SchedulesOperations.cs @@ -12,7 +12,6 @@ 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; @@ -24,12 +23,12 @@ namespace Microsoft.Azure.Management.LabServices using System.Threading.Tasks; /// - /// GalleryImagesOperations operations. + /// SchedulesOperations operations. /// - internal partial class GalleryImagesOperations : IServiceOperations, IGalleryImagesOperations + internal partial class SchedulesOperations : IServiceOperations, ISchedulesOperations { /// - /// Initializes a new instance of the GalleryImagesOperations class. + /// Initializes a new instance of the SchedulesOperations class. /// /// /// Reference to the service client. @@ -37,7 +36,7 @@ internal partial class GalleryImagesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal GalleryImagesOperations(ManagedLabsClient client) + internal SchedulesOperations(LabServicesClient client) { if (client == null) { @@ -47,21 +46,25 @@ internal GalleryImagesOperations(ManagedLabsClient client) } /// - /// Gets a reference to the ManagedLabsClient + /// Gets a reference to the LabServicesClient /// - public ManagedLabsClient Client { get; private set; } + public LabServicesClient Client { get; private set; } /// - /// List gallery images in a given lab account. + /// Get all schedules for a lab. /// + /// + /// Returns a list of all schedules for a lab. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// - /// - /// The name of the lab Account. + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// OData parameters to apply to the operation. + /// + /// The filter to apply to the operation. /// /// /// Headers that will be added to request. @@ -69,7 +72,7 @@ internal GalleryImagesOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -84,23 +87,59 @@ internal GalleryImagesOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labAccountName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByLabWithHttpMessagesAsync(string resourceGroupName, string labName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (Client.ApiVersion == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -109,31 +148,27 @@ internal GalleryImagesOperations(ManagedLabsClient client) { _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("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByLab", 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}/galleryimages").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules").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)); 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 (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -194,14 +229,13 @@ internal GalleryImagesOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -211,10 +245,6 @@ internal GalleryImagesOperations(ManagedLabsClient client) } 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); @@ -227,7 +257,7 @@ internal GalleryImagesOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -240,7 +270,7 @@ internal GalleryImagesOperations(ManagedLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -260,19 +290,21 @@ internal GalleryImagesOperations(ManagedLabsClient client) } /// - /// Get gallery image + /// Get a lab Schedule. /// + /// + /// Returns the properties of a lab Schedule. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// - /// - /// The name of the gallery Image. + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// Specify the $expand query. Example: 'properties($select=author)' + /// + /// The name of the schedule that uniquely identifies it within containing lab. + /// Used in resource URIs. /// /// /// Headers that will be added to request. @@ -280,7 +312,7 @@ internal GalleryImagesOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -295,27 +327,78 @@ internal GalleryImagesOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string galleryImageName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string scheduleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (galleryImageName == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } } - if (Client.ApiVersion == null) + if (scheduleName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleName"); + } + if (scheduleName != null) + { + if (scheduleName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "scheduleName", 100); + } + if (scheduleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "scheduleName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(scheduleName, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "scheduleName", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -325,24 +408,19 @@ internal GalleryImagesOperations(ManagedLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); - tracingParameters.Add("galleryImageName", galleryImageName); - tracingParameters.Add("expand", expand); + tracingParameters.Add("labName", labName); + tracingParameters.Add("scheduleName", scheduleName); 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}/galleryimages/{galleryImageName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}").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("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{scheduleName}", System.Uri.EscapeDataString(scheduleName)); 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))); @@ -407,14 +485,13 @@ internal GalleryImagesOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -424,10 +501,6 @@ internal GalleryImagesOperations(ManagedLabsClient client) } 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); @@ -440,7 +513,7 @@ internal GalleryImagesOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -453,7 +526,7 @@ internal GalleryImagesOperations(ManagedLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -473,19 +546,24 @@ internal GalleryImagesOperations(ManagedLabsClient client) } /// - /// Create or replace an existing Gallery Image. + /// Create or update a lab schedule. /// - /// - /// The name of the resource group. + /// + /// Operation to create or update a lab schedule. + /// + /// + /// The request body. /// - /// - /// The name of the lab Account. + /// + /// The name of the resource group. The name is case insensitive. /// - /// - /// The name of the gallery Image. + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// Represents an image from the Azure Marketplace + /// + /// The name of the schedule that uniquely identifies it within containing lab. + /// Used in resource URIs. /// /// /// Headers that will be added to request. @@ -493,7 +571,7 @@ internal GalleryImagesOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -508,31 +586,86 @@ internal GalleryImagesOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string galleryImageName, GalleryImage galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(Schedule body, string resourceGroupName, string labName, string scheduleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } - if (galleryImageName == null) + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (galleryImage == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "galleryImage"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } } - if (Client.ApiVersion == null) + if (scheduleName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleName"); + } + if (scheduleName != null) + { + if (scheduleName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "scheduleName", 100); + } + if (scheduleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "scheduleName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(scheduleName, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "scheduleName", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -541,20 +674,20 @@ internal GalleryImagesOperations(ManagedLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); - tracingParameters.Add("galleryImageName", galleryImageName); - tracingParameters.Add("galleryImage", galleryImage); + tracingParameters.Add("labName", labName); + tracingParameters.Add("scheduleName", scheduleName); 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}/galleryimages/{galleryImageName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}").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("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{scheduleName}", System.Uri.EscapeDataString(scheduleName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -598,9 +731,9 @@ internal GalleryImagesOperations(ManagedLabsClient client) // Serialize Request string _requestContent = null; - if(galleryImage != null) + if(body != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(galleryImage, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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"); } @@ -626,14 +759,13 @@ internal GalleryImagesOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 201) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -643,10 +775,6 @@ internal GalleryImagesOperations(ManagedLabsClient client) } 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); @@ -659,7 +787,7 @@ internal GalleryImagesOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -672,7 +800,7 @@ internal GalleryImagesOperations(ManagedLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -690,7 +818,7 @@ internal GalleryImagesOperations(ManagedLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -710,16 +838,24 @@ internal GalleryImagesOperations(ManagedLabsClient client) } /// - /// Delete gallery image. + /// Update a lab schedule. /// + /// + /// Operation to update a lab schedule. + /// + /// + /// The request body. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// - /// - /// The name of the lab Account. + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// The name of the gallery Image. + /// + /// The name of the schedule that uniquely identifies it within containing lab. + /// Used in resource URIs. /// /// /// Headers that will be added to request. @@ -727,9 +863,12 @@ internal GalleryImagesOperations(ManagedLabsClient client) /// /// 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 /// @@ -739,27 +878,82 @@ internal GalleryImagesOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(ScheduleUpdate body, string resourceGroupName, string labName, string scheduleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } - if (galleryImageName == null) + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (Client.ApiVersion == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } + } + if (scheduleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleName"); + } + if (scheduleName != null) + { + if (scheduleName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "scheduleName", 100); + } + if (scheduleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "scheduleName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(scheduleName, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "scheduleName", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -768,19 +962,20 @@ internal GalleryImagesOperations(ManagedLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); - tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("scheduleName", scheduleName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + 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}/galleryimages/{galleryImageName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}").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("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{scheduleName}", System.Uri.EscapeDataString(scheduleName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -793,7 +988,7 @@ internal GalleryImagesOperations(ManagedLabsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -824,6 +1019,12 @@ internal GalleryImagesOperations(ManagedLabsClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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) { @@ -844,16 +1045,15 @@ internal GalleryImagesOperations(ManagedLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) + if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -863,10 +1063,6 @@ internal GalleryImagesOperations(ManagedLabsClient client) } 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); @@ -879,13 +1075,31 @@ internal GalleryImagesOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _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); @@ -894,19 +1108,51 @@ internal GalleryImagesOperations(ManagedLabsClient client) } /// - /// Modify properties of gallery images. + /// Deletes a schedule resource. /// + /// + /// Operation to delete a schedule resource. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the schedule that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. /// - /// - /// The name of the lab Account. + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string scheduleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, scheduleName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a schedule resource. + /// + /// + /// Operation to delete a schedule resource. + /// + /// + /// The name of the resource group. The name is case insensitive. /// - /// - /// The name of the gallery Image. + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// Represents an image from the Azure Marketplace + /// + /// The name of the schedule that uniquely identifies it within containing lab. + /// Used in resource URIs. /// /// /// Headers that will be added to request. @@ -914,12 +1160,9 @@ internal GalleryImagesOperations(ManagedLabsClient client) /// /// 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 /// @@ -929,31 +1172,78 @@ internal GalleryImagesOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string galleryImageName, GalleryImageFragment galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string scheduleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } - if (galleryImageName == null) + if (labName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (galleryImage == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "galleryImage"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } } - if (Client.ApiVersion == null) + if (scheduleName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleName"); + } + if (scheduleName != null) + { + if (scheduleName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "scheduleName", 100); + } + if (scheduleName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "scheduleName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(scheduleName, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "scheduleName", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -963,19 +1253,18 @@ internal GalleryImagesOperations(ManagedLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); - tracingParameters.Add("galleryImageName", galleryImageName); - tracingParameters.Add("galleryImage", galleryImage); + tracingParameters.Add("labName", labName); + tracingParameters.Add("scheduleName", scheduleName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + 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}/galleryimages/{galleryImageName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}").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("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{scheduleName}", System.Uri.EscapeDataString(scheduleName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -988,7 +1277,7 @@ internal GalleryImagesOperations(ManagedLabsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1019,12 +1308,6 @@ internal GalleryImagesOperations(ManagedLabsClient client) // Serialize Request string _requestContent = null; - if(galleryImage != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(galleryImage, 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) { @@ -1045,16 +1328,15 @@ internal GalleryImagesOperations(ManagedLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1064,10 +1346,6 @@ internal GalleryImagesOperations(ManagedLabsClient client) } 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); @@ -1080,31 +1358,13 @@ internal GalleryImagesOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _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); @@ -1113,8 +1373,11 @@ internal GalleryImagesOperations(ManagedLabsClient client) } /// - /// List gallery images in a given lab account. + /// Get all schedules for a lab. /// + /// + /// Returns a list of all schedules for a lab. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -1124,7 +1387,7 @@ internal GalleryImagesOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1139,7 +1402,7 @@ internal GalleryImagesOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByLabNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -1154,7 +1417,7 @@ internal GalleryImagesOperations(ManagedLabsClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByLabNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -1220,14 +1483,13 @@ internal GalleryImagesOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1237,10 +1499,6 @@ internal GalleryImagesOperations(ManagedLabsClient client) } 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); @@ -1253,7 +1511,7 @@ internal GalleryImagesOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1266,7 +1524,7 @@ internal GalleryImagesOperations(ManagedLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SchedulesOperationsExtensions.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SchedulesOperationsExtensions.cs new file mode 100644 index 000000000000..81e91683619e --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SchedulesOperationsExtensions.cs @@ -0,0 +1,405 @@ +// +// 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 SchedulesOperations. + /// + public static partial class SchedulesOperationsExtensions + { + /// + /// Get all schedules for a lab. + /// + /// + /// Returns a list of all schedules for a lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The filter to apply to the operation. + /// + public static IPage ListByLab(this ISchedulesOperations operations, string resourceGroupName, string labName, string filter = default(string)) + { + return operations.ListByLabAsync(resourceGroupName, labName, filter).GetAwaiter().GetResult(); + } + + /// + /// Get all schedules for a lab. + /// + /// + /// Returns a list of all schedules for a lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The filter to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLabAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLabWithHttpMessagesAsync(resourceGroupName, labName, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a lab Schedule. + /// + /// + /// Returns the properties of a lab Schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the schedule that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + public static Schedule Get(this ISchedulesOperations operations, string resourceGroupName, string labName, string scheduleName) + { + return operations.GetAsync(resourceGroupName, labName, scheduleName).GetAwaiter().GetResult(); + } + + /// + /// Get a lab Schedule. + /// + /// + /// Returns the properties of a lab Schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the schedule that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, string scheduleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, scheduleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a lab schedule. + /// + /// + /// Operation to create or update a lab schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the schedule that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + public static Schedule CreateOrUpdate(this ISchedulesOperations operations, Schedule body, string resourceGroupName, string labName, string scheduleName) + { + return operations.CreateOrUpdateAsync(body, resourceGroupName, labName, scheduleName).GetAwaiter().GetResult(); + } + + /// + /// Create or update a lab schedule. + /// + /// + /// Operation to create or update a lab schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the schedule that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ISchedulesOperations operations, Schedule body, string resourceGroupName, string labName, string scheduleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(body, resourceGroupName, labName, scheduleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a lab schedule. + /// + /// + /// Operation to update a lab schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the schedule that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + public static Schedule Update(this ISchedulesOperations operations, ScheduleUpdate body, string resourceGroupName, string labName, string scheduleName) + { + return operations.UpdateAsync(body, resourceGroupName, labName, scheduleName).GetAwaiter().GetResult(); + } + + /// + /// Update a lab schedule. + /// + /// + /// Operation to update a lab schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the schedule that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISchedulesOperations operations, ScheduleUpdate body, string resourceGroupName, string labName, string scheduleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(body, resourceGroupName, labName, scheduleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a schedule resource. + /// + /// + /// Operation to delete a schedule resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the schedule that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + public static void Delete(this ISchedulesOperations operations, string resourceGroupName, string labName, string scheduleName) + { + operations.DeleteAsync(resourceGroupName, labName, scheduleName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a schedule resource. + /// + /// + /// Operation to delete a schedule resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the schedule that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, string scheduleName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, scheduleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deletes a schedule resource. + /// + /// + /// Operation to delete a schedule resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the schedule that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + public static void BeginDelete(this ISchedulesOperations operations, string resourceGroupName, string labName, string scheduleName) + { + operations.BeginDeleteAsync(resourceGroupName, labName, scheduleName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a schedule resource. + /// + /// + /// Operation to delete a schedule resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the schedule that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ISchedulesOperations operations, string resourceGroupName, string labName, string scheduleName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, scheduleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get all schedules for a lab. + /// + /// + /// Returns a list of all schedules for a lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByLabNext(this ISchedulesOperations operations, string nextPageLink) + { + return operations.ListByLabNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all schedules for a lab. + /// + /// + /// Returns a list of all schedules for a 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> ListByLabNextAsync(this ISchedulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLabNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SdkInfo_LabServicesClient.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SdkInfo_LabServicesClient.cs new file mode 100644 index 000000000000..569f99834be7 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SdkInfo_LabServicesClient.cs @@ -0,0 +1,34 @@ + +// +// 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 System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_LabServicesClient + { + get + { + return new Tuple[] + { + new Tuple("LabServices", "Images", "2021-10-01-preview"), + new Tuple("LabServices", "LabPlans", "2021-10-01-preview"), + new Tuple("LabServices", "Labs", "2021-10-01-preview"), + new Tuple("LabServices", "OperationResults", "2021-10-01-preview"), + new Tuple("LabServices", "Operations", "2021-10-01-preview"), + new Tuple("LabServices", "Schedules", "2021-10-01-preview"), + new Tuple("LabServices", "Users", "2021-10-01-preview"), + new Tuple("LabServices", "VirtualMachines", "2021-10-01-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SdkInfo_ManagedLabsClient.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SdkInfo_ManagedLabsClient.cs deleted file mode 100644 index f01441782eed..000000000000 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SdkInfo_ManagedLabsClient.cs +++ /dev/null @@ -1,46 +0,0 @@ - -// -// 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 System; - using System.Collections.Generic; - using System.Linq; - - internal static partial class SdkInfo - { - public static IEnumerable> ApiInfo_ManagedLabsClient - { - get - { - return new Tuple[] - { - new Tuple("LabServices", "EnvironmentSettings", "2018-10-15"), - new Tuple("LabServices", "Environments", "2018-10-15"), - new Tuple("LabServices", "GalleryImages", "2018-10-15"), - new Tuple("LabServices", "GlobalUsers", "2018-10-15"), - new Tuple("LabServices", "LabAccounts", "2018-10-15"), - new Tuple("LabServices", "Labs", "2018-10-15"), - new Tuple("LabServices", "Operations", "2018-10-15"), - new Tuple("LabServices", "ProviderOperations", "2018-10-15"), - new Tuple("LabServices", "Users", "2018-10-15"), - }.AsEnumerable(); - } - } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/labservices/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\\git\\azure-sdk-for-net\\src\\SDKs"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "d02b8b65bf8ce5d8322c92530bf6b2e6dd3b9aab"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section - } -} - diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/UsersOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/UsersOperations.cs index e80d19e59b02..b56f34c17cd2 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/UsersOperations.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/UsersOperations.cs @@ -12,7 +12,6 @@ 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; @@ -26,7 +25,7 @@ namespace Microsoft.Azure.Management.LabServices /// /// UsersOperations operations. /// - internal partial class UsersOperations : IServiceOperations, IUsersOperations + internal partial class UsersOperations : IServiceOperations, IUsersOperations { /// /// Initializes a new instance of the UsersOperations class. @@ -37,7 +36,7 @@ internal partial class UsersOperations : IServiceOperations, /// /// Thrown when a required parameter is null /// - internal UsersOperations(ManagedLabsClient client) + internal UsersOperations(LabServicesClient client) { if (client == null) { @@ -47,24 +46,25 @@ internal UsersOperations(ManagedLabsClient client) } /// - /// Gets a reference to the ManagedLabsClient + /// Gets a reference to the LabServicesClient /// - public ManagedLabsClient Client { get; private set; } + public LabServicesClient Client { get; private set; } /// - /// List users in a given lab. + /// Get all users for a lab. /// + /// + /// Returns a list of all users for a lab. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// OData parameters to apply to the operation. + /// + /// The filter to apply to the operation. /// /// /// Headers that will be added to request. @@ -72,7 +72,7 @@ internal UsersOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -87,27 +87,59 @@ internal UsersOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByLabWithHttpMessagesAsync(string resourceGroupName, string labName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (labName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (Client.ApiVersion == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -116,33 +148,27 @@ internal UsersOperations(ManagedLabsClient client) { _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("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByLab", 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}/users").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users").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)); 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 (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -203,14 +229,13 @@ internal UsersOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -220,10 +245,6 @@ internal UsersOperations(ManagedLabsClient client) } 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); @@ -269,22 +290,21 @@ internal UsersOperations(ManagedLabsClient client) } /// - /// Get user + /// Get a lab user. /// + /// + /// Returns the properties of a lab user. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// - /// The name of the user. - /// - /// - /// Specify the $expand query. Example: 'properties($select=email)' + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. /// /// /// Headers that will be added to request. @@ -292,7 +312,7 @@ internal UsersOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -307,31 +327,78 @@ internal UsersOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string userName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (labName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } + if (labName != null) + { + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } + } if (userName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "userName"); } - if (Client.ApiVersion == null) + if (userName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (userName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "userName", 100); + } + if (userName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "userName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(userName, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "userName", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -341,26 +408,19 @@ internal UsersOperations(ManagedLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); - 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}/users/{userName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}").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("{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))); @@ -425,14 +485,13 @@ internal UsersOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -442,10 +501,6 @@ internal UsersOperations(ManagedLabsClient client) } 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); @@ -491,22 +546,153 @@ internal UsersOperations(ManagedLabsClient client) } /// - /// Create or replace an existing User. + /// Create or update a lab user. + /// + /// + /// Operation to create or update a lab user. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(User body, string resourceGroupName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(body, resourceGroupName, labName, userName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a lab user. + /// + /// + /// Operation to update a lab user. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(UserUpdate body, string resourceGroupName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(body, resourceGroupName, labName, userName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a user resource. /// + /// + /// Operation to delete a user resource. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Invite a user to a lab. + /// + /// + /// Operation to invite a user to a lab. + /// + /// + /// The request body. /// - /// - /// The name of the lab Account. + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// - /// The name of the user. + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task InviteWithHttpMessagesAsync(InviteBody body, string resourceGroupName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginInviteWithHttpMessagesAsync(body, resourceGroupName, labName, userName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or update a lab user. + /// + /// + /// Operation to create or update a lab user. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// The User registered to a lab + /// + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. /// /// /// Headers that will be added to request. @@ -514,7 +700,7 @@ internal UsersOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -529,35 +715,86 @@ internal UsersOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string userName, User user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(User body, string resourceGroupName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (labName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (userName == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } } - if (user == null) + if (userName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "user"); + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); } - if (Client.ApiVersion == null) + if (userName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (userName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "userName", 100); + } + if (userName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "userName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(userName, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "userName", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -566,20 +803,18 @@ internal UsersOperations(ManagedLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); - tracingParameters.Add("user", user); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}").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("{userName}", System.Uri.EscapeDataString(userName)); List _queryParameters = new List(); @@ -625,9 +860,9 @@ internal UsersOperations(ManagedLabsClient client) // Serialize Request string _requestContent = null; - if(user != null) + if(body != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(user, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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"); } @@ -651,16 +886,15 @@ internal UsersOperations(ManagedLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -670,10 +904,6 @@ internal UsersOperations(ManagedLabsClient client) } 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); @@ -729,6 +959,24 @@ internal UsersOperations(ManagedLabsClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -737,50 +985,24 @@ internal UsersOperations(ManagedLabsClient client) } /// - /// Delete user. This operation can take a while to complete + /// Update a lab user. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. - /// - /// - /// The name of the lab. - /// - /// - /// The name of the user. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. + /// + /// Operation to update a lab user. + /// + /// + /// The request body. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, userName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Modify properties of users. - /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// - /// The name of the user. - /// - /// - /// The User registered to a lab + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. /// /// /// Headers that will be added to request. @@ -788,7 +1010,7 @@ internal UsersOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -803,35 +1025,82 @@ internal UsersOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string userName, UserFragment user, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(UserUpdate body, string resourceGroupName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (labName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (userName == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } } - if (user == null) + if (userName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "user"); + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); } - if (Client.ApiVersion == null) + if (userName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (userName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "userName", 100); + } + if (userName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "userName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(userName, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "userName", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -840,20 +1109,18 @@ internal UsersOperations(ManagedLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); - tracingParameters.Add("user", user); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}").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("{userName}", System.Uri.EscapeDataString(userName)); List _queryParameters = new List(); @@ -899,9 +1166,9 @@ internal UsersOperations(ManagedLabsClient client) // Serialize Request string _requestContent = null; - if(user != null) + if(body != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(user, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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"); } @@ -925,16 +1192,15 @@ internal UsersOperations(ManagedLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -944,10 +1210,6 @@ internal UsersOperations(ManagedLabsClient client) } 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); @@ -985,6 +1247,24 @@ internal UsersOperations(ManagedLabsClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -993,19 +1273,21 @@ internal UsersOperations(ManagedLabsClient client) } /// - /// Delete user. This operation can take a while to complete + /// Deletes a user resource. /// + /// + /// Operation to delete a user resource. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// - /// The name of the user. + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. /// /// /// Headers that will be added to request. @@ -1013,7 +1295,7 @@ internal UsersOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1025,31 +1307,78 @@ internal UsersOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (labName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } + if (labName != null) + { + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } + } if (userName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "userName"); } - if (Client.ApiVersion == null) + if (userName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (userName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "userName", 100); + } + if (userName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "userName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(userName, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "userName", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1059,7 +1388,6 @@ internal UsersOperations(ManagedLabsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); tracingParameters.Add("labName", labName); tracingParameters.Add("userName", userName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -1067,10 +1395,9 @@ internal UsersOperations(ManagedLabsClient client) } // 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}/users/{userName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}").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("{userName}", System.Uri.EscapeDataString(userName)); List _queryParameters = new List(); @@ -1136,16 +1463,15 @@ internal UsersOperations(ManagedLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1155,10 +1481,255 @@ internal UsersOperations(ManagedLabsClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) + 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; + } + + /// + /// Invite a user to a lab. + /// + /// + /// Operation to invite a user to a lab. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + /// + /// 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 BeginInviteWithHttpMessagesAsync(InviteBody body, string resourceGroupName, string labName, string userName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (labName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "labName"); + } + if (labName != null) + { + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } + } + if (userName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userName"); + } + if (userName != null) + { + if (userName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "userName", 100); + } + if (userName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "userName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(userName, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "userName", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginInvite", 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/labs/{labName}/users/{userName}/invite").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _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(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + // Ignore the exception } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1186,8 +1757,11 @@ internal UsersOperations(ManagedLabsClient client) } /// - /// List users in a given lab. + /// Get all users for a lab. /// + /// + /// Returns a list of all users for a lab. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -1197,7 +1771,7 @@ internal UsersOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1212,7 +1786,7 @@ internal UsersOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByLabNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -1227,7 +1801,7 @@ internal UsersOperations(ManagedLabsClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByLabNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -1293,14 +1867,13 @@ internal UsersOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1310,10 +1883,6 @@ internal UsersOperations(ManagedLabsClient client) } 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); diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/UsersOperationsExtensions.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/UsersOperationsExtensions.cs index 33cc61e851d9..63600c2198ec 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/UsersOperationsExtensions.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/UsersOperationsExtensions.cs @@ -12,7 +12,6 @@ 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; @@ -23,346 +22,610 @@ namespace Microsoft.Azure.Management.LabServices public static partial class UsersOperationsExtensions { /// - /// List users in a given lab. + /// Get all users for a lab. /// + /// + /// Returns a list of all users for a lab. + /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// OData parameters to apply to the operation. + /// + /// The filter to apply to the operation. /// - public static IPage List(this IUsersOperations operations, string resourceGroupName, string labAccountName, string labName, ODataQuery odataQuery = default(ODataQuery)) + public static IPage ListByLab(this IUsersOperations operations, string resourceGroupName, string labName, string filter = default(string)) { - return operations.ListAsync(resourceGroupName, labAccountName, labName, odataQuery).GetAwaiter().GetResult(); + return operations.ListByLabAsync(resourceGroupName, labName, filter).GetAwaiter().GetResult(); } /// - /// List users in a given lab. + /// Get all users for a lab. /// + /// + /// Returns a list of all users for a lab. + /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// OData parameters to apply to the operation. + /// + /// The filter to apply to the operation. /// /// /// The cancellation token. /// - public static async Task> ListAsync(this IUsersOperations operations, string resourceGroupName, string labAccountName, string labName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByLabAsync(this IUsersOperations operations, string resourceGroupName, string labName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByLabWithHttpMessagesAsync(resourceGroupName, labName, filter, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Get user + /// Get a lab user. /// + /// + /// Returns the properties of a lab user. + /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// - /// The name of the user. + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. /// - /// - /// Specify the $expand query. Example: 'properties($select=email)' - /// - public static User Get(this IUsersOperations operations, string resourceGroupName, string labAccountName, string labName, string userName, string expand = default(string)) + public static User Get(this IUsersOperations operations, string resourceGroupName, string labName, string userName) { - return operations.GetAsync(resourceGroupName, labAccountName, labName, userName, expand).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, labName, userName).GetAwaiter().GetResult(); } /// - /// Get user + /// Get a lab user. /// + /// + /// Returns the properties of a lab user. + /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// - /// The name of the user. - /// - /// - /// Specify the $expand query. Example: 'properties($select=email)' + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. /// /// /// The cancellation token. /// - public static async Task GetAsync(this IUsersOperations operations, string resourceGroupName, string labAccountName, string labName, string userName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IUsersOperations operations, string resourceGroupName, string labName, string userName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, userName, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, userName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Create or replace an existing User. + /// Create or update a lab user. /// + /// + /// Operation to create or update a lab user. + /// /// /// The operations group for this extension method. /// + /// + /// The request body. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// The name of the lab Account. + /// + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + public static User CreateOrUpdate(this IUsersOperations operations, User body, string resourceGroupName, string labName, string userName) + { + return operations.CreateOrUpdateAsync(body, resourceGroupName, labName, userName).GetAwaiter().GetResult(); + } + + /// + /// Create or update a lab user. + /// + /// + /// Operation to create or update a lab user. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// - /// The name of the user. + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. /// - /// - /// The User registered to a lab + /// + /// The cancellation token. /// - public static User CreateOrUpdate(this IUsersOperations operations, string resourceGroupName, string labAccountName, string labName, string userName, User user) + public static async Task CreateOrUpdateAsync(this IUsersOperations operations, User body, string resourceGroupName, string labName, string userName, CancellationToken cancellationToken = default(CancellationToken)) { - return operations.CreateOrUpdateAsync(resourceGroupName, labAccountName, labName, userName, user).GetAwaiter().GetResult(); + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(body, resourceGroupName, labName, userName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Create or replace an existing User. + /// Update a lab user. /// + /// + /// Operation to update a lab user. + /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. + /// + /// The request body. /// - /// - /// The name of the lab Account. + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// - /// The name of the user. + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + public static User Update(this IUsersOperations operations, UserUpdate body, string resourceGroupName, string labName, string userName) + { + return operations.UpdateAsync(body, resourceGroupName, labName, userName).GetAwaiter().GetResult(); + } + + /// + /// Update a lab user. + /// + /// + /// Operation to update a lab user. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. /// - /// - /// The User registered to a lab + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IUsersOperations operations, string resourceGroupName, string labAccountName, string labName, string userName, User user, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IUsersOperations operations, UserUpdate body, string resourceGroupName, string labName, string userName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, userName, user, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(body, resourceGroupName, labName, userName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Delete user. This operation can take a while to complete + /// Deletes a user resource. /// + /// + /// Operation to delete a user resource. + /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// The name of the lab Account. + /// + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + public static void Delete(this IUsersOperations operations, string resourceGroupName, string labName, string userName) + { + operations.DeleteAsync(resourceGroupName, labName, userName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a user resource. + /// + /// + /// Operation to delete a user resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// - /// The name of the user. + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + /// + /// The cancellation token. /// - public static void Delete(this IUsersOperations operations, string resourceGroupName, string labAccountName, string labName, string userName) + public static async Task DeleteAsync(this IUsersOperations operations, string resourceGroupName, string labName, string userName, CancellationToken cancellationToken = default(CancellationToken)) { - operations.DeleteAsync(resourceGroupName, labAccountName, labName, userName).GetAwaiter().GetResult(); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Delete user. This operation can take a while to complete + /// Invite a user to a lab. /// + /// + /// Operation to invite a user to a lab. + /// /// /// The operations group for this extension method. /// + /// + /// The request body. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + public static void Invite(this IUsersOperations operations, InviteBody body, string resourceGroupName, string labName, string userName) + { + operations.InviteAsync(body, resourceGroupName, labName, userName).GetAwaiter().GetResult(); + } + + /// + /// Invite a user to a lab. + /// + /// + /// Operation to invite a user to a lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. /// - /// - /// The name of the lab Account. + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// - /// The name of the user. + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IUsersOperations operations, string resourceGroupName, string labAccountName, string labName, string userName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task InviteAsync(this IUsersOperations operations, InviteBody body, string resourceGroupName, string labName, string userName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, userName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.InviteWithHttpMessagesAsync(body, resourceGroupName, labName, userName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Modify properties of users. + /// Create or update a lab user. /// + /// + /// Operation to create or update a lab user. + /// /// /// The operations group for this extension method. /// + /// + /// The request body. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + public static User BeginCreateOrUpdate(this IUsersOperations operations, User body, string resourceGroupName, string labName, string userName) + { + return operations.BeginCreateOrUpdateAsync(body, resourceGroupName, labName, userName).GetAwaiter().GetResult(); + } + + /// + /// Create or update a lab user. + /// + /// + /// Operation to create or update a lab user. + /// + /// + /// The operations group for this extension method. /// - /// - /// The name of the lab Account. + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// - /// The name of the user. + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. /// - /// - /// The User registered to a lab + /// + /// The cancellation token. /// - public static User Update(this IUsersOperations operations, string resourceGroupName, string labAccountName, string labName, string userName, UserFragment user) + public static async Task BeginCreateOrUpdateAsync(this IUsersOperations operations, User body, string resourceGroupName, string labName, string userName, CancellationToken cancellationToken = default(CancellationToken)) { - return operations.UpdateAsync(resourceGroupName, labAccountName, labName, userName, user).GetAwaiter().GetResult(); + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(body, resourceGroupName, labName, userName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Modify properties of users. + /// Update a lab user. /// + /// + /// Operation to update a lab user. + /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. + /// + /// The request body. /// - /// - /// The name of the lab Account. + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// - /// The name of the user. + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + public static User BeginUpdate(this IUsersOperations operations, UserUpdate body, string resourceGroupName, string labName, string userName) + { + return operations.BeginUpdateAsync(body, resourceGroupName, labName, userName).GetAwaiter().GetResult(); + } + + /// + /// Update a lab user. + /// + /// + /// Operation to update a lab user. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. /// - /// - /// The User registered to a lab + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this IUsersOperations operations, string resourceGroupName, string labAccountName, string labName, string userName, UserFragment user, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginUpdateAsync(this IUsersOperations operations, UserUpdate body, string resourceGroupName, string labName, string userName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, userName, user, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(body, resourceGroupName, labName, userName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Delete user. This operation can take a while to complete + /// Deletes a user resource. /// + /// + /// Operation to delete a user resource. + /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + public static void BeginDelete(this IUsersOperations operations, string resourceGroupName, string labName, string userName) + { + operations.BeginDeleteAsync(resourceGroupName, labName, userName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a user resource. + /// + /// + /// Operation to delete a user resource. + /// + /// + /// The operations group for this extension method. /// - /// - /// The name of the lab Account. + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// - /// The name of the user. + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. /// - public static void BeginDelete(this IUsersOperations operations, string resourceGroupName, string labAccountName, string labName, string userName) + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IUsersOperations operations, string resourceGroupName, string labName, string userName, CancellationToken cancellationToken = default(CancellationToken)) { - operations.BeginDeleteAsync(resourceGroupName, labAccountName, labName, userName).GetAwaiter().GetResult(); + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labName, userName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Delete user. This operation can take a while to complete + /// Invite a user to a lab. /// + /// + /// Operation to invite a user to a lab. + /// /// /// The operations group for this extension method. /// + /// + /// The request body. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// The name of the lab Account. + /// + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. + /// + public static void BeginInvite(this IUsersOperations operations, InviteBody body, string resourceGroupName, string labName, string userName) + { + operations.BeginInviteAsync(body, resourceGroupName, labName, userName).GetAwaiter().GetResult(); + } + + /// + /// Invite a user to a lab. + /// + /// + /// Operation to invite a user to a lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// /// - /// The name of the user. + /// The name of the user that uniquely identifies it within containing lab. + /// Used in resource URIs. /// /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this IUsersOperations operations, string resourceGroupName, string labAccountName, string labName, string userName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginInviteAsync(this IUsersOperations operations, InviteBody body, string resourceGroupName, string labName, string userName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, userName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginInviteWithHttpMessagesAsync(body, resourceGroupName, labName, userName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// List users in a given lab. + /// Get all users for a lab. /// + /// + /// Returns a list of all users for a lab. + /// /// /// The operations group for this extension method. /// /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListNext(this IUsersOperations operations, string nextPageLink) + public static IPage ListByLabNext(this IUsersOperations operations, string nextPageLink) { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByLabNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// List users in a given lab. + /// Get all users for a lab. /// + /// + /// Returns a list of all users for a lab. + /// /// /// The operations group for this extension method. /// @@ -372,9 +635,9 @@ public static IPage ListNext(this IUsersOperations operations, string next /// /// The cancellation token. /// - public static async Task> ListNextAsync(this IUsersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByLabNextAsync(this IUsersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByLabNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/EnvironmentSettingsOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/VirtualMachinesOperations.cs similarity index 61% rename from sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/EnvironmentSettingsOperations.cs rename to sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/VirtualMachinesOperations.cs index 3864a0841d8e..faa12590f8f1 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/EnvironmentSettingsOperations.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/VirtualMachinesOperations.cs @@ -12,7 +12,6 @@ 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; @@ -24,12 +23,12 @@ namespace Microsoft.Azure.Management.LabServices using System.Threading.Tasks; /// - /// EnvironmentSettingsOperations operations. + /// VirtualMachinesOperations operations. /// - internal partial class EnvironmentSettingsOperations : IServiceOperations, IEnvironmentSettingsOperations + internal partial class VirtualMachinesOperations : IServiceOperations, IVirtualMachinesOperations { /// - /// Initializes a new instance of the EnvironmentSettingsOperations class. + /// Initializes a new instance of the VirtualMachinesOperations class. /// /// /// Reference to the service client. @@ -37,7 +36,7 @@ internal partial class EnvironmentSettingsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal EnvironmentSettingsOperations(ManagedLabsClient client) + internal VirtualMachinesOperations(LabServicesClient client) { if (client == null) { @@ -47,24 +46,25 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) } /// - /// Gets a reference to the ManagedLabsClient + /// Gets a reference to the LabServicesClient /// - public ManagedLabsClient Client { get; private set; } + public LabServicesClient Client { get; private set; } /// - /// List environment setting in a given lab. + /// Get all virtual machines for a lab. /// + /// + /// Returns a list of all virtual machines for a lab. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// OData parameters to apply to the operation. + /// + /// The filter to apply to the operation. /// /// /// Headers that will be added to request. @@ -72,7 +72,7 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -87,27 +87,59 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByLabWithHttpMessagesAsync(string resourceGroupName, string labName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (labName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (Client.ApiVersion == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -116,33 +148,27 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) { _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("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByLab", 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").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines").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)); 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 (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -203,14 +229,13 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -220,10 +245,6 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) } 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); @@ -236,7 +257,7 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -249,7 +270,7 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -269,22 +290,21 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) } /// - /// Get environment setting + /// Get a lab virtual machine. /// + /// + /// Returns the properties for a lab virtual machine. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// The name of the environment Setting. - /// - /// - /// Specify the $expand query. Example: 'properties($select=publishingState)' + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. /// /// /// Headers that will be added to request. @@ -292,7 +312,7 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -307,31 +327,78 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (labName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (environmentSettingName == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "environmentSettingName"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } } - if (Client.ApiVersion == null) + if (virtualMachineName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineName"); + } + if (virtualMachineName != null) + { + if (virtualMachineName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "virtualMachineName", 100); + } + if (virtualMachineName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "virtualMachineName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(virtualMachineName, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "virtualMachineName", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -341,26 +408,19 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) _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("expand", expand); + tracingParameters.Add("virtualMachineName", virtualMachineName); 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}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}").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("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); 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))); @@ -425,14 +485,13 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -442,10 +501,6 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) } 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); @@ -458,7 +513,7 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -471,7 +526,7 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -491,24 +546,21 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) } /// - /// Create or replace an existing Environment Setting. This operation can take - /// a while to complete + /// Start a lab virtual machine. /// + /// + /// Action to start a lab virtual machine. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. - /// - /// - /// The name of the environment Setting. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// Represents settings of an environment, from which environment instances - /// would be created + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. /// /// /// The headers that will be added to request. @@ -516,27 +568,29 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, EnvironmentSetting environmentSetting, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task StartWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Delete environment setting. This operation can take a while to complete + /// Stop a lab virtual machine. /// + /// + /// Action to stop a lab virtual machine. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// The name of the environment Setting. + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. /// /// /// The headers that will be added to request. @@ -544,453 +598,126 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task StopWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Modify properties of environment setting. + /// Re-image a lab virtual machine. /// + /// + /// Re-image a lab virtual machine. The virtual machine will be deleted and + /// recreated using the latest published snapshot of the reference environment + /// of the lab. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. - /// - /// - /// The name of the environment Setting. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// Represents settings of an environment, from which environment instances - /// would be created + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. /// /// - /// Headers that will be added to request. + /// 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 - /// - /// - /// 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, EnvironmentSettingFragment environmentSetting, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task ReimageWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, 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 (environmentSetting == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "environmentSetting"); - } - 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("environmentSetting", environmentSetting); - 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}").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 (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(environmentSetting != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(environmentSetting, 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; + // Send request + AzureOperationResponse _response = await BeginReimageWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Claims a random environment for a user in an environment settings + /// Redeploy a lab virtual machine to a different compute node. For + /// troubleshooting connectivity. /// + /// + /// Action to redeploy a lab virtual machine to a different compute node. For + /// troubleshooting connectivity. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// The name of the environment Setting. + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. /// /// - /// Headers that will be added to request. + /// 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 - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task ClaimAnyWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task RedeployWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, 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("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); - tracingParameters.Add("labName", labName); - tracingParameters.Add("environmentSettingName", environmentSettingName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ClaimAny", 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}/claimAny").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 (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; + // Send request + AzureOperationResponse _response = await BeginRedeployWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Provisions/deprovisions required resources for an environment setting based - /// on current state of the lab/environment setting. + /// Reset a lab virtual machine password. /// - /// - /// The name of the resource group. + /// + /// Resets a lab virtual machine password. + /// + /// + /// The request body. /// - /// - /// The name of the lab Account. + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ResetPasswordWithHttpMessagesAsync(ResetPasswordBody body, string resourceGroupName, string labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginResetPasswordWithHttpMessagesAsync(body, resourceGroupName, labName, virtualMachineName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Start a lab virtual machine. + /// + /// + /// Action to start a lab virtual machine. + /// + /// + /// The name of the resource group. The name is case insensitive. /// - /// - /// The name of the environment Setting. + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// Payload for Publish operation on EnvironmentSetting. + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. /// /// /// Headers that will be added to request. @@ -998,7 +725,7 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1010,35 +737,78 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task PublishWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, PublishPayload publishPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (labName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (environmentSettingName == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "environmentSettingName"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } } - if (publishPayload == null) + if (virtualMachineName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "publishPayload"); + throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineName"); } - if (Client.ApiVersion == null) + if (virtualMachineName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (virtualMachineName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "virtualMachineName", 100); + } + if (virtualMachineName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "virtualMachineName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(virtualMachineName, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "virtualMachineName", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1048,21 +818,18 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) _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("publishPayload", publishPayload); + tracingParameters.Add("virtualMachineName", virtualMachineName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Publish", tracingParameters); + 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}/publish").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/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("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -1106,12 +873,6 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) // Serialize Request string _requestContent = null; - if(publishPayload != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(publishPayload, 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) { @@ -1132,16 +893,15 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1151,10 +911,6 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) } 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); @@ -1182,82 +938,21 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) } /// - /// 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. - /// - public async Task StartWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// 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. - /// - public async Task StopWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(resourceGroupName, labAccountName, labName, environmentSettingName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Create or replace an existing Environment Setting. This operation can take - /// a while to complete + /// Stop a lab virtual machine. /// + /// + /// Action to stop a lab virtual machine. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. - /// - /// - /// The name of the environment Setting. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// Represents settings of an environment, from which environment instances - /// would be created + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. /// /// /// Headers that will be added to request. @@ -1265,12 +960,9 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) /// /// 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 /// @@ -1280,39 +972,78 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, EnvironmentSetting environmentSetting, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginStopWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (labName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (environmentSettingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "environmentSettingName"); - } - if (environmentSetting == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "environmentSetting"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } } - if (environmentSetting != null) + if (virtualMachineName == null) { - environmentSetting.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineName"); } - if (Client.ApiVersion == null) + if (virtualMachineName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (virtualMachineName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "virtualMachineName", 100); + } + if (virtualMachineName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "virtualMachineName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(virtualMachineName, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "virtualMachineName", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1322,21 +1053,18 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) _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("environmentSetting", environmentSetting); + tracingParameters.Add("virtualMachineName", virtualMachineName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + 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}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/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("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -1349,7 +1077,7 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1380,12 +1108,6 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) // Serialize Request string _requestContent = null; - if(environmentSetting != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(environmentSetting, 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) { @@ -1406,16 +1128,15 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1425,10 +1146,6 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) } 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); @@ -1441,49 +1158,13 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _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); @@ -1492,19 +1173,23 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) } /// - /// Delete environment setting. This operation can take a while to complete + /// Re-image a lab virtual machine. /// + /// + /// Re-image a lab virtual machine. The virtual machine will be deleted and + /// recreated using the latest published snapshot of the reference environment + /// of the lab. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// The name of the environment Setting. + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. /// /// /// Headers that will be added to request. @@ -1512,7 +1197,7 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1524,31 +1209,78 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginReimageWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (labName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (environmentSettingName == null) + if (labName != null) + { + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } + } + if (virtualMachineName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "environmentSettingName"); + throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineName"); } - if (Client.ApiVersion == null) + if (virtualMachineName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (virtualMachineName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "virtualMachineName", 100); + } + if (virtualMachineName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "virtualMachineName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(virtualMachineName, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "virtualMachineName", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1558,20 +1290,18 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) _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("virtualMachineName", virtualMachineName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginReimage", 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}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/reimage").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("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -1584,7 +1314,7 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1635,16 +1365,15 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1654,10 +1383,6 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) } 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); @@ -1685,20 +1410,23 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) } /// - /// Starts a template by starting all resources inside the template. This - /// operation can take a while to complete + /// Redeploy a lab virtual machine to a different compute node. For + /// troubleshooting connectivity. /// + /// + /// Action to redeploy a lab virtual machine to a different compute node. For + /// troubleshooting connectivity. + /// /// - /// The name of the resource group. - /// - /// - /// The name of the lab Account. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// The name of the environment Setting. + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. /// /// /// Headers that will be added to request. @@ -1706,7 +1434,7 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1718,31 +1446,78 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginRedeployWithHttpMessagesAsync(string resourceGroupName, string labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (labName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (environmentSettingName == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "environmentSettingName"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } } - if (Client.ApiVersion == null) + if (virtualMachineName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineName"); + } + if (virtualMachineName != null) + { + if (virtualMachineName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "virtualMachineName", 100); + } + if (virtualMachineName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "virtualMachineName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(virtualMachineName, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "virtualMachineName", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1752,20 +1527,18 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) _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("virtualMachineName", virtualMachineName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginStart", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginRedeploy", 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}/start").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/redeploy").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("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -1831,14 +1604,13 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 202) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1848,10 +1620,6 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) } 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); @@ -1879,20 +1647,24 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) } /// - /// Starts a template by starting all resources inside the template. This - /// operation can take a while to complete + /// Reset a lab virtual machine password. /// - /// - /// The name of the resource group. + /// + /// Resets a lab virtual machine password. + /// + /// + /// The request body. /// - /// - /// The name of the lab Account. + /// + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the lab. + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. /// - /// - /// The name of the environment Setting. + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. /// /// /// Headers that will be added to request. @@ -1900,7 +1672,7 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1912,31 +1684,86 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginStopWithHttpMessagesAsync(string resourceGroupName, string labAccountName, string labName, string environmentSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginResetPasswordWithHttpMessagesAsync(ResetPasswordBody body, string resourceGroupName, string labName, string virtualMachineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (labAccountName == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "labAccountName"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (labName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "labName"); } - if (environmentSettingName == null) + if (labName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "environmentSettingName"); + if (labName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "labName", 100); + } + if (labName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "labName", 1); + } } - if (Client.ApiVersion == null) + if (virtualMachineName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineName"); + } + if (virtualMachineName != null) + { + if (virtualMachineName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "virtualMachineName", 100); + } + if (virtualMachineName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "virtualMachineName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(virtualMachineName, "^[-\\w\\\\._\\\\(\\\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "virtualMachineName", "^[-\\w\\\\._\\\\(\\\\)]+$"); + } } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1945,21 +1772,20 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("labAccountName", labAccountName); tracingParameters.Add("labName", labName); - tracingParameters.Add("environmentSettingName", environmentSettingName); + tracingParameters.Add("virtualMachineName", virtualMachineName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginStop", tracingParameters); + 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}/stop").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/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("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -2003,6 +1829,12 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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) { @@ -2025,14 +1857,13 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 202) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2042,10 +1873,6 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) } 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); @@ -2073,8 +1900,11 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) } /// - /// List environment setting in a given lab. + /// Get all virtual machines for a lab. /// + /// + /// Returns a list of all virtual machines for a lab. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -2084,7 +1914,7 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -2099,7 +1929,7 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByLabNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2114,7 +1944,7 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByLabNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2180,14 +2010,13 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2197,10 +2026,6 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) } 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); @@ -2213,7 +2038,7 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2226,7 +2051,7 @@ internal EnvironmentSettingsOperations(ManagedLabsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/VirtualMachinesOperationsExtensions.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/VirtualMachinesOperationsExtensions.cs new file mode 100644 index 000000000000..c69ddc1badec --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/VirtualMachinesOperationsExtensions.cs @@ -0,0 +1,733 @@ +// +// 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 VirtualMachinesOperations. + /// + public static partial class VirtualMachinesOperationsExtensions + { + /// + /// Get all virtual machines for a lab. + /// + /// + /// Returns a list of all virtual machines for a lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The filter to apply to the operation. + /// + public static IPage ListByLab(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string filter = default(string)) + { + return operations.ListByLabAsync(resourceGroupName, labName, filter).GetAwaiter().GetResult(); + } + + /// + /// Get all virtual machines for a lab. + /// + /// + /// Returns a list of all virtual machines for a lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The filter to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLabAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLabWithHttpMessagesAsync(resourceGroupName, labName, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a lab virtual machine. + /// + /// + /// Returns the properties for a lab virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + public static VirtualMachine Get(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string virtualMachineName) + { + return operations.GetAsync(resourceGroupName, labName, virtualMachineName).GetAwaiter().GetResult(); + } + + /// + /// Get a lab virtual machine. + /// + /// + /// Returns the properties for a lab virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string virtualMachineName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Start a lab virtual machine. + /// + /// + /// Action to start a lab virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + public static void Start(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string virtualMachineName) + { + operations.StartAsync(resourceGroupName, labName, virtualMachineName).GetAwaiter().GetResult(); + } + + /// + /// Start a lab virtual machine. + /// + /// + /// Action to start a lab virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + /// + /// The cancellation token. + /// + public static async Task StartAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string virtualMachineName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Stop a lab virtual machine. + /// + /// + /// Action to stop a lab virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + public static void Stop(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string virtualMachineName) + { + operations.StopAsync(resourceGroupName, labName, virtualMachineName).GetAwaiter().GetResult(); + } + + /// + /// Stop a lab virtual machine. + /// + /// + /// Action to stop a lab virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + /// + /// The cancellation token. + /// + public static async Task StopAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string virtualMachineName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StopWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Re-image a lab virtual machine. + /// + /// + /// Re-image a lab virtual machine. The virtual machine will be deleted and + /// recreated using the latest published snapshot of the reference environment + /// of the lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + public static void Reimage(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string virtualMachineName) + { + operations.ReimageAsync(resourceGroupName, labName, virtualMachineName).GetAwaiter().GetResult(); + } + + /// + /// Re-image a lab virtual machine. + /// + /// + /// Re-image a lab virtual machine. The virtual machine will be deleted and + /// recreated using the latest published snapshot of the reference environment + /// of the lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + /// + /// The cancellation token. + /// + public static async Task ReimageAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string virtualMachineName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReimageWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Redeploy a lab virtual machine to a different compute node. For + /// troubleshooting connectivity. + /// + /// + /// Action to redeploy a lab virtual machine to a different compute node. For + /// troubleshooting connectivity. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + public static void Redeploy(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string virtualMachineName) + { + operations.RedeployAsync(resourceGroupName, labName, virtualMachineName).GetAwaiter().GetResult(); + } + + /// + /// Redeploy a lab virtual machine to a different compute node. For + /// troubleshooting connectivity. + /// + /// + /// Action to redeploy a lab virtual machine to a different compute node. For + /// troubleshooting connectivity. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + /// + /// The cancellation token. + /// + public static async Task RedeployAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string virtualMachineName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RedeployWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reset a lab virtual machine password. + /// + /// + /// Resets a lab virtual machine password. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + public static void ResetPassword(this IVirtualMachinesOperations operations, ResetPasswordBody body, string resourceGroupName, string labName, string virtualMachineName) + { + operations.ResetPasswordAsync(body, resourceGroupName, labName, virtualMachineName).GetAwaiter().GetResult(); + } + + /// + /// Reset a lab virtual machine password. + /// + /// + /// Resets a lab virtual machine password. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + /// + /// The cancellation token. + /// + public static async Task ResetPasswordAsync(this IVirtualMachinesOperations operations, ResetPasswordBody body, string resourceGroupName, string labName, string virtualMachineName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ResetPasswordWithHttpMessagesAsync(body, resourceGroupName, labName, virtualMachineName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Start a lab virtual machine. + /// + /// + /// Action to start a lab virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + public static void BeginStart(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string virtualMachineName) + { + operations.BeginStartAsync(resourceGroupName, labName, virtualMachineName).GetAwaiter().GetResult(); + } + + /// + /// Start a lab virtual machine. + /// + /// + /// Action to start a lab virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string virtualMachineName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Stop a lab virtual machine. + /// + /// + /// Action to stop a lab virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + public static void BeginStop(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string virtualMachineName) + { + operations.BeginStopAsync(resourceGroupName, labName, virtualMachineName).GetAwaiter().GetResult(); + } + + /// + /// Stop a lab virtual machine. + /// + /// + /// Action to stop a lab virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStopAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string virtualMachineName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStopWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Re-image a lab virtual machine. + /// + /// + /// Re-image a lab virtual machine. The virtual machine will be deleted and + /// recreated using the latest published snapshot of the reference environment + /// of the lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + public static void BeginReimage(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string virtualMachineName) + { + operations.BeginReimageAsync(resourceGroupName, labName, virtualMachineName).GetAwaiter().GetResult(); + } + + /// + /// Re-image a lab virtual machine. + /// + /// + /// Re-image a lab virtual machine. The virtual machine will be deleted and + /// recreated using the latest published snapshot of the reference environment + /// of the lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReimageAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string virtualMachineName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReimageWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Redeploy a lab virtual machine to a different compute node. For + /// troubleshooting connectivity. + /// + /// + /// Action to redeploy a lab virtual machine to a different compute node. For + /// troubleshooting connectivity. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + public static void BeginRedeploy(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string virtualMachineName) + { + operations.BeginRedeployAsync(resourceGroupName, labName, virtualMachineName).GetAwaiter().GetResult(); + } + + /// + /// Redeploy a lab virtual machine to a different compute node. For + /// troubleshooting connectivity. + /// + /// + /// Action to redeploy a lab virtual machine to a different compute node. For + /// troubleshooting connectivity. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRedeployAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string labName, string virtualMachineName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRedeployWithHttpMessagesAsync(resourceGroupName, labName, virtualMachineName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reset a lab virtual machine password. + /// + /// + /// Resets a lab virtual machine password. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + public static void BeginResetPassword(this IVirtualMachinesOperations operations, ResetPasswordBody body, string resourceGroupName, string labName, string virtualMachineName) + { + operations.BeginResetPasswordAsync(body, resourceGroupName, labName, virtualMachineName).GetAwaiter().GetResult(); + } + + /// + /// Reset a lab virtual machine password. + /// + /// + /// Resets a lab virtual machine password. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The request body. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the lab that uniquely identifies it within containing lab + /// account. Used in resource URIs. + /// + /// + /// The ID of the virtual machine that uniquely identifies it within the + /// containing lab. Used in resource URIs. + /// + /// + /// The cancellation token. + /// + public static async Task BeginResetPasswordAsync(this IVirtualMachinesOperations operations, ResetPasswordBody body, string resourceGroupName, string labName, string virtualMachineName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginResetPasswordWithHttpMessagesAsync(body, resourceGroupName, labName, virtualMachineName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get all virtual machines for a lab. + /// + /// + /// Returns a list of all virtual machines for a lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByLabNext(this IVirtualMachinesOperations operations, string nextPageLink) + { + return operations.ListByLabNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all virtual machines for a lab. + /// + /// + /// Returns a list of all virtual machines for a 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> ListByLabNextAsync(this IVirtualMachinesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLabNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/swagger_to_sdk_config.json b/swagger_to_sdk_config.json index dae7c82a86b1..97a9ffd5c981 100644 --- a/swagger_to_sdk_config.json +++ b/swagger_to_sdk_config.json @@ -6,8 +6,8 @@ "csharp": "", "reflect-api-versions": "", "license-header": "MICROSOFT_MIT_NO_VERSION", - "sdkrel:csharp-sdks-folder": "./sdk", - "use": "@microsoft.azure/autorest.csharp@2.3.82" + "use": "@microsoft.azure/autorest.csharp@2.3.84", + "sdkrel:csharp-sdks-folder": "./sdk" }, "advanced_options": { "create_sdk_pull_requests": true, @@ -15,5 +15,10 @@ "main_branch": "master" }, "version": "0.2.0" + }, + "generateOptions": { + "genearteScript": { + "path": "autorest" + } } } diff --git a/swagger_to_sdk_config_track2.json b/swagger_to_sdk_config_track2.json new file mode 100644 index 000000000000..4ac96bc4d294 --- /dev/null +++ b/swagger_to_sdk_config_track2.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://raw.githubusercontent.com/lmazuel/swagger-to-sdk/master/swagger_to_sdk_config.schema.json", + "meta": { + "autorest_options": { + "csharp": "", + "reflect-api-versions": "", + "use": "https://github.com/Azure/autorest.csharp/releases/download/3.0.0-dev.20200617.1/autorest-csharp-v3-3.0.0-dev.20200617.1.tgz", + "license-header": "MICROSOFT_MIT_NO_VERSION", + "sdkrel:csharp-sdks-folder": "./sdk" + }, + "advanced_options": { + "create_sdk_pull_requests": true, + "sdk_generation_pull_request_base": "integration_branch", + "main_branch": "master" + }, + "version": "0.2.0" + } +}