diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/DevTestLabs.Management.Sdk.csproj b/src/DevTestLabs/DevTestLabs.Management.Sdk/DevTestLabs.Management.Sdk.csproj new file mode 100644 index 000000000000..441a3ab82e71 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/DevTestLabs.Management.Sdk.csproj @@ -0,0 +1,13 @@ + + + DevTestLabs + + + + netstandard2.0 + Microsoft.Azure.PowerShell.DevTestLabs.Management.Sdk + Microsoft.Azure.Management.DevTestLabs + $(NoWarn);CS0108;CS1573 + + + \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperations.cs new file mode 100644 index 000000000000..62e80ed87c18 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperations.cs @@ -0,0 +1,694 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// ArmTemplatesOperations operations. + /// + internal partial class ArmTemplatesOperations : Microsoft.Rest.IServiceOperations, IArmTemplatesOperations + { + /// + /// Initializes a new instance of the ArmTemplatesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ArmTemplatesOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string artifactSourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (artifactSourceName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifactSourceName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("labName", labName); + tracingParameters.Add("artifactSourceName", artifactSourceName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _armTemplate = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_armTemplate)) + { + _queryParameters.Add(_armTemplate); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get azure resource manager template. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the azure Resource Manager template. + /// + /// + /// Specify the $expand query. Example: 'properties($select=displayName)' + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string artifactSourceName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (artifactSourceName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifactSourceName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("artifactSourceName", artifactSourceName); + tracingParameters.Add("name", name); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperationsExtensions.cs new file mode 100644 index 000000000000..60f209d3956a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArmTemplatesOperationsExtensions.cs @@ -0,0 +1,145 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for ArmTemplatesOperations + /// + public static partial class ArmTemplatesOperationsExtensions + { + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + public static Microsoft.Rest.Azure.IPage List(this IArmTemplatesOperations operations, string labName, string artifactSourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IArmTemplatesOperations)operations).ListAsync(labName, artifactSourceName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IArmTemplatesOperations operations, string labName, string artifactSourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, artifactSourceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get azure resource manager template. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the azure Resource Manager template. + /// + /// + /// Specify the $expand query. Example: 'properties($select=displayName)' + /// + public static ArmTemplate Get(this IArmTemplatesOperations operations, string labName, string artifactSourceName, string name, string expand = default(string)) + { + return ((IArmTemplatesOperations)operations).GetAsync(labName, artifactSourceName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get azure resource manager template. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the azure Resource Manager template. + /// + /// + /// Specify the $expand query. Example: 'properties($select=displayName)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IArmTemplatesOperations operations, string labName, string artifactSourceName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, artifactSourceName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IArmTemplatesOperations operations, string nextPageLink) + { + return ((IArmTemplatesOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IArmTemplatesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperations.cs new file mode 100644 index 000000000000..c73819554573 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperations.cs @@ -0,0 +1,1357 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// ArtifactSourcesOperations operations. + /// + internal partial class ArtifactSourcesOperations : Microsoft.Rest.IServiceOperations, IArtifactSourcesOperations + { + /// + /// Initializes a new instance of the ArtifactSourcesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ArtifactSourcesOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List artifact sources in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("labName", labName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _artifactSource = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_artifactSource)) + { + _queryParameters.Add(_artifactSource); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get artifact source. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Specify the $expand query. Example: 'properties($select=displayName)' + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing artifact source. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Properties of an artifact source. + /// + /// + /// 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 System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, ArtifactSource artifactSource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (artifactSource == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifactSource"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("artifactSource", artifactSource); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(artifactSource != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(artifactSource, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete artifact source. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// 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 System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Modify properties of artifact sources. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Properties of an artifact source. + /// + /// + /// 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 System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, ArtifactSourceFragment artifactSource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (artifactSource == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifactSource"); + } + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("artifactSource", artifactSource); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(artifactSource != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(artifactSource, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List artifact sources in a given lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperationsExtensions.cs new file mode 100644 index 000000000000..dbdb07eb7027 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactSourcesOperationsExtensions.cs @@ -0,0 +1,247 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for ArtifactSourcesOperations + /// + public static partial class ArtifactSourcesOperationsExtensions + { + /// + /// List artifact sources in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this IArtifactSourcesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IArtifactSourcesOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List artifact sources in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IArtifactSourcesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Specify the $expand query. Example: 'properties($select=displayName)' + /// + public static ArtifactSource Get(this IArtifactSourcesOperations operations, string labName, string name, string expand = default(string)) + { + return ((IArtifactSourcesOperations)operations).GetAsync(labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Specify the $expand query. Example: 'properties($select=displayName)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IArtifactSourcesOperations operations, string labName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + public static ArtifactSource CreateOrUpdate(this IArtifactSourcesOperations operations, string labName, string name, ArtifactSource artifactSource) + { + return ((IArtifactSourcesOperations)operations).CreateOrUpdateAsync(labName, name, artifactSource).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IArtifactSourcesOperations operations, string labName, string name, ArtifactSource artifactSource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, artifactSource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + public static void Delete(this IArtifactSourcesOperations operations, string labName, string name) + { + ((IArtifactSourcesOperations)operations).DeleteAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IArtifactSourcesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of artifact sources. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + public static ArtifactSource Update(this IArtifactSourcesOperations operations, string labName, string name, ArtifactSourceFragment artifactSource) + { + return ((IArtifactSourcesOperations)operations).UpdateAsync(labName, name, artifactSource).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of artifact sources. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IArtifactSourcesOperations operations, string labName, string name, ArtifactSourceFragment artifactSource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, artifactSource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List artifact sources in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IArtifactSourcesOperations operations, string nextPageLink) + { + return ((IArtifactSourcesOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List artifact sources 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 System.Threading.Tasks.Task> ListNextAsync(this IArtifactSourcesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperations.cs new file mode 100644 index 000000000000..917843baaf73 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperations.cs @@ -0,0 +1,939 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// ArtifactsOperations operations. + /// + internal partial class ArtifactsOperations : Microsoft.Rest.IServiceOperations, IArtifactsOperations + { + /// + /// Initializes a new instance of the ArtifactsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ArtifactsOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List artifacts in a given artifact source. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string artifactSourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (artifactSourceName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifactSourceName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("labName", labName); + tracingParameters.Add("artifactSourceName", artifactSourceName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _artifact = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_artifact)) + { + _queryParameters.Add(_artifact); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get artifact. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + /// + /// Specify the $expand query. Example: 'properties($select=title)' + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string artifactSourceName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (artifactSourceName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifactSourceName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("artifactSourceName", artifactSourceName); + tracingParameters.Add("name", name); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Generates an ARM template for the given artifact, uploads the required + /// files to a storage account, and validates the generated artifact. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + /// + /// Parameters for generating an ARM template for deploying artifacts. + /// + /// + /// 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 System.Threading.Tasks.Task> GenerateArmTemplateWithHttpMessagesAsync(string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (generateArmTemplateRequest == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "generateArmTemplateRequest"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (artifactSourceName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "artifactSourceName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("artifactSourceName", artifactSourceName); + tracingParameters.Add("name", name); + + tracingParameters.Add("generateArmTemplateRequest", generateArmTemplateRequest); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GenerateArmTemplate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{artifactSourceName}", System.Uri.EscapeDataString(artifactSourceName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(generateArmTemplateRequest != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(generateArmTemplateRequest, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List artifacts in a given artifact source. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs new file mode 100644 index 000000000000..f20f0c577fae --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ArtifactsOperationsExtensions.cs @@ -0,0 +1,192 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for ArtifactsOperations + /// + public static partial class ArtifactsOperationsExtensions + { + /// + /// List artifacts in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + public static Microsoft.Rest.Azure.IPage List(this IArtifactsOperations operations, string labName, string artifactSourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IArtifactsOperations)operations).ListAsync(labName, artifactSourceName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List artifacts in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IArtifactsOperations operations, string labName, string artifactSourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, artifactSourceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + /// + /// Specify the $expand query. Example: 'properties($select=title)' + /// + public static Artifact Get(this IArtifactsOperations operations, string labName, string artifactSourceName, string name, string expand = default(string)) + { + return ((IArtifactsOperations)operations).GetAsync(labName, artifactSourceName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + /// + /// Specify the $expand query. Example: 'properties($select=title)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IArtifactsOperations operations, string labName, string artifactSourceName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, artifactSourceName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Generates an ARM template for the given artifact, uploads the required + /// files to a storage account, and validates the generated artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + public static ArmTemplateInfo GenerateArmTemplate(this IArtifactsOperations operations, string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest) + { + return ((IArtifactsOperations)operations).GenerateArmTemplateAsync(labName, artifactSourceName, name, generateArmTemplateRequest).GetAwaiter().GetResult(); + } + + /// + /// Generates an ARM template for the given artifact, uploads the required + /// files to a storage account, and validates the generated artifact. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GenerateArmTemplateAsync(this IArtifactsOperations operations, string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GenerateArmTemplateWithHttpMessagesAsync(labName, artifactSourceName, name, generateArmTemplateRequest, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List artifacts in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IArtifactsOperations operations, string nextPageLink) + { + return ((IArtifactsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List artifacts in a given artifact source. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IArtifactsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperations.cs new file mode 100644 index 000000000000..be53e319f202 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperations.cs @@ -0,0 +1,522 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// CostsOperations operations. + /// + internal partial class CostsOperations : Microsoft.Rest.IServiceOperations, ICostsOperations + { + /// + /// Initializes a new instance of the CostsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CostsOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// Get cost. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// Specify the $expand query. Example: 'properties($expand=labCostDetails)' + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing cost. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// A cost item. + /// + /// + /// 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 System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabCost labCost, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (labCost == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labCost"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("labCost", labCost); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(labCost != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(labCost, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperationsExtensions.cs new file mode 100644 index 000000000000..2f72402025ab --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CostsOperationsExtensions.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for CostsOperations + /// + public static partial class CostsOperationsExtensions + { + /// + /// Get cost. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// Specify the $expand query. Example: 'properties($expand=labCostDetails)' + /// + public static LabCost Get(this ICostsOperations operations, string labName, string name, string expand = default(string)) + { + return ((ICostsOperations)operations).GetAsync(labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get cost. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// Specify the $expand query. Example: 'properties($expand=labCostDetails)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this ICostsOperations operations, string labName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing cost. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + public static LabCost CreateOrUpdate(this ICostsOperations operations, string labName, string name, LabCost labCost) + { + return ((ICostsOperations)operations).CreateOrUpdateAsync(labName, name, labCost).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing cost. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this ICostsOperations operations, string labName, string name, LabCost labCost, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, labCost, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperations.cs new file mode 100644 index 000000000000..7dd972eb8d56 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperations.cs @@ -0,0 +1,1176 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// CustomImagesOperations operations. + /// + internal partial class CustomImagesOperations : Microsoft.Rest.IServiceOperations, ICustomImagesOperations + { + /// + /// Initializes a new instance of the CustomImagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CustomImagesOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List custom images in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("labName", labName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _customImage = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_customImage)) + { + _queryParameters.Add(_customImage); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get custom image. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// Specify the $expand query. Example: 'properties($select=vm)' + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// A custom image. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, CustomImage customImage, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, customImage, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// A custom image. + /// + /// + /// 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 System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, CustomImage customImage, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (customImage == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "customImage"); + } + if (customImage != null) + { + customImage.Validate(); + } + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("customImage", customImage); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(customImage != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(customImage, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// 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 System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List custom images in a given lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperationsExtensions.cs new file mode 100644 index 000000000000..191912f05c85 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/CustomImagesOperationsExtensions.cs @@ -0,0 +1,287 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for CustomImagesOperations + /// + public static partial class CustomImagesOperationsExtensions + { + /// + /// List custom images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this ICustomImagesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((ICustomImagesOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List custom images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this ICustomImagesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get custom image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// Specify the $expand query. Example: 'properties($select=vm)' + /// + public static CustomImage Get(this ICustomImagesOperations operations, string labName, string name, string expand = default(string)) + { + return ((ICustomImagesOperations)operations).GetAsync(labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get custom image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// Specify the $expand query. Example: 'properties($select=vm)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this ICustomImagesOperations operations, string labName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + public static CustomImage CreateOrUpdate(this ICustomImagesOperations operations, string labName, string name, CustomImage customImage) + { + return ((ICustomImagesOperations)operations).CreateOrUpdateAsync(labName, name, customImage).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this ICustomImagesOperations operations, string labName, string name, CustomImage customImage, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, customImage, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + public static void Delete(this ICustomImagesOperations operations, string labName, string name) + { + ((ICustomImagesOperations)operations).DeleteAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this ICustomImagesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + public static CustomImage BeginCreateOrUpdate(this ICustomImagesOperations operations, string labName, string name, CustomImage customImage) + { + return ((ICustomImagesOperations)operations).BeginCreateOrUpdateAsync(labName, name, customImage).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this ICustomImagesOperations operations, string labName, string name, CustomImage customImage, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, customImage, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + public static void BeginDelete(this ICustomImagesOperations operations, string labName, string name) + { + ((ICustomImagesOperations)operations).BeginDeleteAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this ICustomImagesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List custom images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this ICustomImagesOperations operations, string nextPageLink) + { + return ((ICustomImagesOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List custom images 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 System.Threading.Tasks.Task> ListNextAsync(this ICustomImagesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DevTestLabsClient.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DevTestLabsClient.cs new file mode 100644 index 000000000000..85a2515694f5 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DevTestLabsClient.cs @@ -0,0 +1,454 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// The DevTest Labs Client. + /// + public partial class DevTestLabsClient : Microsoft.Rest.ServiceClient, IDevTestLabsClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + /// + /// Gets or sets json serialization settings. + /// + public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; } + /// + /// Gets or sets json deserialization settings. + /// + public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; } + /// + /// Credentials needed for the client to connect to Azure. + /// + public Microsoft.Rest.ServiceClientCredentials Credentials { get; private set; } + + /// + /// The API version to use for this operation. + /// + public string ApiVersion { get; private set; } + + /// + /// The name of the resource group. + /// + public string ResourceGroupName { get; set;} + + /// + /// The subscription ID. + /// + public string SubscriptionId { get; set;} + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set;} + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// /// value is 30. + /// + public int? LongRunningOperationRetryTimeout { get; set;} + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// /// set to true a unique x-ms-client-request-id value is generated and + /// /// included in each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set;} + + /// + /// Gets the IProviderOperations + /// + public virtual IProviderOperations ProviderOperations { get; private set; } + /// + /// Gets the ILabsOperations + /// + public virtual ILabsOperations Labs { get; private set; } + /// + /// Gets the IOperations + /// + public virtual IOperations Operations { get; private set; } + /// + /// Gets the IGlobalSchedulesOperations + /// + public virtual IGlobalSchedulesOperations GlobalSchedules { get; private set; } + /// + /// Gets the IArtifactSourcesOperations + /// + public virtual IArtifactSourcesOperations ArtifactSources { get; private set; } + /// + /// Gets the IArmTemplatesOperations + /// + public virtual IArmTemplatesOperations ArmTemplates { get; private set; } + /// + /// Gets the IArtifactsOperations + /// + public virtual IArtifactsOperations Artifacts { get; private set; } + /// + /// Gets the ICostsOperations + /// + public virtual ICostsOperations Costs { get; private set; } + /// + /// Gets the ICustomImagesOperations + /// + public virtual ICustomImagesOperations CustomImages { get; private set; } + /// + /// Gets the IFormulasOperations + /// + public virtual IFormulasOperations Formulas { get; private set; } + /// + /// Gets the IGalleryImagesOperations + /// + public virtual IGalleryImagesOperations GalleryImages { get; private set; } + /// + /// Gets the INotificationChannelsOperations + /// + public virtual INotificationChannelsOperations NotificationChannels { get; private set; } + /// + /// Gets the IPolicySetsOperations + /// + public virtual IPolicySetsOperations PolicySets { get; private set; } + /// + /// Gets the IPoliciesOperations + /// + public virtual IPoliciesOperations Policies { get; private set; } + /// + /// Gets the ISchedulesOperations + /// + public virtual ISchedulesOperations Schedules { get; private set; } + /// + /// Gets the IServiceRunnersOperations + /// + public virtual IServiceRunnersOperations ServiceRunners { get; private set; } + /// + /// Gets the IUsersOperations + /// + public virtual IUsersOperations Users { get; private set; } + /// + /// Gets the IDisksOperations + /// + public virtual IDisksOperations Disks { get; private set; } + /// + /// Gets the IEnvironmentsOperations + /// + public virtual IEnvironmentsOperations Environments { get; private set; } + /// + /// Gets the ISecretsOperations + /// + public virtual ISecretsOperations Secrets { get; private set; } + /// + /// Gets the IVirtualMachinesOperations + /// + public virtual IVirtualMachinesOperations VirtualMachines { get; private set; } + /// + /// Gets the IVirtualMachineSchedulesOperations + /// + public virtual IVirtualMachineSchedulesOperations VirtualMachineSchedules { get; private set; } + /// + /// Gets the IVirtualNetworksOperations + /// + public virtual IVirtualNetworksOperations VirtualNetworks { get; private set; } + /// + /// Initializes a new instance of the DevTestLabsClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling DevTestLabsClient.Dispose(). False: will not dispose provided httpClient + protected DevTestLabsClient(System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + this.Initialize(); + } + /// + /// Initializes a new instance of the DevTestLabsClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected DevTestLabsClient(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers) + { + this.Initialize(); + } + /// + /// Initializes a new instance of the DevTestLabsClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected DevTestLabsClient(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + this.Initialize(); + } + /// + /// Initializes a new instance of the DevTestLabsClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected DevTestLabsClient(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + this.BaseUri = baseUri; + } + /// + /// Initializes a new instance of the DevTestLabsClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected DevTestLabsClient(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + + this.BaseUri = baseUri; + } + /// + /// Initializes a new instance of the DevTestLabsClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public DevTestLabsClient(Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the DevTestLabsClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling DevTestLabsClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public DevTestLabsClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the DevTestLabsClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public DevTestLabsClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the DevTestLabsClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public DevTestLabsClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the DevTestLabsClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Thrown when a required parameter is null + /// + public DevTestLabsClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + + /// + /// Initializes client properties. + /// + private void Initialize() + { + this.ProviderOperations = new ProviderOperations(this); + this.Labs = new LabsOperations(this); + this.Operations = new Operations(this); + this.GlobalSchedules = new GlobalSchedulesOperations(this); + this.ArtifactSources = new ArtifactSourcesOperations(this); + this.ArmTemplates = new ArmTemplatesOperations(this); + this.Artifacts = new ArtifactsOperations(this); + this.Costs = new CostsOperations(this); + this.CustomImages = new CustomImagesOperations(this); + this.Formulas = new FormulasOperations(this); + this.GalleryImages = new GalleryImagesOperations(this); + this.NotificationChannels = new NotificationChannelsOperations(this); + this.PolicySets = new PolicySetsOperations(this); + this.Policies = new PoliciesOperations(this); + this.Schedules = new SchedulesOperations(this); + this.ServiceRunners = new ServiceRunnersOperations(this); + this.Users = new UsersOperations(this); + this.Disks = new DisksOperations(this); + this.Environments = new EnvironmentsOperations(this); + this.Secrets = new SecretsOperations(this); + this.VirtualMachines = new VirtualMachinesOperations(this); + this.VirtualMachineSchedules = new VirtualMachineSchedulesOperations(this); + this.VirtualNetworks = new VirtualNetworksOperations(this); + this.BaseUri = new System.Uri("https://management.azure.com"); + this.ApiVersion = "2016-05-15"; + this.AcceptLanguage = "en-US"; + this.LongRunningOperationRetryTimeout = 30; + this.GenerateClientRequestId = true; + SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List + { + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter()); + DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List + { + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Azure.CloudErrorJsonConverter()); + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperations.cs new file mode 100644 index 000000000000..e5d7ac49a4a0 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperations.cs @@ -0,0 +1,1725 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// DisksOperations operations. + /// + internal partial class DisksOperations : Microsoft.Rest.IServiceOperations, IDisksOperations + { + /// + /// Initializes a new instance of the DisksOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DisksOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List disks in a given user profile. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (userName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _disk = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_disk)) + { + _queryParameters.Add(_disk); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get disk. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Specify the $expand query. Example: 'properties($select=diskType)' + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (userName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// A Disk. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Disk disk, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, userName, name, disk, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, userName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to attach. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task AttachWithHttpMessagesAsync(string labName, string userName, string name, AttachDiskProperties attachDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginAttachWithHttpMessagesAsync(labName, userName, name, attachDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to detach. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task DetachWithHttpMessagesAsync(string labName, string userName, string name, DetachDiskProperties detachDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDetachWithHttpMessagesAsync(labName, userName, name, detachDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// A Disk. + /// + /// + /// 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 System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Disk disk, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (disk == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "disk"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (userName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + + tracingParameters.Add("disk", disk); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(disk != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(disk, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// 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 System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (userName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to attach. + /// + /// + /// 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 System.Threading.Tasks.Task BeginAttachWithHttpMessagesAsync(string labName, string userName, string name, AttachDiskProperties attachDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (attachDiskProperties == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "attachDiskProperties"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (userName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + + tracingParameters.Add("attachDiskProperties", attachDiskProperties); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginAttach", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(attachDiskProperties != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(attachDiskProperties, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to detach. + /// + /// + /// 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 System.Threading.Tasks.Task BeginDetachWithHttpMessagesAsync(string labName, string userName, string name, DetachDiskProperties detachDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (detachDiskProperties == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "detachDiskProperties"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (userName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + + tracingParameters.Add("detachDiskProperties", detachDiskProperties); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDetach", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(detachDiskProperties != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(detachDiskProperties, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List disks in a given user profile. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperationsExtensions.cs new file mode 100644 index 000000000000..5e53fc8e1d97 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/DisksOperationsExtensions.cs @@ -0,0 +1,499 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for DisksOperations + /// + public static partial class DisksOperationsExtensions + { + /// + /// List disks in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + public static Microsoft.Rest.Azure.IPage List(this IDisksOperations operations, string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IDisksOperations)operations).ListAsync(labName, userName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List disks in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IDisksOperations operations, string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Specify the $expand query. Example: 'properties($select=diskType)' + /// + public static Disk Get(this IDisksOperations operations, string labName, string userName, string name, string expand = default(string)) + { + return ((IDisksOperations)operations).GetAsync(labName, userName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Specify the $expand query. Example: 'properties($select=diskType)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IDisksOperations operations, string labName, string userName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + public static Disk CreateOrUpdate(this IDisksOperations operations, string labName, string userName, string name, Disk disk) + { + return ((IDisksOperations)operations).CreateOrUpdateAsync(labName, userName, name, disk).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IDisksOperations operations, string labName, string userName, string name, Disk disk, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, userName, name, disk, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + public static void Delete(this IDisksOperations operations, string labName, string userName, string name) + { + ((IDisksOperations)operations).DeleteAsync(labName, userName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IDisksOperations operations, string labName, string userName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + public static void Attach(this IDisksOperations operations, string labName, string userName, string name, AttachDiskProperties attachDiskProperties) + { + ((IDisksOperations)operations).AttachAsync(labName, userName, name, attachDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task AttachAsync(this IDisksOperations operations, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.AttachWithHttpMessagesAsync(labName, userName, name, attachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + public static void Detach(this IDisksOperations operations, string labName, string userName, string name, DetachDiskProperties detachDiskProperties) + { + ((IDisksOperations)operations).DetachAsync(labName, userName, name, detachDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DetachAsync(this IDisksOperations operations, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DetachWithHttpMessagesAsync(labName, userName, name, detachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + public static Disk BeginCreateOrUpdate(this IDisksOperations operations, string labName, string userName, string name, Disk disk) + { + return ((IDisksOperations)operations).BeginCreateOrUpdateAsync(labName, userName, name, disk).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IDisksOperations operations, string labName, string userName, string name, Disk disk, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, userName, name, disk, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + public static void BeginDelete(this IDisksOperations operations, string labName, string userName, string name) + { + ((IDisksOperations)operations).BeginDeleteAsync(labName, userName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IDisksOperations operations, string labName, string userName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + public static void BeginAttach(this IDisksOperations operations, string labName, string userName, string name, AttachDiskProperties attachDiskProperties) + { + ((IDisksOperations)operations).BeginAttachAsync(labName, userName, name, attachDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginAttachAsync(this IDisksOperations operations, string labName, string userName, string name, AttachDiskProperties attachDiskProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginAttachWithHttpMessagesAsync(labName, userName, name, attachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + public static void BeginDetach(this IDisksOperations operations, string labName, string userName, string name, DetachDiskProperties detachDiskProperties) + { + ((IDisksOperations)operations).BeginDetachAsync(labName, userName, name, detachDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDetachAsync(this IDisksOperations operations, string labName, string userName, string name, DetachDiskProperties detachDiskProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDetachWithHttpMessagesAsync(labName, userName, name, detachDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List disks in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IDisksOperations operations, string nextPageLink) + { + return ((IDisksOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List disks in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IDisksOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperations.cs new file mode 100644 index 000000000000..49c78070be08 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperations.cs @@ -0,0 +1,1220 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// EnvironmentsOperations operations. + /// + internal partial class EnvironmentsOperations : Microsoft.Rest.IServiceOperations, IEnvironmentsOperations + { + /// + /// Initializes a new instance of the EnvironmentsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal EnvironmentsOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List environments in a given user profile. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (userName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _dtlEnvironment = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_dtlEnvironment)) + { + _queryParameters.Add(_dtlEnvironment); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get environment. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=deploymentProperties)' + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (userName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// An environment, which is essentially an ARM template deployment. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, DtlEnvironment dtlEnvironment, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, userName, name, dtlEnvironment, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, userName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// An environment, which is essentially an ARM template deployment. + /// + /// + /// 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 System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, DtlEnvironment dtlEnvironment, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (dtlEnvironment == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "dtlEnvironment"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (userName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + + tracingParameters.Add("dtlEnvironment", dtlEnvironment); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(dtlEnvironment != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(dtlEnvironment, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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 System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (userName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List environments in a given user profile. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperationsExtensions.cs new file mode 100644 index 000000000000..b45d7342d619 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/EnvironmentsOperationsExtensions.cs @@ -0,0 +1,325 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for EnvironmentsOperations + /// + public static partial class EnvironmentsOperationsExtensions + { + /// + /// List environments in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + public static Microsoft.Rest.Azure.IPage List(this IEnvironmentsOperations operations, string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IEnvironmentsOperations)operations).ListAsync(labName, userName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List environments in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IEnvironmentsOperations operations, string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get environment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=deploymentProperties)' + /// + public static DtlEnvironment Get(this IEnvironmentsOperations operations, string labName, string userName, string name, string expand = default(string)) + { + return ((IEnvironmentsOperations)operations).GetAsync(labName, userName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get environment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=deploymentProperties)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + public static DtlEnvironment CreateOrUpdate(this IEnvironmentsOperations operations, string labName, string userName, string name, DtlEnvironment dtlEnvironment) + { + return ((IEnvironmentsOperations)operations).CreateOrUpdateAsync(labName, userName, name, dtlEnvironment).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, DtlEnvironment dtlEnvironment, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, userName, name, dtlEnvironment, 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 lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + public static void Delete(this IEnvironmentsOperations operations, string labName, string userName, string name) + { + ((IEnvironmentsOperations)operations).DeleteAsync(labName, userName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + public static DtlEnvironment BeginCreateOrUpdate(this IEnvironmentsOperations operations, string labName, string userName, string name, DtlEnvironment dtlEnvironment) + { + return ((IEnvironmentsOperations)operations).BeginCreateOrUpdateAsync(labName, userName, name, dtlEnvironment).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, DtlEnvironment dtlEnvironment, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, userName, name, dtlEnvironment, 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 lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + public static void BeginDelete(this IEnvironmentsOperations operations, string labName, string userName, string name) + { + ((IEnvironmentsOperations)operations).BeginDeleteAsync(labName, userName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IEnvironmentsOperations operations, string labName, string userName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List environments in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IEnvironmentsOperations operations, string nextPageLink) + { + return ((IEnvironmentsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List environments in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IEnvironmentsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperations.cs new file mode 100644 index 000000000000..4905e26b3efe --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperations.cs @@ -0,0 +1,1151 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// FormulasOperations operations. + /// + internal partial class FormulasOperations : Microsoft.Rest.IServiceOperations, IFormulasOperations + { + /// + /// Initializes a new instance of the FormulasOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal FormulasOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List formulas in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("labName", labName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _formula = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_formula)) + { + _queryParameters.Add(_formula); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get formula. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// Specify the $expand query. Example: 'properties($select=description)' + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// A formula for creating a VM, specifying an image base and other parameters + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, Formula formula, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, formula, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete formula. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// 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 System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// A formula for creating a VM, specifying an image base and other parameters + /// + /// + /// 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 System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, Formula formula, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (formula == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "formula"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("formula", formula); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(formula != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(formula, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List formulas in a given lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperationsExtensions.cs new file mode 100644 index 000000000000..80f0ef92faba --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/FormulasOperationsExtensions.cs @@ -0,0 +1,251 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for FormulasOperations + /// + public static partial class FormulasOperationsExtensions + { + /// + /// List formulas in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this IFormulasOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IFormulasOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List formulas in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IFormulasOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get formula. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// Specify the $expand query. Example: 'properties($select=description)' + /// + public static Formula Get(this IFormulasOperations operations, string labName, string name, string expand = default(string)) + { + return ((IFormulasOperations)operations).GetAsync(labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get formula. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// Specify the $expand query. Example: 'properties($select=description)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IFormulasOperations operations, string labName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + public static Formula CreateOrUpdate(this IFormulasOperations operations, string labName, string name, Formula formula) + { + return ((IFormulasOperations)operations).CreateOrUpdateAsync(labName, name, formula).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IFormulasOperations operations, string labName, string name, Formula formula, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, formula, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete formula. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + public static void Delete(this IFormulasOperations operations, string labName, string name) + { + ((IFormulasOperations)operations).DeleteAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete formula. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IFormulasOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + public static Formula BeginCreateOrUpdate(this IFormulasOperations operations, string labName, string name, Formula formula) + { + return ((IFormulasOperations)operations).BeginCreateOrUpdateAsync(labName, name, formula).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IFormulasOperations operations, string labName, string name, Formula formula, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, formula, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List formulas in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IFormulasOperations operations, string nextPageLink) + { + return ((IFormulasOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List formulas 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 System.Threading.Tasks.Task> ListNextAsync(this IFormulasOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperations.cs new file mode 100644 index 000000000000..a5650dce3df4 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperations.cs @@ -0,0 +1,446 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// GalleryImagesOperations operations. + /// + internal partial class GalleryImagesOperations : Microsoft.Rest.IServiceOperations, IGalleryImagesOperations + { + /// + /// Initializes a new instance of the GalleryImagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal GalleryImagesOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List gallery images in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("labName", labName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _galleryImage = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_galleryImage)) + { + _queryParameters.Add(_galleryImage); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List gallery images in a given lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperationsExtensions.cs new file mode 100644 index 000000000000..83ef513943a4 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GalleryImagesOperationsExtensions.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for GalleryImagesOperations + /// + public static partial class GalleryImagesOperationsExtensions + { + /// + /// List gallery images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this IGalleryImagesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IGalleryImagesOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List gallery images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IGalleryImagesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List gallery images in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IGalleryImagesOperations operations, string nextPageLink) + { + return ((IGalleryImagesOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List gallery images 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 System.Threading.Tasks.Task> ListNextAsync(this IGalleryImagesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperations.cs new file mode 100644 index 000000000000..9b79d19eb5a6 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperations.cs @@ -0,0 +1,2129 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// GlobalSchedulesOperations operations. + /// + internal partial class GlobalSchedulesOperations : Microsoft.Rest.IServiceOperations, IGlobalSchedulesOperations + { + /// + /// Initializes a new instance of the GlobalSchedulesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal GlobalSchedulesOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List schedules in a subscription. + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListBySubscriptionWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _schedule = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_schedule)) + { + _queryParameters.Add(_schedule); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List schedules in a resource group. + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _schedule = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_schedule)) + { + _queryParameters.Add(_schedule); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get schedule. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing schedule. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// 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 System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string name, Schedule schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (schedule == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "schedule"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("name", name); + + tracingParameters.Add("schedule", schedule); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(schedule != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete schedule. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Modify properties of schedules. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// 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 System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string name, ScheduleFragment schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (schedule == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "schedule"); + } + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("name", name); + + tracingParameters.Add("schedule", schedule); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(schedule != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the schedule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task ExecuteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// The name of the schedule. + /// + /// + /// Properties for retargeting a virtual machine schedule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task RetargetWithHttpMessagesAsync(string name, RetargetScheduleProperties retargetScheduleProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginRetargetWithHttpMessagesAsync(name, retargetScheduleProperties, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 System.Threading.Tasks.Task BeginExecuteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginExecute", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// The name of the schedule. + /// + /// + /// Properties for retargeting a virtual machine schedule. + /// + /// + /// 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 System.Threading.Tasks.Task BeginRetargetWithHttpMessagesAsync(string name, RetargetScheduleProperties retargetScheduleProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (retargetScheduleProperties == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "retargetScheduleProperties"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("name", name); + + tracingParameters.Add("retargetScheduleProperties", retargetScheduleProperties); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginRetarget", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(retargetScheduleProperties != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(retargetScheduleProperties, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List schedules in a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List schedules in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperationsExtensions.cs new file mode 100644 index 000000000000..6bd3cd7ffd4d --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/GlobalSchedulesOperationsExtensions.cs @@ -0,0 +1,407 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for GlobalSchedulesOperations + /// + public static partial class GlobalSchedulesOperationsExtensions + { + /// + /// List schedules in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + public static Microsoft.Rest.Azure.IPage ListBySubscription(this IGlobalSchedulesOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IGlobalSchedulesOperations)operations).ListBySubscriptionAsync(odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List schedules in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListBySubscriptionAsync(this IGlobalSchedulesOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List schedules in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + public static Microsoft.Rest.Azure.IPage ListByResourceGroup(this IGlobalSchedulesOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IGlobalSchedulesOperations)operations).ListByResourceGroupAsync(odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List schedules in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByResourceGroupAsync(this IGlobalSchedulesOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + public static Schedule Get(this IGlobalSchedulesOperations operations, string name, string expand = default(string)) + { + return ((IGlobalSchedulesOperations)operations).GetAsync(name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IGlobalSchedulesOperations operations, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + public static Schedule CreateOrUpdate(this IGlobalSchedulesOperations operations, string name, Schedule schedule) + { + return ((IGlobalSchedulesOperations)operations).CreateOrUpdateAsync(name, schedule).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IGlobalSchedulesOperations operations, string name, Schedule schedule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(name, schedule, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + public static void Delete(this IGlobalSchedulesOperations operations, string name) + { + ((IGlobalSchedulesOperations)operations).DeleteAsync(name).GetAwaiter().GetResult(); + } + + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IGlobalSchedulesOperations operations, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + public static Schedule Update(this IGlobalSchedulesOperations operations, string name, ScheduleFragment schedule) + { + return ((IGlobalSchedulesOperations)operations).UpdateAsync(name, schedule).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IGlobalSchedulesOperations operations, string name, ScheduleFragment schedule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(name, schedule, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + public static void Execute(this IGlobalSchedulesOperations operations, string name) + { + ((IGlobalSchedulesOperations)operations).ExecuteAsync(name).GetAwaiter().GetResult(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ExecuteAsync(this IGlobalSchedulesOperations operations, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.ExecuteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + public static void Retarget(this IGlobalSchedulesOperations operations, string name, RetargetScheduleProperties retargetScheduleProperties) + { + ((IGlobalSchedulesOperations)operations).RetargetAsync(name, retargetScheduleProperties).GetAwaiter().GetResult(); + } + + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task RetargetAsync(this IGlobalSchedulesOperations operations, string name, RetargetScheduleProperties retargetScheduleProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.RetargetWithHttpMessagesAsync(name, retargetScheduleProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + public static void BeginExecute(this IGlobalSchedulesOperations operations, string name) + { + ((IGlobalSchedulesOperations)operations).BeginExecuteAsync(name).GetAwaiter().GetResult(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginExecuteAsync(this IGlobalSchedulesOperations operations, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginExecuteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + public static void BeginRetarget(this IGlobalSchedulesOperations operations, string name, RetargetScheduleProperties retargetScheduleProperties) + { + ((IGlobalSchedulesOperations)operations).BeginRetargetAsync(name, retargetScheduleProperties).GetAwaiter().GetResult(); + } + + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginRetargetAsync(this IGlobalSchedulesOperations operations, string name, RetargetScheduleProperties retargetScheduleProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginRetargetWithHttpMessagesAsync(name, retargetScheduleProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List schedules in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListBySubscriptionNext(this IGlobalSchedulesOperations operations, string nextPageLink) + { + return ((IGlobalSchedulesOperations)operations).ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List schedules 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 System.Threading.Tasks.Task> ListBySubscriptionNextAsync(this IGlobalSchedulesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List schedules in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByResourceGroupNext(this IGlobalSchedulesOperations operations, string nextPageLink) + { + return ((IGlobalSchedulesOperations)operations).ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List schedules 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 System.Threading.Tasks.Task> ListByResourceGroupNextAsync(this IGlobalSchedulesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArmTemplatesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArmTemplatesOperations.cs new file mode 100644 index 000000000000..0d3618587104 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArmTemplatesOperations.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// ArmTemplatesOperations operations. + /// + public partial interface IArmTemplatesOperations + { + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string artifactSourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get azure resource manager template. + /// + /// + /// Get azure resource manager template. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the azure Resource Manager template. + /// + /// + /// Specify the $expand query. Example: 'properties($select=displayName)' + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string artifactSourceName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// List azure resource manager templates in a given artifact source. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactSourcesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactSourcesOperations.cs new file mode 100644 index 000000000000..e98369fabe1d --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactSourcesOperations.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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// ArtifactSourcesOperations operations. + /// + public partial interface IArtifactSourcesOperations + { + /// + /// List artifact sources in a given lab. + /// + /// + /// List artifact sources in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get artifact source. + /// + /// + /// Get artifact source. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Specify the $expand query. Example: 'properties($select=displayName)' + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing artifact source. + /// + /// + /// Create or replace an existing artifact source. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Properties of an artifact source. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, ArtifactSource artifactSource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete artifact source. + /// + /// + /// Delete artifact source. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Modify properties of artifact sources. + /// + /// + /// Modify properties of artifact sources. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// Properties of an artifact source. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, ArtifactSourceFragment artifactSource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List artifact sources in a given lab. + /// + /// + /// List artifact sources 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactsOperations.cs new file mode 100644 index 000000000000..1022623e393e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IArtifactsOperations.cs @@ -0,0 +1,135 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// ArtifactsOperations operations. + /// + public partial interface IArtifactsOperations + { + /// + /// List artifacts in a given artifact source. + /// + /// + /// List artifacts in a given artifact source. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string artifactSourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get artifact. + /// + /// + /// Get artifact. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + /// + /// Specify the $expand query. Example: 'properties($select=title)' + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string artifactSourceName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Generates an ARM template for the given artifact, uploads the required + /// files to a storage account, and validates the generated artifact. + /// + /// + /// Generates an ARM template for the given artifact, uploads the required + /// files to a storage account, and validates the generated artifact. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the artifact source. + /// + /// + /// The name of the artifact. + /// + /// + /// Parameters for generating an ARM template for deploying artifacts. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GenerateArmTemplateWithHttpMessagesAsync(string labName, string artifactSourceName, string name, GenerateArmTemplateRequest generateArmTemplateRequest, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List artifacts in a given artifact source. + /// + /// + /// List artifacts in a given artifact source. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICostsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICostsOperations.cs new file mode 100644 index 000000000000..d100c77cf9a7 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICostsOperations.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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// CostsOperations operations. + /// + public partial interface ICostsOperations + { + /// + /// Get cost. + /// + /// + /// Get cost. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// Specify the $expand query. Example: 'properties($expand=labCostDetails)' + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing cost. + /// + /// + /// Create or replace an existing cost. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the cost. + /// + /// + /// A cost item. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabCost labCost, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICustomImagesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICustomImagesOperations.cs new file mode 100644 index 000000000000..a26a3082aedc --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ICustomImagesOperations.cs @@ -0,0 +1,203 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// CustomImagesOperations operations. + /// + public partial interface ICustomImagesOperations + { + /// + /// List custom images in a given lab. + /// + /// + /// List custom images in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get custom image. + /// + /// + /// Get custom image. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// Specify the $expand query. Example: 'properties($select=vm)' + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// A custom image. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, CustomImage customImage, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// Create or replace an existing custom image. This operation can take a while + /// to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// A custom image. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, CustomImage customImage, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// Delete custom image. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the custom image. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List custom images in a given lab. + /// + /// + /// List custom images 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDevTestLabsClient.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDevTestLabsClient.cs new file mode 100644 index 000000000000..b0200bb786c5 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDevTestLabsClient.cs @@ -0,0 +1,193 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// The DevTest Labs Client. + /// + public partial interface IDevTestLabsClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + Microsoft.Rest.ServiceClientCredentials Credentials { get;} + + + /// + /// The API version to use for this operation. + /// + string ApiVersion { get;} + + + /// + /// The name of the resource group. + /// + string ResourceGroupName { get; set;} + + + /// + /// The subscription ID. + /// + string SubscriptionId { get; set;} + + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set;} + + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set;} + + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// /// set to true a unique x-ms-client-request-id value is generated and + /// /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set;} + + + /// + /// Gets the IProviderOperations + /// + IProviderOperations ProviderOperations { get; } + + /// + /// Gets the ILabsOperations + /// + ILabsOperations Labs { get; } + + /// + /// Gets the IOperations + /// + IOperations Operations { get; } + + /// + /// Gets the IGlobalSchedulesOperations + /// + IGlobalSchedulesOperations GlobalSchedules { get; } + + /// + /// Gets the IArtifactSourcesOperations + /// + IArtifactSourcesOperations ArtifactSources { get; } + + /// + /// Gets the IArmTemplatesOperations + /// + IArmTemplatesOperations ArmTemplates { get; } + + /// + /// Gets the IArtifactsOperations + /// + IArtifactsOperations Artifacts { get; } + + /// + /// Gets the ICostsOperations + /// + ICostsOperations Costs { get; } + + /// + /// Gets the ICustomImagesOperations + /// + ICustomImagesOperations CustomImages { get; } + + /// + /// Gets the IFormulasOperations + /// + IFormulasOperations Formulas { get; } + + /// + /// Gets the IGalleryImagesOperations + /// + IGalleryImagesOperations GalleryImages { get; } + + /// + /// Gets the INotificationChannelsOperations + /// + INotificationChannelsOperations NotificationChannels { get; } + + /// + /// Gets the IPolicySetsOperations + /// + IPolicySetsOperations PolicySets { get; } + + /// + /// Gets the IPoliciesOperations + /// + IPoliciesOperations Policies { get; } + + /// + /// Gets the ISchedulesOperations + /// + ISchedulesOperations Schedules { get; } + + /// + /// Gets the IServiceRunnersOperations + /// + IServiceRunnersOperations ServiceRunners { get; } + + /// + /// Gets the IUsersOperations + /// + IUsersOperations Users { get; } + + /// + /// Gets the IDisksOperations + /// + IDisksOperations Disks { get; } + + /// + /// Gets the IEnvironmentsOperations + /// + IEnvironmentsOperations Environments { get; } + + /// + /// Gets the ISecretsOperations + /// + ISecretsOperations Secrets { get; } + + /// + /// Gets the IVirtualMachinesOperations + /// + IVirtualMachinesOperations VirtualMachines { get; } + + /// + /// Gets the IVirtualMachineSchedulesOperations + /// + IVirtualMachineSchedulesOperations VirtualMachineSchedules { get; } + + /// + /// Gets the IVirtualNetworksOperations + /// + IVirtualNetworksOperations VirtualNetworks { get; } + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDisksOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDisksOperations.cs new file mode 100644 index 000000000000..419fd493d6aa --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IDisksOperations.cs @@ -0,0 +1,345 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// DisksOperations operations. + /// + public partial interface IDisksOperations + { + /// + /// List disks in a given user profile. + /// + /// + /// List disks in a given user profile. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get disk. + /// + /// + /// Get disk. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Specify the $expand query. Example: 'properties($select=diskType)' + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// A Disk. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Disk disk, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to attach. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task AttachWithHttpMessagesAsync(string labName, string userName, string name, AttachDiskProperties attachDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to detach. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DetachWithHttpMessagesAsync(string labName, string userName, string name, DetachDiskProperties detachDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// Create or replace an existing disk. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// A Disk. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Disk disk, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// Delete disk. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// Attach and create the lease of the disk to the virtual machine. This + /// operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to attach. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginAttachWithHttpMessagesAsync(string labName, string userName, string name, AttachDiskProperties attachDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// Detach and break the lease of the disk attached to the virtual machine. + /// This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the disk. + /// + /// + /// Properties of the disk to detach. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginDetachWithHttpMessagesAsync(string labName, string userName, string name, DetachDiskProperties detachDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List disks in a given user profile. + /// + /// + /// List disks in a given user profile. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IEnvironmentsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IEnvironmentsOperations.cs new file mode 100644 index 000000000000..cdeb193ffd15 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IEnvironmentsOperations.cs @@ -0,0 +1,222 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// EnvironmentsOperations operations. + /// + public partial interface IEnvironmentsOperations + { + /// + /// List environments in a given user profile. + /// + /// + /// List environments in a given user profile. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get environment. + /// + /// + /// Get environment. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=deploymentProperties)' + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// An environment, which is essentially an ARM template deployment. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, DtlEnvironment dtlEnvironment, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// Create or replace an existing environment. This operation can take a while + /// to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the environment. + /// + /// + /// An environment, which is essentially an ARM template deployment. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, DtlEnvironment dtlEnvironment, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// Delete environment. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List environments in a given user profile. + /// + /// + /// List environments in a given user profile. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IFormulasOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IFormulasOperations.cs new file mode 100644 index 000000000000..3be086a75344 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IFormulasOperations.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// FormulasOperations operations. + /// + public partial interface IFormulasOperations + { + /// + /// List formulas in a given lab. + /// + /// + /// List formulas in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get formula. + /// + /// + /// Get formula. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// Specify the $expand query. Example: 'properties($select=description)' + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// A formula for creating a VM, specifying an image base and other parameters + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, Formula formula, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete formula. + /// + /// + /// Delete formula. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// Create or replace an existing Formula. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the formula. + /// + /// + /// A formula for creating a VM, specifying an image base and other parameters + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, Formula formula, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List formulas in a given lab. + /// + /// + /// List formulas 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGalleryImagesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGalleryImagesOperations.cs new file mode 100644 index 000000000000..d784ec710d03 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGalleryImagesOperations.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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// GalleryImagesOperations operations. + /// + public partial interface IGalleryImagesOperations + { + /// + /// List gallery images in a given lab. + /// + /// + /// List gallery images in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List gallery images in a given lab. + /// + /// + /// List gallery images 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGlobalSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGlobalSchedulesOperations.cs new file mode 100644 index 000000000000..21a762f1a3c4 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IGlobalSchedulesOperations.cs @@ -0,0 +1,297 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// GlobalSchedulesOperations operations. + /// + public partial interface IGlobalSchedulesOperations + { + /// + /// List schedules in a subscription. + /// + /// + /// List schedules in a subscription. + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListBySubscriptionWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List schedules in a resource group. + /// + /// + /// List schedules in a resource group. + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get schedule. + /// + /// + /// Get schedule. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing schedule. + /// + /// + /// Create or replace an existing schedule. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string name, Schedule schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete schedule. + /// + /// + /// Delete schedule. + /// + /// + /// The name of the schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Modify properties of schedules. + /// + /// + /// Modify properties of schedules. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string name, ScheduleFragment schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task ExecuteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// The name of the schedule. + /// + /// + /// Properties for retargeting a virtual machine schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task RetargetWithHttpMessagesAsync(string name, RetargetScheduleProperties retargetScheduleProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginExecuteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// Updates a schedule's target resource Id. This operation can take a while to + /// complete. + /// + /// + /// The name of the schedule. + /// + /// + /// Properties for retargeting a virtual machine schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginRetargetWithHttpMessagesAsync(string name, RetargetScheduleProperties retargetScheduleProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List schedules in a subscription. + /// + /// + /// List schedules 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 + /// + System.Threading.Tasks.Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List schedules in a resource group. + /// + /// + /// List schedules 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 + /// + System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ILabsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ILabsOperations.cs new file mode 100644 index 000000000000..64a8bc4599f5 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ILabsOperations.cs @@ -0,0 +1,474 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// LabsOperations operations. + /// + public partial interface ILabsOperations + { + /// + /// List labs in a subscription. + /// + /// + /// List labs in a subscription. + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListBySubscriptionWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List labs in a resource group. + /// + /// + /// List labs in a resource group. + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get lab. + /// + /// + /// Get lab. + /// + /// + /// The name of the lab. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=defaultStorageAccount)' + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// A lab. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string name, Lab lab, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Modify properties of labs. + /// + /// + /// Modify properties of labs. + /// + /// + /// The name of the lab. + /// + /// + /// A lab. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string name, LabFragment lab, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task ClaimAnyVmWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// Properties for creating a virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task CreateEnvironmentWithHttpMessagesAsync(string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The parameters of the export operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task ExportResourceUsageWithHttpMessagesAsync(string name, ExportResourceUsageParameters exportResourceUsageParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Generate a URI for uploading custom disk images to a Lab. + /// + /// + /// Generate a URI for uploading custom disk images to a Lab. + /// + /// + /// The name of the lab. + /// + /// + /// Properties for generating an upload URI. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GenerateUploadUriWithHttpMessagesAsync(string name, GenerateUploadUriParameter generateUploadUriParameter, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List disk images available for custom image creation. + /// + /// + /// List disk images available for custom image creation. + /// + /// + /// The name of the lab. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListVhdsWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// A lab. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string name, Lab lab, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginClaimAnyVmWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// Properties for creating a virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginCreateEnvironmentWithHttpMessagesAsync(string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The parameters of the export operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginExportResourceUsageWithHttpMessagesAsync(string name, ExportResourceUsageParameters exportResourceUsageParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List labs in a subscription. + /// + /// + /// List labs 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 + /// + System.Threading.Tasks.Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List labs in a resource group. + /// + /// + /// List labs 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 + /// + System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List disk images available for custom image creation. + /// + /// + /// List disk images available for custom image creation. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListVhdsNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/INotificationChannelsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/INotificationChannelsOperations.cs new file mode 100644 index 000000000000..30f5be91e895 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/INotificationChannelsOperations.cs @@ -0,0 +1,202 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// NotificationChannelsOperations operations. + /// + public partial interface INotificationChannelsOperations + { + /// + /// List notificationchannels in a given lab. + /// + /// + /// List notificationchannels in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get notificationchannel. + /// + /// + /// Get notificationchannel. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// Specify the $expand query. Example: 'properties($select=webHookUrl)' + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing notificationChannel. + /// + /// + /// Create or replace an existing notificationChannel. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// A notification. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, NotificationChannel notificationChannel, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete notificationchannel. + /// + /// + /// Delete notificationchannel. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Modify properties of notificationchannels. + /// + /// + /// Modify properties of notificationchannels. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// A notification. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, NotificationChannelFragment notificationChannel, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send notification to provided channel. + /// + /// + /// Send notification to provided channel. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// Properties for generating a Notification. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task NotifyWithHttpMessagesAsync(string labName, string name, NotifyParameters notifyParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List notificationchannels in a given lab. + /// + /// + /// List notificationchannels 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IOperations.cs new file mode 100644 index 000000000000..bdf90b917594 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IOperations.cs @@ -0,0 +1,43 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Get operation. + /// + /// + /// Get operation. + /// + /// + /// The name of the location. + /// + /// + /// The name of 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string locationName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPoliciesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPoliciesOperations.cs new file mode 100644 index 000000000000..a25a8af23525 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPoliciesOperations.cs @@ -0,0 +1,191 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// PoliciesOperations operations. + /// + public partial interface IPoliciesOperations + { + /// + /// List policies in a given policy set. + /// + /// + /// List policies in a given policy set. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string policySetName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get policy. + /// + /// + /// Get policy. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// Specify the $expand query. Example: 'properties($select=description)' + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string policySetName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing policy. + /// + /// + /// Create or replace an existing policy. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// A Policy. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string policySetName, string name, Policy policy, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete policy. + /// + /// + /// Delete policy. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string policySetName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Modify properties of policies. + /// + /// + /// Modify properties of policies. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// A Policy. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string policySetName, string name, PolicyFragment policy, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List policies in a given policy set. + /// + /// + /// List policies in a given policy set. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPolicySetsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPolicySetsOperations.cs new file mode 100644 index 000000000000..9b53488d23c8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IPolicySetsOperations.cs @@ -0,0 +1,46 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// PolicySetsOperations operations. + /// + public partial interface IPolicySetsOperations + { + /// + /// Evaluates lab policy. + /// + /// + /// Evaluates lab policy. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// Request body for evaluating a policy set. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> EvaluatePoliciesWithHttpMessagesAsync(string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IProviderOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IProviderOperations.cs new file mode 100644 index 000000000000..1c5b0a56092b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IProviderOperations.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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// ProviderOperations operations. + /// + public partial interface IProviderOperations + { + /// + /// Result of the request to list REST API operations + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Result of the request to list REST API operations + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISchedulesOperations.cs new file mode 100644 index 000000000000..6b4a0f3f5eb4 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISchedulesOperations.cs @@ -0,0 +1,271 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// SchedulesOperations operations. + /// + public partial interface ISchedulesOperations + { + /// + /// List schedules in a given lab. + /// + /// + /// List schedules in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get schedule. + /// + /// + /// Get schedule. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing schedule. + /// + /// + /// Create or replace an existing schedule. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, Schedule schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete schedule. + /// + /// + /// Delete schedule. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Modify properties of schedules. + /// + /// + /// Modify properties of schedules. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, ScheduleFragment schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task ExecuteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists all applicable schedules + /// + /// + /// Lists all applicable schedules + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListApplicableWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginExecuteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List schedules in a given lab. + /// + /// + /// List schedules 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists all applicable schedules + /// + /// + /// Lists all applicable schedules + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListApplicableNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISecretsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISecretsOperations.cs new file mode 100644 index 000000000000..0e5c8ce5a420 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ISecretsOperations.cs @@ -0,0 +1,159 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// SecretsOperations operations. + /// + public partial interface ISecretsOperations + { + /// + /// List secrets in a given user profile. + /// + /// + /// List secrets in a given user profile. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get secret. + /// + /// + /// Get secret. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// Specify the $expand query. Example: 'properties($select=value)' + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing secret. + /// + /// + /// Create or replace an existing secret. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// A secret. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Secret secret, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete secret. + /// + /// + /// Delete secret. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List secrets in a given user profile. + /// + /// + /// List secrets in a given user profile. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceRunnersOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceRunnersOperations.cs new file mode 100644 index 000000000000..eb1a08552291 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IServiceRunnersOperations.cs @@ -0,0 +1,144 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// ServiceRunnersOperations operations. + /// + public partial interface IServiceRunnersOperations + { + /// + /// List service runners in a given lab. + /// + /// + /// List service runners in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get service runner. + /// + /// + /// Get service runner. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing Service runner. + /// + /// + /// Create or replace an existing Service runner. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// A container for a managed identity to execute DevTest lab services. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, ServiceRunner serviceRunner, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete service runner. + /// + /// + /// Delete service runner. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List service runners in a given lab. + /// + /// + /// List service runners 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IUsersOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IUsersOperations.cs new file mode 100644 index 000000000000..448cf98df6e5 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IUsersOperations.cs @@ -0,0 +1,199 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// UsersOperations operations. + /// + public partial interface IUsersOperations + { + /// + /// List user profiles in a given lab. + /// + /// + /// List user profiles in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get user profile. + /// + /// + /// Get user profile. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Specify the $expand query. Example: 'properties($select=identity)' + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing user profile. + /// + /// + /// Create or replace an existing user profile. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Profile of a lab 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 + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, User user, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Modify properties of user profiles. + /// + /// + /// Modify properties of user profiles. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Profile of a lab 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 + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, UserFragment user, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List user profiles in a given lab. + /// + /// + /// List user profiles 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachineSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachineSchedulesOperations.cs new file mode 100644 index 000000000000..f13c61fe3a7a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachineSchedulesOperations.cs @@ -0,0 +1,243 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// VirtualMachineSchedulesOperations operations. + /// + public partial interface IVirtualMachineSchedulesOperations + { + /// + /// List schedules in a given virtual machine. + /// + /// + /// List schedules in a given virtual machine. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string virtualMachineName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get schedule. + /// + /// + /// Get schedule. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string virtualMachineName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing schedule. + /// + /// + /// Create or replace an existing schedule. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Schedule schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete schedule. + /// + /// + /// Delete schedule. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Modify properties of schedules. + /// + /// + /// Modify properties of schedules. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string virtualMachineName, string name, ScheduleFragment schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task ExecuteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginExecuteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List schedules in a given virtual machine. + /// + /// + /// List schedules in a given virtual machine. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachinesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachinesOperations.cs new file mode 100644 index 000000000000..fb98c49c3236 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualMachinesOperations.cs @@ -0,0 +1,569 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// VirtualMachinesOperations operations. + /// + public partial interface IVirtualMachinesOperations + { + /// + /// List virtual machines in a given lab. + /// + /// + /// List virtual machines in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get virtual machine. + /// + /// + /// Get virtual machine. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A virtual machine. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachine labVirtualMachine, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Modify properties of virtual machines. + /// + /// + /// Modify properties of virtual machines. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A virtual machine. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachineFragment labVirtualMachine, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for adding a new or existing data disk to a virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task AddDataDiskWithHttpMessagesAsync(string labName, string name, DataDiskProperties dataDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for applying artifacts to a virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task ApplyArtifactsWithHttpMessagesAsync(string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task ClaimWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for detaching data disk from a virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DetachDataDiskWithHttpMessagesAsync(string labName, string name, DetachDataDiskProperties detachDataDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists all applicable schedules + /// + /// + /// Lists all applicable schedules + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> ListApplicableSchedulesWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task StartWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task StopWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A virtual machine. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachine labVirtualMachine, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for adding a new or existing data disk to a virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginAddDataDiskWithHttpMessagesAsync(string labName, string name, DataDiskProperties dataDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for applying artifacts to a virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginApplyArtifactsWithHttpMessagesAsync(string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginClaimWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for detaching data disk from a virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginDetachDataDiskWithHttpMessagesAsync(string labName, string name, DetachDataDiskProperties detachDataDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginStartWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginStopWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List virtual machines in a given lab. + /// + /// + /// List virtual machines 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualNetworksOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualNetworksOperations.cs new file mode 100644 index 000000000000..2eeabdcc2720 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/IVirtualNetworksOperations.cs @@ -0,0 +1,232 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// VirtualNetworksOperations operations. + /// + public partial interface IVirtualNetworksOperations + { + /// + /// List virtual networks in a given lab. + /// + /// + /// List virtual networks in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get virtual network. + /// + /// + /// Get virtual network. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// Specify the $expand query. Example: 'properties($expand=externalSubnets)' + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// A virtual network. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, VirtualNetwork virtualNetwork, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Modify properties of virtual networks. + /// + /// + /// Modify properties of virtual networks. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// A virtual network. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, VirtualNetworkFragment virtualNetwork, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// A virtual network. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, VirtualNetwork virtualNetwork, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List virtual networks in a given lab. + /// + /// + /// List virtual networks 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperations.cs new file mode 100644 index 000000000000..da98e25c5ec4 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperations.cs @@ -0,0 +1,3017 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// LabsOperations operations. + /// + internal partial class LabsOperations : Microsoft.Rest.IServiceOperations, ILabsOperations + { + /// + /// Initializes a new instance of the LabsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal LabsOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List labs in a subscription. + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListBySubscriptionWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _lab = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_lab)) + { + _queryParameters.Add(_lab); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List labs in a resource group. + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _lab = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_lab)) + { + _queryParameters.Add(_lab); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get lab. + /// + /// + /// The name of the lab. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=defaultStorageAccount)' + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// A lab. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string name, Lab lab, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(name, lab, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Modify properties of labs. + /// + /// + /// The name of the lab. + /// + /// + /// A lab. + /// + /// + /// 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 System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string name, LabFragment lab, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (lab == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "lab"); + } + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("name", name); + + tracingParameters.Add("lab", lab); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(lab != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(lab, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task ClaimAnyVmWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginClaimAnyVmWithHttpMessagesAsync(name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// Properties for creating a virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task CreateEnvironmentWithHttpMessagesAsync(string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateEnvironmentWithHttpMessagesAsync(name, labVirtualMachineCreationParameter, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The parameters of the export operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task ExportResourceUsageWithHttpMessagesAsync(string name, ExportResourceUsageParameters exportResourceUsageParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginExportResourceUsageWithHttpMessagesAsync(name, exportResourceUsageParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Generate a URI for uploading custom disk images to a Lab. + /// + /// + /// The name of the lab. + /// + /// + /// Properties for generating an upload URI. + /// + /// + /// 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 System.Threading.Tasks.Task> GenerateUploadUriWithHttpMessagesAsync(string name, GenerateUploadUriParameter generateUploadUriParameter, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (generateUploadUriParameter == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "generateUploadUriParameter"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("name", name); + + tracingParameters.Add("generateUploadUriParameter", generateUploadUriParameter); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GenerateUploadUri", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/generateUploadUri").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(generateUploadUriParameter != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(generateUploadUriParameter, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List disk images available for custom image creation. + /// + /// + /// The name of the lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListVhdsWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListVhds", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// A lab. + /// + /// + /// 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 System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string name, Lab lab, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (lab == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "lab"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("name", name); + + tracingParameters.Add("lab", lab); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(lab != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(lab, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// 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 System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// 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 System.Threading.Tasks.Task BeginClaimAnyVmWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginClaimAnyVm", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// Properties for creating a virtual machine. + /// + /// + /// 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 System.Threading.Tasks.Task BeginCreateEnvironmentWithHttpMessagesAsync(string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (labVirtualMachineCreationParameter == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labVirtualMachineCreationParameter"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("name", name); + + tracingParameters.Add("labVirtualMachineCreationParameter", labVirtualMachineCreationParameter); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateEnvironment", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(labVirtualMachineCreationParameter != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(labVirtualMachineCreationParameter, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The parameters of the export operation. + /// + /// + /// 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 System.Threading.Tasks.Task BeginExportResourceUsageWithHttpMessagesAsync(string name, ExportResourceUsageParameters exportResourceUsageParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (exportResourceUsageParameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "exportResourceUsageParameters"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("name", name); + + tracingParameters.Add("exportResourceUsageParameters", exportResourceUsageParameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginExportResourceUsage", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(exportResourceUsageParameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(exportResourceUsageParameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List labs in a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List labs in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List disk images available for custom image creation. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListVhdsNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListVhdsNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperationsExtensions.cs new file mode 100644 index 000000000000..7e686202c0a6 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/LabsOperationsExtensions.cs @@ -0,0 +1,643 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for LabsOperations + /// + public static partial class LabsOperationsExtensions + { + /// + /// List labs in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + public static Microsoft.Rest.Azure.IPage ListBySubscription(this ILabsOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((ILabsOperations)operations).ListBySubscriptionAsync(odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List labs in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListBySubscriptionAsync(this ILabsOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List labs in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + public static Microsoft.Rest.Azure.IPage ListByResourceGroup(this ILabsOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((ILabsOperations)operations).ListByResourceGroupAsync(odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List labs in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByResourceGroupAsync(this ILabsOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=defaultStorageAccount)' + /// + public static Lab Get(this ILabsOperations operations, string name, string expand = default(string)) + { + return ((ILabsOperations)operations).GetAsync(name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($select=defaultStorageAccount)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this ILabsOperations operations, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static Lab CreateOrUpdate(this ILabsOperations operations, string name, Lab lab) + { + return ((ILabsOperations)operations).CreateOrUpdateAsync(name, lab).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this ILabsOperations operations, string name, Lab lab, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(name, lab, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static void Delete(this ILabsOperations operations, string name) + { + ((ILabsOperations)operations).DeleteAsync(name).GetAwaiter().GetResult(); + } + + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this ILabsOperations operations, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of labs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static Lab Update(this ILabsOperations operations, string name, LabFragment lab) + { + return ((ILabsOperations)operations).UpdateAsync(name, lab).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of labs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this ILabsOperations operations, string name, LabFragment lab, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(name, lab, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static void ClaimAnyVm(this ILabsOperations operations, string name) + { + ((ILabsOperations)operations).ClaimAnyVmAsync(name).GetAwaiter().GetResult(); + } + + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ClaimAnyVmAsync(this ILabsOperations operations, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.ClaimAnyVmWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static void CreateEnvironment(this ILabsOperations operations, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) + { + ((ILabsOperations)operations).CreateEnvironmentAsync(name, labVirtualMachineCreationParameter).GetAwaiter().GetResult(); + } + + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateEnvironmentAsync(this ILabsOperations operations, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.CreateEnvironmentWithHttpMessagesAsync(name, labVirtualMachineCreationParameter, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static void ExportResourceUsage(this ILabsOperations operations, string name, ExportResourceUsageParameters exportResourceUsageParameters) + { + ((ILabsOperations)operations).ExportResourceUsageAsync(name, exportResourceUsageParameters).GetAwaiter().GetResult(); + } + + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ExportResourceUsageAsync(this ILabsOperations operations, string name, ExportResourceUsageParameters exportResourceUsageParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.ExportResourceUsageWithHttpMessagesAsync(name, exportResourceUsageParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Generate a URI for uploading custom disk images to a Lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static GenerateUploadUriResponse GenerateUploadUri(this ILabsOperations operations, string name, GenerateUploadUriParameter generateUploadUriParameter) + { + return ((ILabsOperations)operations).GenerateUploadUriAsync(name, generateUploadUriParameter).GetAwaiter().GetResult(); + } + + /// + /// Generate a URI for uploading custom disk images to a Lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GenerateUploadUriAsync(this ILabsOperations operations, string name, GenerateUploadUriParameter generateUploadUriParameter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GenerateUploadUriWithHttpMessagesAsync(name, generateUploadUriParameter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List disk images available for custom image creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage ListVhds(this ILabsOperations operations, string name) + { + return ((ILabsOperations)operations).ListVhdsAsync(name).GetAwaiter().GetResult(); + } + + /// + /// List disk images available for custom image creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListVhdsAsync(this ILabsOperations operations, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListVhdsWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static Lab BeginCreateOrUpdate(this ILabsOperations operations, string name, Lab lab) + { + return ((ILabsOperations)operations).BeginCreateOrUpdateAsync(name, lab).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this ILabsOperations operations, string name, Lab lab, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(name, lab, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static void BeginDelete(this ILabsOperations operations, string name) + { + ((ILabsOperations)operations).BeginDeleteAsync(name).GetAwaiter().GetResult(); + } + + /// + /// Delete lab. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this ILabsOperations operations, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static void BeginClaimAnyVm(this ILabsOperations operations, string name) + { + ((ILabsOperations)operations).BeginClaimAnyVmAsync(name).GetAwaiter().GetResult(); + } + + /// + /// Claim a random claimable virtual machine in the lab. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginClaimAnyVmAsync(this ILabsOperations operations, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginClaimAnyVmWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static void BeginCreateEnvironment(this ILabsOperations operations, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) + { + ((ILabsOperations)operations).BeginCreateEnvironmentAsync(name, labVirtualMachineCreationParameter).GetAwaiter().GetResult(); + } + + /// + /// Create virtual machines in a lab. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateEnvironmentAsync(this ILabsOperations operations, string name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginCreateEnvironmentWithHttpMessagesAsync(name, labVirtualMachineCreationParameter, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + public static void BeginExportResourceUsage(this ILabsOperations operations, string name, ExportResourceUsageParameters exportResourceUsageParameters) + { + ((ILabsOperations)operations).BeginExportResourceUsageAsync(name, exportResourceUsageParameters).GetAwaiter().GetResult(); + } + + /// + /// Exports the lab resource usage into a storage account This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginExportResourceUsageAsync(this ILabsOperations operations, string name, ExportResourceUsageParameters exportResourceUsageParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginExportResourceUsageWithHttpMessagesAsync(name, exportResourceUsageParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List labs in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListBySubscriptionNext(this ILabsOperations operations, string nextPageLink) + { + return ((ILabsOperations)operations).ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List labs 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 System.Threading.Tasks.Task> ListBySubscriptionNextAsync(this ILabsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List labs in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByResourceGroupNext(this ILabsOperations operations, string nextPageLink) + { + return ((ILabsOperations)operations).ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List labs 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 System.Threading.Tasks.Task> ListByResourceGroupNextAsync(this ILabsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List disk images available for custom image creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListVhdsNext(this ILabsOperations operations, string nextPageLink) + { + return ((ILabsOperations)operations).ListVhdsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List disk images available for custom image creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListVhdsNextAsync(this ILabsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListVhdsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableSchedule.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableSchedule.cs new file mode 100644 index 000000000000..fc162126d6cd --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableSchedule.cs @@ -0,0 +1,80 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Schedules applicable to a virtual machine. The schedules may have been + /// defined on a VM or on lab level. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class ApplicableSchedule : Resource + { + /// + /// Initializes a new instance of the ApplicableSchedule class. + /// + public ApplicableSchedule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicableSchedule 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 auto-shutdown schedule, if one has been set at the lab or lab resource + /// level. + /// + + /// The auto-startup schedule, if one has been set at the lab or lab resource + /// level. + /// + public ApplicableSchedule(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), Schedule labVmsShutdown = default(Schedule), Schedule labVmsStartup = default(Schedule)) + + : base(id, name, type, location, tags) + { + this.LabVmsShutdown = labVmsShutdown; + this.LabVmsStartup = labVmsStartup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the auto-shutdown schedule, if one has been set at the lab or + /// lab resource level. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labVmsShutdown")] + public Schedule LabVmsShutdown {get; set; } + + /// + /// Gets or sets the auto-startup schedule, if one has been set at the lab or + /// lab resource level. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labVmsStartup")] + public Schedule LabVmsStartup {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleFragment.cs new file mode 100644 index 000000000000..f08c3195525c --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleFragment.cs @@ -0,0 +1,80 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Schedules applicable to a virtual machine. The schedules may have been + /// defined on a VM or on lab level. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class ApplicableScheduleFragment : Resource + { + /// + /// Initializes a new instance of the ApplicableScheduleFragment class. + /// + public ApplicableScheduleFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicableScheduleFragment 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 auto-shutdown schedule, if one has been set at the lab or lab resource + /// level. + /// + + /// The auto-startup schedule, if one has been set at the lab or lab resource + /// level. + /// + public ApplicableScheduleFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), ScheduleFragment labVmsShutdown = default(ScheduleFragment), ScheduleFragment labVmsStartup = default(ScheduleFragment)) + + : base(id, name, type, location, tags) + { + this.LabVmsShutdown = labVmsShutdown; + this.LabVmsStartup = labVmsStartup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the auto-shutdown schedule, if one has been set at the lab or + /// lab resource level. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labVmsShutdown")] + public ScheduleFragment LabVmsShutdown {get; set; } + + /// + /// Gets or sets the auto-startup schedule, if one has been set at the lab or + /// lab resource level. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labVmsStartup")] + public ScheduleFragment LabVmsStartup {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleProperties.cs new file mode 100644 index 000000000000..95869137b09e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableScheduleProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a schedules applicable to a virtual machine. + /// + public partial class ApplicableScheduleProperties + { + /// + /// Initializes a new instance of the ApplicableScheduleProperties class. + /// + public ApplicableScheduleProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicableScheduleProperties class. + /// + + /// The auto-shutdown schedule, if one has been set at the lab or lab resource + /// level. + /// + + /// The auto-startup schedule, if one has been set at the lab or lab resource + /// level. + /// + public ApplicableScheduleProperties(Schedule labVmsShutdown = default(Schedule), Schedule labVmsStartup = default(Schedule)) + + { + this.LabVmsShutdown = labVmsShutdown; + this.LabVmsStartup = labVmsStartup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the auto-shutdown schedule, if one has been set at the lab or + /// lab resource level. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labVmsShutdown")] + public Schedule LabVmsShutdown {get; set; } + + /// + /// Gets or sets the auto-startup schedule, if one has been set at the lab or + /// lab resource level. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labVmsStartup")] + public Schedule LabVmsStartup {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableSchedulePropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableSchedulePropertiesFragment.cs new file mode 100644 index 000000000000..3eb2d20041b2 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplicableSchedulePropertiesFragment.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a schedules applicable to a virtual machine. + /// + public partial class ApplicableSchedulePropertiesFragment + { + /// + /// Initializes a new instance of the ApplicableSchedulePropertiesFragment class. + /// + public ApplicableSchedulePropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicableSchedulePropertiesFragment class. + /// + + /// The auto-shutdown schedule, if one has been set at the lab or lab resource + /// level. + /// + + /// The auto-startup schedule, if one has been set at the lab or lab resource + /// level. + /// + public ApplicableSchedulePropertiesFragment(ScheduleFragment labVmsShutdown = default(ScheduleFragment), ScheduleFragment labVmsStartup = default(ScheduleFragment)) + + { + this.LabVmsShutdown = labVmsShutdown; + this.LabVmsStartup = labVmsStartup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the auto-shutdown schedule, if one has been set at the lab or + /// lab resource level. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labVmsShutdown")] + public ScheduleFragment LabVmsShutdown {get; set; } + + /// + /// Gets or sets the auto-startup schedule, if one has been set at the lab or + /// lab resource level. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labVmsStartup")] + public ScheduleFragment LabVmsStartup {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplyArtifactsRequest.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplyArtifactsRequest.cs new file mode 100644 index 000000000000..b57d59b978f2 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ApplyArtifactsRequest.cs @@ -0,0 +1,48 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Request body for applying artifacts to a virtual machine. + /// + public partial class ApplyArtifactsRequest + { + /// + /// Initializes a new instance of the ApplyArtifactsRequest class. + /// + public ApplyArtifactsRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplyArtifactsRequest class. + /// + + /// The list of artifacts to apply. + /// + public ApplyArtifactsRequest(System.Collections.Generic.IList artifacts = default(System.Collections.Generic.IList)) + + { + this.Artifacts = artifacts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the list of artifacts to apply. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifacts")] + public System.Collections.Generic.IList Artifacts {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplate.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplate.cs new file mode 100644 index 000000000000..f7b48e1c0d75 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplate.cs @@ -0,0 +1,127 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// An Azure Resource Manager template. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class ArmTemplate : Resource + { + /// + /// Initializes a new instance of the ArmTemplate class. + /// + public ArmTemplate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArmTemplate 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 display name of the ARM template. + /// + + /// The description of the ARM template. + /// + + /// The publisher of the ARM template. + /// + + /// The URI to the icon of the ARM template. + /// + + /// The contents of the ARM template. + /// + + /// The creation date of the armTemplate. + /// + + /// File name and parameter values information from all + /// azuredeploy.*.parameters.json for the ARM template. + /// + public ArmTemplate(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string displayName = default(string), string description = default(string), string publisher = default(string), string icon = default(string), object contents = default(object), System.DateTime? createdDate = default(System.DateTime?), System.Collections.Generic.IList parametersValueFilesInfo = default(System.Collections.Generic.IList)) + + : base(id, name, type, location, tags) + { + this.DisplayName = displayName; + this.Description = description; + this.Publisher = publisher; + this.Icon = icon; + this.Contents = contents; + this.CreatedDate = createdDate; + this.ParametersValueFilesInfo = parametersValueFilesInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the display name of the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; private set; } + + /// + /// Gets the description of the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; private set; } + + /// + /// Gets the publisher of the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.publisher")] + public string Publisher {get; private set; } + + /// + /// Gets the URI to the icon of the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.icon")] + public string Icon {get; private set; } + + /// + /// Gets the contents of the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.contents")] + public object Contents {get; private set; } + + /// + /// Gets the creation date of the armTemplate. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets file name and parameter values information from all + /// azuredeploy.*.parameters.json for the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.parametersValueFilesInfo")] + public System.Collections.Generic.IList ParametersValueFilesInfo {get; private set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateInfo.cs new file mode 100644 index 000000000000..dcd76c3fc811 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateInfo.cs @@ -0,0 +1,58 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Information about a generated ARM template. + /// + public partial class ArmTemplateInfo + { + /// + /// Initializes a new instance of the ArmTemplateInfo class. + /// + public ArmTemplateInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArmTemplateInfo class. + /// + + /// The template's contents. + /// + + /// The parameters of the ARM template. + /// + public ArmTemplateInfo(object template = default(object), object parameters = default(object)) + + { + this.Template = template; + this.Parameters = parameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the template's contents. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "template")] + public object Template {get; set; } + + /// + /// Gets or sets the parameters of the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "parameters")] + public object Parameters {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterProperties.cs new file mode 100644 index 000000000000..28d96e8793cd --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateParameterProperties.cs @@ -0,0 +1,58 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an Azure Resource Manager template parameter. + /// + public partial class ArmTemplateParameterProperties + { + /// + /// Initializes a new instance of the ArmTemplateParameterProperties class. + /// + public ArmTemplateParameterProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArmTemplateParameterProperties class. + /// + + /// The name of the template parameter. + /// + + /// The value of the template parameter. + /// + public ArmTemplateParameterProperties(string name = default(string), string value = default(string)) + + { + this.Name = name; + this.Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the template parameter. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets the value of the template parameter. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateProperties.cs new file mode 100644 index 000000000000..13780a009b2d --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArmTemplateProperties.cs @@ -0,0 +1,110 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an Azure Resource Manager template. + /// + public partial class ArmTemplateProperties + { + /// + /// Initializes a new instance of the ArmTemplateProperties class. + /// + public ArmTemplateProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArmTemplateProperties class. + /// + + /// The display name of the ARM template. + /// + + /// The description of the ARM template. + /// + + /// The publisher of the ARM template. + /// + + /// The URI to the icon of the ARM template. + /// + + /// The contents of the ARM template. + /// + + /// The creation date of the armTemplate. + /// + + /// File name and parameter values information from all + /// azuredeploy.*.parameters.json for the ARM template. + /// + public ArmTemplateProperties(string displayName = default(string), string description = default(string), string publisher = default(string), string icon = default(string), object contents = default(object), System.DateTime? createdDate = default(System.DateTime?), System.Collections.Generic.IList parametersValueFilesInfo = default(System.Collections.Generic.IList)) + + { + this.DisplayName = displayName; + this.Description = description; + this.Publisher = publisher; + this.Icon = icon; + this.Contents = contents; + this.CreatedDate = createdDate; + this.ParametersValueFilesInfo = parametersValueFilesInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the display name of the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; private set; } + + /// + /// Gets the description of the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; private set; } + + /// + /// Gets the publisher of the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "publisher")] + public string Publisher {get; private set; } + + /// + /// Gets the URI to the icon of the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "icon")] + public string Icon {get; private set; } + + /// + /// Gets the contents of the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "contents")] + public object Contents {get; private set; } + + /// + /// Gets the creation date of the armTemplate. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets file name and parameter values information from all + /// azuredeploy.*.parameters.json for the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "parametersValueFilesInfo")] + public System.Collections.Generic.IList ParametersValueFilesInfo {get; private set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Artifact.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Artifact.cs new file mode 100644 index 000000000000..32b008c44b96 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Artifact.cs @@ -0,0 +1,135 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// An artifact. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Artifact : Resource + { + /// + /// Initializes a new instance of the Artifact class. + /// + public Artifact() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Artifact 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 artifact's title. + /// + + /// The artifact's description. + /// + + /// The artifact's publisher. + /// + + /// The file path to the artifact. + /// + + /// The URI to the artifact icon. + /// + + /// The artifact's target OS. + /// + + /// The artifact's parameters. + /// + + /// The artifact's creation date. + /// + public Artifact(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string title = default(string), string description = default(string), string publisher = default(string), string filePath = default(string), string icon = default(string), string targetOSType = default(string), object parameters = default(object), System.DateTime? createdDate = default(System.DateTime?)) + + : base(id, name, type, location, tags) + { + this.Title = title; + this.Description = description; + this.Publisher = publisher; + this.FilePath = filePath; + this.Icon = icon; + this.TargetOSType = targetOSType; + this.Parameters = parameters; + this.CreatedDate = createdDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the artifact's title. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.title")] + public string Title {get; private set; } + + /// + /// Gets the artifact's description. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; private set; } + + /// + /// Gets the artifact's publisher. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.publisher")] + public string Publisher {get; private set; } + + /// + /// Gets the file path to the artifact. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.filePath")] + public string FilePath {get; private set; } + + /// + /// Gets the URI to the artifact icon. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.icon")] + public string Icon {get; private set; } + + /// + /// Gets the artifact's target OS. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.targetOsType")] + public string TargetOSType {get; private set; } + + /// + /// Gets the artifact's parameters. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.parameters")] + public object Parameters {get; private set; } + + /// + /// Gets the artifact's creation date. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusProperties.cs new file mode 100644 index 000000000000..68376efc98b1 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an artifact deployment. + /// + public partial class ArtifactDeploymentStatusProperties + { + /// + /// Initializes a new instance of the ArtifactDeploymentStatusProperties class. + /// + public ArtifactDeploymentStatusProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactDeploymentStatusProperties class. + /// + + /// The deployment status of the artifact. + /// + + /// The total count of the artifacts that were successfully applied. + /// + + /// The total count of the artifacts that were tentatively applied. + /// + public ArtifactDeploymentStatusProperties(string deploymentStatus = default(string), int? artifactsApplied = default(int?), int? totalArtifacts = default(int?)) + + { + this.DeploymentStatus = deploymentStatus; + this.ArtifactsApplied = artifactsApplied; + this.TotalArtifacts = totalArtifacts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the deployment status of the artifact. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "deploymentStatus")] + public string DeploymentStatus {get; set; } + + /// + /// Gets or sets the total count of the artifacts that were successfully + /// applied. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifactsApplied")] + public int? ArtifactsApplied {get; set; } + + /// + /// Gets or sets the total count of the artifacts that were tentatively + /// applied. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "totalArtifacts")] + public int? TotalArtifacts {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusPropertiesFragment.cs new file mode 100644 index 000000000000..240a4ea20ab8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactDeploymentStatusPropertiesFragment.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an artifact deployment. + /// + public partial class ArtifactDeploymentStatusPropertiesFragment + { + /// + /// Initializes a new instance of the ArtifactDeploymentStatusPropertiesFragment class. + /// + public ArtifactDeploymentStatusPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactDeploymentStatusPropertiesFragment class. + /// + + /// The deployment status of the artifact. + /// + + /// The total count of the artifacts that were successfully applied. + /// + + /// The total count of the artifacts that were tentatively applied. + /// + public ArtifactDeploymentStatusPropertiesFragment(string deploymentStatus = default(string), int? artifactsApplied = default(int?), int? totalArtifacts = default(int?)) + + { + this.DeploymentStatus = deploymentStatus; + this.ArtifactsApplied = artifactsApplied; + this.TotalArtifacts = totalArtifacts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the deployment status of the artifact. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "deploymentStatus")] + public string DeploymentStatus {get; set; } + + /// + /// Gets or sets the total count of the artifacts that were successfully + /// applied. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifactsApplied")] + public int? ArtifactsApplied {get; set; } + + /// + /// Gets or sets the total count of the artifacts that were tentatively + /// applied. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "totalArtifacts")] + public int? TotalArtifacts {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallProperties.cs new file mode 100644 index 000000000000..60f0128c3534 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallProperties.cs @@ -0,0 +1,99 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an artifact. + /// + public partial class ArtifactInstallProperties + { + /// + /// Initializes a new instance of the ArtifactInstallProperties class. + /// + public ArtifactInstallProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactInstallProperties class. + /// + + /// The artifact's identifier. + /// + + /// The parameters of the artifact. + /// + + /// The status of the artifact. + /// + + /// The status message from the deployment. + /// + + /// The status message from the virtual machine extension. + /// + + /// The time that the artifact starts to install on the virtual machine. + /// + public ArtifactInstallProperties(string artifactId = default(string), System.Collections.Generic.IList parameters = default(System.Collections.Generic.IList), string status = default(string), string deploymentStatusMessage = default(string), string vmExtensionStatusMessage = default(string), System.DateTime? installTime = default(System.DateTime?)) + + { + this.ArtifactId = artifactId; + this.Parameters = parameters; + this.Status = status; + this.DeploymentStatusMessage = deploymentStatusMessage; + this.VMExtensionStatusMessage = vmExtensionStatusMessage; + this.InstallTime = installTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the artifact's identifier. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifactId")] + public string ArtifactId {get; set; } + + /// + /// Gets or sets the parameters of the artifact. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "parameters")] + public System.Collections.Generic.IList Parameters {get; set; } + + /// + /// Gets or sets the status of the artifact. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets the status message from the deployment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "deploymentStatusMessage")] + public string DeploymentStatusMessage {get; set; } + + /// + /// Gets or sets the status message from the virtual machine extension. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "vmExtensionStatusMessage")] + public string VMExtensionStatusMessage {get; set; } + + /// + /// Gets or sets the time that the artifact starts to install on the virtual + /// machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "installTime")] + public System.DateTime? InstallTime {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallPropertiesFragment.cs new file mode 100644 index 000000000000..1318fbef13c5 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactInstallPropertiesFragment.cs @@ -0,0 +1,99 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an artifact. + /// + public partial class ArtifactInstallPropertiesFragment + { + /// + /// Initializes a new instance of the ArtifactInstallPropertiesFragment class. + /// + public ArtifactInstallPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactInstallPropertiesFragment class. + /// + + /// The artifact's identifier. + /// + + /// The parameters of the artifact. + /// + + /// The status of the artifact. + /// + + /// The status message from the deployment. + /// + + /// The status message from the virtual machine extension. + /// + + /// The time that the artifact starts to install on the virtual machine. + /// + public ArtifactInstallPropertiesFragment(string artifactId = default(string), System.Collections.Generic.IList parameters = default(System.Collections.Generic.IList), string status = default(string), string deploymentStatusMessage = default(string), string vmExtensionStatusMessage = default(string), System.DateTime? installTime = default(System.DateTime?)) + + { + this.ArtifactId = artifactId; + this.Parameters = parameters; + this.Status = status; + this.DeploymentStatusMessage = deploymentStatusMessage; + this.VMExtensionStatusMessage = vmExtensionStatusMessage; + this.InstallTime = installTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the artifact's identifier. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifactId")] + public string ArtifactId {get; set; } + + /// + /// Gets or sets the parameters of the artifact. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "parameters")] + public System.Collections.Generic.IList Parameters {get; set; } + + /// + /// Gets or sets the status of the artifact. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets the status message from the deployment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "deploymentStatusMessage")] + public string DeploymentStatusMessage {get; set; } + + /// + /// Gets or sets the status message from the virtual machine extension. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "vmExtensionStatusMessage")] + public string VMExtensionStatusMessage {get; set; } + + /// + /// Gets or sets the time that the artifact starts to install on the virtual + /// machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "installTime")] + public System.DateTime? InstallTime {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterProperties.cs new file mode 100644 index 000000000000..97c6907499a8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterProperties.cs @@ -0,0 +1,58 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an artifact parameter. + /// + public partial class ArtifactParameterProperties + { + /// + /// Initializes a new instance of the ArtifactParameterProperties class. + /// + public ArtifactParameterProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactParameterProperties class. + /// + + /// The name of the artifact parameter. + /// + + /// The value of the artifact parameter. + /// + public ArtifactParameterProperties(string name = default(string), string value = default(string)) + + { + this.Name = name; + this.Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the artifact parameter. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets the value of the artifact parameter. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterPropertiesFragment.cs new file mode 100644 index 000000000000..1c959a47396e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactParameterPropertiesFragment.cs @@ -0,0 +1,58 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an artifact parameter. + /// + public partial class ArtifactParameterPropertiesFragment + { + /// + /// Initializes a new instance of the ArtifactParameterPropertiesFragment class. + /// + public ArtifactParameterPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactParameterPropertiesFragment class. + /// + + /// The name of the artifact parameter. + /// + + /// The value of the artifact parameter. + /// + public ArtifactParameterPropertiesFragment(string name = default(string), string value = default(string)) + + { + this.Name = name; + this.Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the artifact parameter. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets the value of the artifact parameter. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactProperties.cs new file mode 100644 index 000000000000..763a9b91784f --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactProperties.cs @@ -0,0 +1,118 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an artifact. + /// + public partial class ArtifactProperties + { + /// + /// Initializes a new instance of the ArtifactProperties class. + /// + public ArtifactProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactProperties class. + /// + + /// The artifact's title. + /// + + /// The artifact's description. + /// + + /// The artifact's publisher. + /// + + /// The file path to the artifact. + /// + + /// The URI to the artifact icon. + /// + + /// The artifact's target OS. + /// + + /// The artifact's parameters. + /// + + /// The artifact's creation date. + /// + public ArtifactProperties(string title = default(string), string description = default(string), string publisher = default(string), string filePath = default(string), string icon = default(string), string targetOSType = default(string), object parameters = default(object), System.DateTime? createdDate = default(System.DateTime?)) + + { + this.Title = title; + this.Description = description; + this.Publisher = publisher; + this.FilePath = filePath; + this.Icon = icon; + this.TargetOSType = targetOSType; + this.Parameters = parameters; + this.CreatedDate = createdDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the artifact's title. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "title")] + public string Title {get; private set; } + + /// + /// Gets the artifact's description. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; private set; } + + /// + /// Gets the artifact's publisher. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "publisher")] + public string Publisher {get; private set; } + + /// + /// Gets the file path to the artifact. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "filePath")] + public string FilePath {get; private set; } + + /// + /// Gets the URI to the artifact icon. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "icon")] + public string Icon {get; private set; } + + /// + /// Gets the artifact's target OS. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetOsType")] + public string TargetOSType {get; private set; } + + /// + /// Gets the artifact's parameters. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "parameters")] + public object Parameters {get; private set; } + + /// + /// Gets the artifact's creation date. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSource.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSource.cs new file mode 100644 index 000000000000..17ee83e3d8a1 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSource.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an artifact source. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class ArtifactSource : Resource + { + /// + /// Initializes a new instance of the ArtifactSource class. + /// + public ArtifactSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactSource 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 artifact source's display name. + /// + + /// The artifact source's URI. + /// + + /// The artifact source's type. + /// Possible values include: 'VsoGit', 'GitHub' + + /// The folder containing artifacts. + /// + + /// The folder containing Azure Resource Manager templates. + /// + + /// The artifact source's branch reference. + /// + + /// The security token to authenticate to the artifact source. + /// + + /// Indicates if the artifact source is enabled (values: Enabled, Disabled). + /// Possible values include: 'Enabled', 'Disabled' + + /// The artifact source's creation date. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public ArtifactSource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string displayName = default(string), string uri = default(string), string sourceType = default(string), string folderPath = default(string), string armTemplateFolderPath = default(string), string branchRef = default(string), string securityToken = default(string), string status = default(string), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.DisplayName = displayName; + this.Uri = uri; + this.SourceType = sourceType; + this.FolderPath = folderPath; + this.ArmTemplateFolderPath = armTemplateFolderPath; + this.BranchRef = branchRef; + this.SecurityToken = securityToken; + this.Status = status; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the artifact source's display name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets the artifact source's URI. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uri")] + public string Uri {get; set; } + + /// + /// Gets or sets the artifact source's type. Possible values include: 'VsoGit', 'GitHub' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.sourceType")] + public string SourceType {get; set; } + + /// + /// Gets or sets the folder containing artifacts. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.folderPath")] + public string FolderPath {get; set; } + + /// + /// Gets or sets the folder containing Azure Resource Manager templates. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.armTemplateFolderPath")] + public string ArmTemplateFolderPath {get; set; } + + /// + /// Gets or sets the artifact source's branch reference. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.branchRef")] + public string BranchRef {get; set; } + + /// + /// Gets or sets the security token to authenticate to the artifact source. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.securityToken")] + public string SecurityToken {get; set; } + + /// + /// Gets or sets indicates if the artifact source is enabled (values: Enabled, + /// Disabled). Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; set; } + + /// + /// Gets the artifact source's creation date. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceFragment.cs new file mode 100644 index 000000000000..7af813d79430 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceFragment.cs @@ -0,0 +1,156 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an artifact source. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class ArtifactSourceFragment : Resource + { + /// + /// Initializes a new instance of the ArtifactSourceFragment class. + /// + public ArtifactSourceFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactSourceFragment 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 artifact source's display name. + /// + + /// The artifact source's URI. + /// + + /// The artifact source's type. + /// Possible values include: 'VsoGit', 'GitHub' + + /// The folder containing artifacts. + /// + + /// The folder containing Azure Resource Manager templates. + /// + + /// The artifact source's branch reference. + /// + + /// The security token to authenticate to the artifact source. + /// + + /// Indicates if the artifact source is enabled (values: Enabled, Disabled). + /// Possible values include: 'Enabled', 'Disabled' + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public ArtifactSourceFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string displayName = default(string), string uri = default(string), string sourceType = default(string), string folderPath = default(string), string armTemplateFolderPath = default(string), string branchRef = default(string), string securityToken = default(string), string status = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.DisplayName = displayName; + this.Uri = uri; + this.SourceType = sourceType; + this.FolderPath = folderPath; + this.ArmTemplateFolderPath = armTemplateFolderPath; + this.BranchRef = branchRef; + this.SecurityToken = securityToken; + this.Status = status; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the artifact source's display name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets the artifact source's URI. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uri")] + public string Uri {get; set; } + + /// + /// Gets or sets the artifact source's type. Possible values include: 'VsoGit', 'GitHub' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.sourceType")] + public string SourceType {get; set; } + + /// + /// Gets or sets the folder containing artifacts. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.folderPath")] + public string FolderPath {get; set; } + + /// + /// Gets or sets the folder containing Azure Resource Manager templates. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.armTemplateFolderPath")] + public string ArmTemplateFolderPath {get; set; } + + /// + /// Gets or sets the artifact source's branch reference. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.branchRef")] + public string BranchRef {get; set; } + + /// + /// Gets or sets the security token to authenticate to the artifact source. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.securityToken")] + public string SecurityToken {get; set; } + + /// + /// Gets or sets indicates if the artifact source is enabled (values: Enabled, + /// Disabled). Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceProperties.cs new file mode 100644 index 000000000000..280e7f305ea8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourceProperties.cs @@ -0,0 +1,149 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an artifact source. + /// + public partial class ArtifactSourceProperties + { + /// + /// Initializes a new instance of the ArtifactSourceProperties class. + /// + public ArtifactSourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactSourceProperties class. + /// + + /// The artifact source's display name. + /// + + /// The artifact source's URI. + /// + + /// The artifact source's type. + /// Possible values include: 'VsoGit', 'GitHub' + + /// The folder containing artifacts. + /// + + /// The folder containing Azure Resource Manager templates. + /// + + /// The artifact source's branch reference. + /// + + /// The security token to authenticate to the artifact source. + /// + + /// Indicates if the artifact source is enabled (values: Enabled, Disabled). + /// Possible values include: 'Enabled', 'Disabled' + + /// The artifact source's creation date. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public ArtifactSourceProperties(string displayName = default(string), string uri = default(string), string sourceType = default(string), string folderPath = default(string), string armTemplateFolderPath = default(string), string branchRef = default(string), string securityToken = default(string), string status = default(string), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.DisplayName = displayName; + this.Uri = uri; + this.SourceType = sourceType; + this.FolderPath = folderPath; + this.ArmTemplateFolderPath = armTemplateFolderPath; + this.BranchRef = branchRef; + this.SecurityToken = securityToken; + this.Status = status; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the artifact source's display name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets the artifact source's URI. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uri")] + public string Uri {get; set; } + + /// + /// Gets or sets the artifact source's type. Possible values include: 'VsoGit', 'GitHub' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sourceType")] + public string SourceType {get; set; } + + /// + /// Gets or sets the folder containing artifacts. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "folderPath")] + public string FolderPath {get; set; } + + /// + /// Gets or sets the folder containing Azure Resource Manager templates. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "armTemplateFolderPath")] + public string ArmTemplateFolderPath {get; set; } + + /// + /// Gets or sets the artifact source's branch reference. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "branchRef")] + public string BranchRef {get; set; } + + /// + /// Gets or sets the security token to authenticate to the artifact source. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "securityToken")] + public string SecurityToken {get; set; } + + /// + /// Gets or sets indicates if the artifact source is enabled (values: Enabled, + /// Disabled). Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets the artifact source's creation date. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourcePropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourcePropertiesFragment.cs new file mode 100644 index 000000000000..50498aad0eeb --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ArtifactSourcePropertiesFragment.cs @@ -0,0 +1,139 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an artifact source. + /// + public partial class ArtifactSourcePropertiesFragment + { + /// + /// Initializes a new instance of the ArtifactSourcePropertiesFragment class. + /// + public ArtifactSourcePropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArtifactSourcePropertiesFragment class. + /// + + /// The artifact source's display name. + /// + + /// The artifact source's URI. + /// + + /// The artifact source's type. + /// Possible values include: 'VsoGit', 'GitHub' + + /// The folder containing artifacts. + /// + + /// The folder containing Azure Resource Manager templates. + /// + + /// The artifact source's branch reference. + /// + + /// The security token to authenticate to the artifact source. + /// + + /// Indicates if the artifact source is enabled (values: Enabled, Disabled). + /// Possible values include: 'Enabled', 'Disabled' + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public ArtifactSourcePropertiesFragment(string displayName = default(string), string uri = default(string), string sourceType = default(string), string folderPath = default(string), string armTemplateFolderPath = default(string), string branchRef = default(string), string securityToken = default(string), string status = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.DisplayName = displayName; + this.Uri = uri; + this.SourceType = sourceType; + this.FolderPath = folderPath; + this.ArmTemplateFolderPath = armTemplateFolderPath; + this.BranchRef = branchRef; + this.SecurityToken = securityToken; + this.Status = status; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the artifact source's display name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets the artifact source's URI. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uri")] + public string Uri {get; set; } + + /// + /// Gets or sets the artifact source's type. Possible values include: 'VsoGit', 'GitHub' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sourceType")] + public string SourceType {get; set; } + + /// + /// Gets or sets the folder containing artifacts. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "folderPath")] + public string FolderPath {get; set; } + + /// + /// Gets or sets the folder containing Azure Resource Manager templates. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "armTemplateFolderPath")] + public string ArmTemplateFolderPath {get; set; } + + /// + /// Gets or sets the artifact source's branch reference. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "branchRef")] + public string BranchRef {get; set; } + + /// + /// Gets or sets the security token to authenticate to the artifact source. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "securityToken")] + public string SecurityToken {get; set; } + + /// + /// Gets or sets indicates if the artifact source is enabled (values: Enabled, + /// Disabled). Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachDiskProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachDiskProperties.cs new file mode 100644 index 000000000000..424b6d3ff734 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachDiskProperties.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of the disk to attach. + /// + public partial class AttachDiskProperties + { + /// + /// Initializes a new instance of the AttachDiskProperties class. + /// + public AttachDiskProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AttachDiskProperties class. + /// + + /// The resource ID of the Lab virtual machine to which the disk is attached. + /// + public AttachDiskProperties(string leasedByLabVMId = default(string)) + + { + this.LeasedByLabVMId = leasedByLabVMId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the resource ID of the Lab virtual machine to which the disk + /// is attached. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "leasedByLabVmId")] + public string LeasedByLabVMId {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptions.cs new file mode 100644 index 000000000000..8e866518ee10 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/AttachNewDataDiskOptions.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties to attach new disk to the Virtual Machine. + /// + public partial class AttachNewDataDiskOptions + { + /// + /// Initializes a new instance of the AttachNewDataDiskOptions class. + /// + public AttachNewDataDiskOptions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AttachNewDataDiskOptions class. + /// + + /// Size of the disk to be attached in GibiBytes. + /// + + /// The name of the disk to be attached. + /// + + /// The storage type for the disk (i.e. Standard, Premium). + /// Possible values include: 'Standard', 'Premium' + public AttachNewDataDiskOptions(int? diskSizeGiB = default(int?), string diskName = default(string), string diskType = default(string)) + + { + this.DiskSizeGiB = diskSizeGiB; + this.DiskName = diskName; + this.DiskType = diskType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets size of the disk to be attached in GibiBytes. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "diskSizeGiB")] + public int? DiskSizeGiB {get; set; } + + /// + /// Gets or sets the name of the disk to be attached. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "diskName")] + public string DiskName {get; set; } + + /// + /// Gets or sets the storage type for the disk (i.e. Standard, Premium). Possible values include: 'Standard', 'Premium' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "diskType")] + public string DiskType {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParameters.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParameters.cs new file mode 100644 index 000000000000..bd380ccc14e2 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/BulkCreationParameters.cs @@ -0,0 +1,48 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Parameters for creating multiple virtual machines as a single action. + /// + public partial class BulkCreationParameters + { + /// + /// Initializes a new instance of the BulkCreationParameters class. + /// + public BulkCreationParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BulkCreationParameters class. + /// + + /// The number of virtual machine instances to create. + /// + public BulkCreationParameters(int? instanceCount = default(int?)) + + { + this.InstanceCount = instanceCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the number of virtual machine instances to create. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "instanceCount")] + public int? InstanceCount {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDisk.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDisk.cs new file mode 100644 index 000000000000..a6c0980f526d --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDisk.cs @@ -0,0 +1,79 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A data disks attached to a virtual machine. + /// + public partial class ComputeDataDisk + { + /// + /// Initializes a new instance of the ComputeDataDisk class. + /// + public ComputeDataDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeDataDisk class. + /// + + /// Gets data disk name. + /// + + /// When backed by a blob, the URI of underlying blob. + /// + + /// When backed by managed disk, this is the ID of the compute disk resource. + /// + + /// Gets data disk size in GiB. + /// + public ComputeDataDisk(string name = default(string), string diskUri = default(string), string managedDiskId = default(string), int? diskSizeGiB = default(int?)) + + { + this.Name = name; + this.DiskUri = diskUri; + this.ManagedDiskId = managedDiskId; + this.DiskSizeGiB = diskSizeGiB; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets gets data disk name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets when backed by a blob, the URI of underlying blob. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "diskUri")] + public string DiskUri {get; set; } + + /// + /// Gets or sets when backed by managed disk, this is the ID of the compute + /// disk resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "managedDiskId")] + public string ManagedDiskId {get; set; } + + /// + /// Gets or sets gets data disk size in GiB. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "diskSizeGiB")] + public int? DiskSizeGiB {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDiskFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDiskFragment.cs new file mode 100644 index 000000000000..7ea6f4bbf2f7 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeDataDiskFragment.cs @@ -0,0 +1,79 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A data disks attached to a virtual machine. + /// + public partial class ComputeDataDiskFragment + { + /// + /// Initializes a new instance of the ComputeDataDiskFragment class. + /// + public ComputeDataDiskFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeDataDiskFragment class. + /// + + /// Gets data disk name. + /// + + /// When backed by a blob, the URI of underlying blob. + /// + + /// When backed by managed disk, this is the ID of the compute disk resource. + /// + + /// Gets data disk size in GiB. + /// + public ComputeDataDiskFragment(string name = default(string), string diskUri = default(string), string managedDiskId = default(string), int? diskSizeGiB = default(int?)) + + { + this.Name = name; + this.DiskUri = diskUri; + this.ManagedDiskId = managedDiskId; + this.DiskSizeGiB = diskSizeGiB; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets gets data disk name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets when backed by a blob, the URI of underlying blob. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "diskUri")] + public string DiskUri {get; set; } + + /// + /// Gets or sets when backed by managed disk, this is the ID of the compute + /// disk resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "managedDiskId")] + public string ManagedDiskId {get; set; } + + /// + /// Gets or sets gets data disk size in GiB. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "diskSizeGiB")] + public int? DiskSizeGiB {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatus.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatus.cs new file mode 100644 index 000000000000..f4245c8e4768 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatus.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Status information about a virtual machine. + /// + public partial class ComputeVmInstanceViewStatus + { + /// + /// Initializes a new instance of the ComputeVmInstanceViewStatus class. + /// + public ComputeVmInstanceViewStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeVmInstanceViewStatus class. + /// + + /// Gets the status Code. + /// + + /// Gets the short localizable label for the status. + /// + + /// Gets the message associated with the status. + /// + public ComputeVmInstanceViewStatus(string code = default(string), string displayStatus = default(string), string message = default(string)) + + { + this.Code = code; + this.DisplayStatus = displayStatus; + this.Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets gets the status Code. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } + + /// + /// Gets or sets gets the short localizable label for the status. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayStatus")] + public string DisplayStatus {get; set; } + + /// + /// Gets or sets gets the message associated with the status. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatusFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatusFragment.cs new file mode 100644 index 000000000000..c5925c31e413 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmInstanceViewStatusFragment.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Status information about a virtual machine. + /// + public partial class ComputeVmInstanceViewStatusFragment + { + /// + /// Initializes a new instance of the ComputeVmInstanceViewStatusFragment class. + /// + public ComputeVmInstanceViewStatusFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeVmInstanceViewStatusFragment class. + /// + + /// Gets the status Code. + /// + + /// Gets the short localizable label for the status. + /// + + /// Gets the message associated with the status. + /// + public ComputeVmInstanceViewStatusFragment(string code = default(string), string displayStatus = default(string), string message = default(string)) + + { + this.Code = code; + this.DisplayStatus = displayStatus; + this.Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets gets the status Code. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } + + /// + /// Gets or sets gets the short localizable label for the status. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayStatus")] + public string DisplayStatus {get; set; } + + /// + /// Gets or sets gets the message associated with the status. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmProperties.cs new file mode 100644 index 000000000000..38d042e5949b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a virtual machine returned by the Microsoft.Compute API. + /// + public partial class ComputeVmProperties + { + /// + /// Initializes a new instance of the ComputeVmProperties class. + /// + public ComputeVmProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeVmProperties class. + /// + + /// Gets the statuses of the virtual machine. + /// + + /// Gets the OS type of the virtual machine. + /// + + /// Gets the size of the virtual machine. + /// + + /// Gets the network interface ID of the virtual machine. + /// + + /// Gets OS disk blob uri for the virtual machine. + /// + + /// Gets data disks blob uri for the virtual machine. + /// + + /// Gets all data disks attached to the virtual machine. + /// + public ComputeVmProperties(System.Collections.Generic.IList statuses = default(System.Collections.Generic.IList), string osType = default(string), string vmSize = default(string), string networkInterfaceId = default(string), string osDiskId = default(string), System.Collections.Generic.IList dataDiskIds = default(System.Collections.Generic.IList), System.Collections.Generic.IList dataDisks = default(System.Collections.Generic.IList)) + + { + this.Statuses = statuses; + this.OSType = osType; + this.VMSize = vmSize; + this.NetworkInterfaceId = networkInterfaceId; + this.OSDiskId = osDiskId; + this.DataDiskIds = dataDiskIds; + this.DataDisks = dataDisks; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets gets the statuses of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "statuses")] + public System.Collections.Generic.IList Statuses {get; set; } + + /// + /// Gets or sets gets the OS type of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "osType")] + public string OSType {get; set; } + + /// + /// Gets or sets gets the size of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "vmSize")] + public string VMSize {get; set; } + + /// + /// Gets or sets gets the network interface ID of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "networkInterfaceId")] + public string NetworkInterfaceId {get; set; } + + /// + /// Gets or sets gets OS disk blob uri for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "osDiskId")] + public string OSDiskId {get; set; } + + /// + /// Gets or sets gets data disks blob uri for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dataDiskIds")] + public System.Collections.Generic.IList DataDiskIds {get; set; } + + /// + /// Gets or sets gets all data disks attached to the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dataDisks")] + public System.Collections.Generic.IList DataDisks {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmPropertiesFragment.cs new file mode 100644 index 000000000000..ed0d26b90a49 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ComputeVmPropertiesFragment.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a virtual machine returned by the Microsoft.Compute API. + /// + public partial class ComputeVmPropertiesFragment + { + /// + /// Initializes a new instance of the ComputeVmPropertiesFragment class. + /// + public ComputeVmPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeVmPropertiesFragment class. + /// + + /// Gets the statuses of the virtual machine. + /// + + /// Gets the OS type of the virtual machine. + /// + + /// Gets the size of the virtual machine. + /// + + /// Gets the network interface ID of the virtual machine. + /// + + /// Gets OS disk blob uri for the virtual machine. + /// + + /// Gets data disks blob uri for the virtual machine. + /// + + /// Gets all data disks attached to the virtual machine. + /// + public ComputeVmPropertiesFragment(System.Collections.Generic.IList statuses = default(System.Collections.Generic.IList), string osType = default(string), string vmSize = default(string), string networkInterfaceId = default(string), string osDiskId = default(string), System.Collections.Generic.IList dataDiskIds = default(System.Collections.Generic.IList), System.Collections.Generic.IList dataDisks = default(System.Collections.Generic.IList)) + + { + this.Statuses = statuses; + this.OSType = osType; + this.VMSize = vmSize; + this.NetworkInterfaceId = networkInterfaceId; + this.OSDiskId = osDiskId; + this.DataDiskIds = dataDiskIds; + this.DataDisks = dataDisks; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets gets the statuses of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "statuses")] + public System.Collections.Generic.IList Statuses {get; set; } + + /// + /// Gets or sets gets the OS type of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "osType")] + public string OSType {get; set; } + + /// + /// Gets or sets gets the size of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "vmSize")] + public string VMSize {get; set; } + + /// + /// Gets or sets gets the network interface ID of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "networkInterfaceId")] + public string NetworkInterfaceId {get; set; } + + /// + /// Gets or sets gets OS disk blob uri for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "osDiskId")] + public string OSDiskId {get; set; } + + /// + /// Gets or sets gets data disks blob uri for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dataDiskIds")] + public System.Collections.Generic.IList DataDiskIds {get; set; } + + /// + /// Gets or sets gets all data disks attached to the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dataDisks")] + public System.Collections.Generic.IList DataDisks {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdProperties.cs new file mode 100644 index 000000000000..a880fe90b24e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a cost threshold item. + /// + public partial class CostThresholdProperties + { + /// + /// Initializes a new instance of the CostThresholdProperties class. + /// + public CostThresholdProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CostThresholdProperties class. + /// + + /// The ID of the cost threshold item. + /// + + /// The value of the percentage cost threshold. + /// + + /// Indicates whether this threshold will be displayed on cost charts. + /// Possible values include: 'Enabled', 'Disabled' + + /// Indicates whether notifications will be sent when this threshold is + /// exceeded. + /// Possible values include: 'Enabled', 'Disabled' + + /// Indicates the datetime when notifications were last sent for this + /// threshold. + /// + public CostThresholdProperties(string thresholdId = default(string), PercentageCostThresholdProperties percentageThreshold = default(PercentageCostThresholdProperties), string displayOnChart = default(string), string sendNotificationWhenExceeded = default(string), string notificationSent = default(string)) + + { + this.ThresholdId = thresholdId; + this.PercentageThreshold = percentageThreshold; + this.DisplayOnChart = displayOnChart; + this.SendNotificationWhenExceeded = sendNotificationWhenExceeded; + this.NotificationSent = notificationSent; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the ID of the cost threshold item. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "thresholdId")] + public string ThresholdId {get; set; } + + /// + /// Gets or sets the value of the percentage cost threshold. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "percentageThreshold")] + public PercentageCostThresholdProperties PercentageThreshold {get; set; } + + /// + /// Gets or sets indicates whether this threshold will be displayed on cost + /// charts. Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayOnChart")] + public string DisplayOnChart {get; set; } + + /// + /// Gets or sets indicates whether notifications will be sent when this + /// threshold is exceeded. Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sendNotificationWhenExceeded")] + public string SendNotificationWhenExceeded {get; set; } + + /// + /// Gets or sets indicates the datetime when notifications were last sent for + /// this threshold. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "notificationSent")] + public string NotificationSent {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdStatus.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdStatus.cs new file mode 100644 index 000000000000..88da50235131 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostThresholdStatus.cs @@ -0,0 +1,19 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for CostThresholdStatus. + /// + + + public static class CostThresholdStatus + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostType.cs new file mode 100644 index 000000000000..f273e65d08c9 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CostType.cs @@ -0,0 +1,20 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for CostType. + /// + + + public static class CostType + { + public const string Unavailable = "Unavailable"; + public const string Reported = "Reported"; + public const string Projected = "Projected"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImage.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImage.cs new file mode 100644 index 000000000000..32f87cddcf74 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImage.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A custom image. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class CustomImage : Resource + { + /// + /// Initializes a new instance of the CustomImage class. + /// + public CustomImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomImage 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 virtual machine from which the image is to be created. + /// + + /// The VHD from which the image is to be created. + /// + + /// The description of the custom image. + /// + + /// The author of the custom image. + /// + + /// The creation date of the custom image. + /// + + /// The Managed Image Id backing the custom image. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public CustomImage(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), CustomImagePropertiesFromVm vm = default(CustomImagePropertiesFromVm), CustomImagePropertiesCustom vhd = default(CustomImagePropertiesCustom), string description = default(string), string author = default(string), System.DateTime? creationDate = default(System.DateTime?), string managedImageId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.VM = vm; + this.Vhd = vhd; + this.Description = description; + this.Author = author; + this.CreationDate = creationDate; + this.ManagedImageId = managedImageId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the virtual machine from which the image is to be created. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.vm")] + public CustomImagePropertiesFromVm VM {get; set; } + + /// + /// Gets or sets the VHD from which the image is to be created. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.vhd")] + public CustomImagePropertiesCustom Vhd {get; set; } + + /// + /// Gets or sets the description of the custom image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } + + /// + /// Gets or sets the author of the custom image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.author")] + public string Author {get; set; } + + /// + /// Gets the creation date of the custom image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.creationDate")] + public System.DateTime? CreationDate {get; private set; } + + /// + /// Gets or sets the Managed Image Id backing the custom image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.managedImageId")] + public string ManagedImageId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + if (this.Vhd != null) + { + this.Vhd.Validate(); + } + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageOsType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageOsType.cs new file mode 100644 index 000000000000..0a1b1ebbc090 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageOsType.cs @@ -0,0 +1,20 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for CustomImageOsType. + /// + + + public static class CustomImageOsType + { + public const string Windows = "Windows"; + public const string Linux = "Linux"; + public const string None = "None"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageProperties.cs new file mode 100644 index 000000000000..5c00660dbbfe --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImageProperties.cs @@ -0,0 +1,137 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a custom image. + /// + public partial class CustomImageProperties + { + /// + /// Initializes a new instance of the CustomImageProperties class. + /// + public CustomImageProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomImageProperties class. + /// + + /// The virtual machine from which the image is to be created. + /// + + /// The VHD from which the image is to be created. + /// + + /// The description of the custom image. + /// + + /// The author of the custom image. + /// + + /// The creation date of the custom image. + /// + + /// The Managed Image Id backing the custom image. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public CustomImageProperties(CustomImagePropertiesFromVm vm = default(CustomImagePropertiesFromVm), CustomImagePropertiesCustom vhd = default(CustomImagePropertiesCustom), string description = default(string), string author = default(string), System.DateTime? creationDate = default(System.DateTime?), string managedImageId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.VM = vm; + this.Vhd = vhd; + this.Description = description; + this.Author = author; + this.CreationDate = creationDate; + this.ManagedImageId = managedImageId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the virtual machine from which the image is to be created. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "vm")] + public CustomImagePropertiesFromVm VM {get; set; } + + /// + /// Gets or sets the VHD from which the image is to be created. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "vhd")] + public CustomImagePropertiesCustom Vhd {get; set; } + + /// + /// Gets or sets the description of the custom image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the author of the custom image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "author")] + public string Author {get; set; } + + /// + /// Gets the creation date of the custom image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "creationDate")] + public System.DateTime? CreationDate {get; private set; } + + /// + /// Gets or sets the Managed Image Id backing the custom image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "managedImageId")] + public string ManagedImageId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + if (this.Vhd != null) + { + this.Vhd.Validate(); + } + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustom.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustom.cs new file mode 100644 index 000000000000..03af67162266 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesCustom.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties for creating a custom image from a VHD. + /// + public partial class CustomImagePropertiesCustom + { + /// + /// Initializes a new instance of the CustomImagePropertiesCustom class. + /// + public CustomImagePropertiesCustom() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomImagePropertiesCustom class. + /// + + /// The image name. + /// + + /// Indicates whether sysprep has been run on the VHD. + /// + + /// The OS type of the custom image (i.e. Windows, Linux) + /// Possible values include: 'Windows', 'Linux', 'None' + public CustomImagePropertiesCustom(string osType, string imageName = default(string), bool? sysPrep = default(bool?)) + + { + this.ImageName = imageName; + this.SysPrep = sysPrep; + this.OSType = osType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the image name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "imageName")] + public string ImageName {get; set; } + + /// + /// Gets or sets indicates whether sysprep has been run on the VHD. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sysPrep")] + public bool? SysPrep {get; set; } + + /// + /// Gets or sets the OS type of the custom image (i.e. Windows, Linux) Possible values include: 'Windows', 'Linux', 'None' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "osType")] + public string OSType {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.OSType == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "OSType"); + } + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVm.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVm.cs new file mode 100644 index 000000000000..88ad7d944fd9 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/CustomImagePropertiesFromVm.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties for creating a custom image from a virtual machine. + /// + public partial class CustomImagePropertiesFromVm + { + /// + /// Initializes a new instance of the CustomImagePropertiesFromVm class. + /// + public CustomImagePropertiesFromVm() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomImagePropertiesFromVm class. + /// + + /// The source vm identifier. + /// + + /// The Windows OS information of the VM. + /// + + /// The Linux OS information of the VM. + /// + public CustomImagePropertiesFromVm(string sourceVMId = default(string), WindowsOsInfo windowsOSInfo = default(WindowsOsInfo), LinuxOsInfo linuxOSInfo = default(LinuxOsInfo)) + + { + this.SourceVMId = sourceVMId; + this.WindowsOSInfo = windowsOSInfo; + this.LinuxOSInfo = linuxOSInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the source vm identifier. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sourceVmId")] + public string SourceVMId {get; set; } + + /// + /// Gets or sets the Windows OS information of the VM. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "windowsOsInfo")] + public WindowsOsInfo WindowsOSInfo {get; set; } + + /// + /// Gets or sets the Linux OS information of the VM. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "linuxOsInfo")] + public LinuxOsInfo LinuxOSInfo {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskProperties.cs new file mode 100644 index 000000000000..d8e88f29be16 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DataDiskProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Request body for adding a new or existing data disk to a virtual machine. + /// + public partial class DataDiskProperties + { + /// + /// Initializes a new instance of the DataDiskProperties class. + /// + public DataDiskProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataDiskProperties class. + /// + + /// Specifies options to attach a new disk to the virtual machine. + /// + + /// Specifies the existing lab disk id to attach to virtual machine. + /// + + /// Caching option for a data disk (i.e. None, ReadOnly, ReadWrite). + /// Possible values include: 'None', 'ReadOnly', 'ReadWrite' + public DataDiskProperties(AttachNewDataDiskOptions attachNewDataDiskOptions = default(AttachNewDataDiskOptions), string existingLabDiskId = default(string), string hostCaching = default(string)) + + { + this.AttachNewDataDiskOptions = attachNewDataDiskOptions; + this.ExistingLabDiskId = existingLabDiskId; + this.HostCaching = hostCaching; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets specifies options to attach a new disk to the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "attachNewDataDiskOptions")] + public AttachNewDataDiskOptions AttachNewDataDiskOptions {get; set; } + + /// + /// Gets or sets specifies the existing lab disk id to attach to virtual + /// machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "existingLabDiskId")] + public string ExistingLabDiskId {get; set; } + + /// + /// Gets or sets caching option for a data disk (i.e. None, ReadOnly, + /// ReadWrite). Possible values include: 'None', 'ReadOnly', 'ReadWrite' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "hostCaching")] + public string HostCaching {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetails.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetails.cs new file mode 100644 index 000000000000..ccde19a43693 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetails.cs @@ -0,0 +1,48 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a daily schedule. + /// + public partial class DayDetails + { + /// + /// Initializes a new instance of the DayDetails class. + /// + public DayDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DayDetails class. + /// + + /// The time of day the schedule will occur. + /// + public DayDetails(string time = default(string)) + + { + this.Time = time; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the time of day the schedule will occur. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "time")] + public string Time {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetailsFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetailsFragment.cs new file mode 100644 index 000000000000..626bf8068f50 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DayDetailsFragment.cs @@ -0,0 +1,48 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a daily schedule. + /// + public partial class DayDetailsFragment + { + /// + /// Initializes a new instance of the DayDetailsFragment class. + /// + public DayDetailsFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DayDetailsFragment class. + /// + + /// The time of day the schedule will occur. + /// + public DayDetailsFragment(string time = default(string)) + + { + this.Time = time; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the time of day the schedule will occur. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "time")] + public string Time {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDataDiskProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDataDiskProperties.cs new file mode 100644 index 000000000000..6a88ef5a2046 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDataDiskProperties.cs @@ -0,0 +1,48 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Request body for detaching data disk from a virtual machine. + /// + public partial class DetachDataDiskProperties + { + /// + /// Initializes a new instance of the DetachDataDiskProperties class. + /// + public DetachDataDiskProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DetachDataDiskProperties class. + /// + + /// Specifies the disk resource ID to detach from virtual machine. + /// + public DetachDataDiskProperties(string existingLabDiskId = default(string)) + + { + this.ExistingLabDiskId = existingLabDiskId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets specifies the disk resource ID to detach from virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "existingLabDiskId")] + public string ExistingLabDiskId {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDiskProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDiskProperties.cs new file mode 100644 index 000000000000..b7e962b8c5e5 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DetachDiskProperties.cs @@ -0,0 +1,48 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of the disk to detach. + /// + public partial class DetachDiskProperties + { + /// + /// Initializes a new instance of the DetachDiskProperties class. + /// + public DetachDiskProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DetachDiskProperties class. + /// + + /// The resource ID of the Lab VM to which the disk is attached. + /// + public DetachDiskProperties(string leasedByLabVMId = default(string)) + + { + this.LeasedByLabVMId = leasedByLabVMId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the resource ID of the Lab VM to which the disk is attached. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "leasedByLabVmId")] + public string LeasedByLabVMId {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Disk.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Disk.cs new file mode 100644 index 000000000000..f10edc0bcf0c --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Disk.cs @@ -0,0 +1,158 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A Disk. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Disk : Resource + { + /// + /// Initializes a new instance of the Disk class. + /// + public Disk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Disk 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 storage type for the disk (i.e. Standard, Premium). + /// Possible values include: 'Standard', 'Premium' + + /// The size of the disk in GibiBytes. + /// + + /// The resource ID of the VM to which this disk is leased. + /// + + /// When backed by a blob, the name of the VHD blob without extension. + /// + + /// When backed by a blob, the URI of underlying blob. + /// + + /// The creation date of the disk. + /// + + /// The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). + /// + + /// When backed by managed disk, this is the ID of the compute disk resource. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public Disk(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string diskType = default(string), int? diskSizeGiB = default(int?), string leasedByLabVMId = default(string), string diskBlobName = default(string), string diskUri = default(string), System.DateTime? createdDate = default(System.DateTime?), string hostCaching = default(string), string managedDiskId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.DiskType = diskType; + this.DiskSizeGiB = diskSizeGiB; + this.LeasedByLabVMId = leasedByLabVMId; + this.DiskBlobName = diskBlobName; + this.DiskUri = diskUri; + this.CreatedDate = createdDate; + this.HostCaching = hostCaching; + this.ManagedDiskId = managedDiskId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the storage type for the disk (i.e. Standard, Premium). Possible values include: 'Standard', 'Premium' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.diskType")] + public string DiskType {get; set; } + + /// + /// Gets or sets the size of the disk in GibiBytes. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.diskSizeGiB")] + public int? DiskSizeGiB {get; set; } + + /// + /// Gets or sets the resource ID of the VM to which this disk is leased. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.leasedByLabVmId")] + public string LeasedByLabVMId {get; set; } + + /// + /// Gets or sets when backed by a blob, the name of the VHD blob without + /// extension. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.diskBlobName")] + public string DiskBlobName {get; set; } + + /// + /// Gets or sets when backed by a blob, the URI of underlying blob. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.diskUri")] + public string DiskUri {get; set; } + + /// + /// Gets the creation date of the disk. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the host caching policy of the disk (i.e. None, ReadOnly, + /// ReadWrite). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.hostCaching")] + public string HostCaching {get; set; } + + /// + /// Gets or sets when backed by managed disk, this is the ID of the compute + /// disk resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.managedDiskId")] + public string ManagedDiskId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DiskProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DiskProperties.cs new file mode 100644 index 000000000000..2b2a5af4dd25 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DiskProperties.cs @@ -0,0 +1,141 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a disk. + /// + public partial class DiskProperties + { + /// + /// Initializes a new instance of the DiskProperties class. + /// + public DiskProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskProperties class. + /// + + /// The storage type for the disk (i.e. Standard, Premium). + /// Possible values include: 'Standard', 'Premium' + + /// The size of the disk in GibiBytes. + /// + + /// The resource ID of the VM to which this disk is leased. + /// + + /// When backed by a blob, the name of the VHD blob without extension. + /// + + /// When backed by a blob, the URI of underlying blob. + /// + + /// The creation date of the disk. + /// + + /// The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). + /// + + /// When backed by managed disk, this is the ID of the compute disk resource. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public DiskProperties(string diskType = default(string), int? diskSizeGiB = default(int?), string leasedByLabVMId = default(string), string diskBlobName = default(string), string diskUri = default(string), System.DateTime? createdDate = default(System.DateTime?), string hostCaching = default(string), string managedDiskId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.DiskType = diskType; + this.DiskSizeGiB = diskSizeGiB; + this.LeasedByLabVMId = leasedByLabVMId; + this.DiskBlobName = diskBlobName; + this.DiskUri = diskUri; + this.CreatedDate = createdDate; + this.HostCaching = hostCaching; + this.ManagedDiskId = managedDiskId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the storage type for the disk (i.e. Standard, Premium). Possible values include: 'Standard', 'Premium' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "diskType")] + public string DiskType {get; set; } + + /// + /// Gets or sets the size of the disk in GibiBytes. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "diskSizeGiB")] + public int? DiskSizeGiB {get; set; } + + /// + /// Gets or sets the resource ID of the VM to which this disk is leased. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "leasedByLabVmId")] + public string LeasedByLabVMId {get; set; } + + /// + /// Gets or sets when backed by a blob, the name of the VHD blob without + /// extension. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "diskBlobName")] + public string DiskBlobName {get; set; } + + /// + /// Gets or sets when backed by a blob, the URI of underlying blob. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "diskUri")] + public string DiskUri {get; set; } + + /// + /// Gets the creation date of the disk. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the host caching policy of the disk (i.e. None, ReadOnly, + /// ReadWrite). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "hostCaching")] + public string HostCaching {get; set; } + + /// + /// Gets or sets when backed by managed disk, this is the ID of the compute + /// disk resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "managedDiskId")] + public string ManagedDiskId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironment.cs new file mode 100644 index 000000000000..cf3276c72607 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/DtlEnvironment.cs @@ -0,0 +1,119 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// An environment, which is essentially an ARM template deployment. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class DtlEnvironment : Resource + { + /// + /// Initializes a new instance of the DtlEnvironment class. + /// + public DtlEnvironment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DtlEnvironment 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 deployment properties of the environment. + /// + + /// The display name of the Azure Resource Manager template that produced the + /// environment. + /// + + /// The identifier of the resource group containing the environment's + /// resources. + /// + + /// The creator of the environment. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public DtlEnvironment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), EnvironmentDeploymentProperties deploymentProperties = default(EnvironmentDeploymentProperties), string armTemplateDisplayName = default(string), string resourceGroupId = default(string), string createdByUser = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.DeploymentProperties = deploymentProperties; + this.ArmTemplateDisplayName = armTemplateDisplayName; + this.ResourceGroupId = resourceGroupId; + this.CreatedByUser = createdByUser; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the deployment properties of the environment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.deploymentProperties")] + public EnvironmentDeploymentProperties DeploymentProperties {get; set; } + + /// + /// Gets or sets the display name of the Azure Resource Manager template that + /// produced the environment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.armTemplateDisplayName")] + public string ArmTemplateDisplayName {get; set; } + + /// + /// Gets the identifier of the resource group containing the environment's + /// resources. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.resourceGroupId")] + public string ResourceGroupId {get; private set; } + + /// + /// Gets the creator of the environment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByUser")] + public string CreatedByUser {get; private set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnableStatus.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnableStatus.cs new file mode 100644 index 000000000000..2cae1466a544 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnableStatus.cs @@ -0,0 +1,19 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for EnableStatus. + /// + + + public static class EnableStatus + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentProperties.cs new file mode 100644 index 000000000000..682751389878 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentDeploymentProperties.cs @@ -0,0 +1,58 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an environment deployment. + /// + public partial class EnvironmentDeploymentProperties + { + /// + /// Initializes a new instance of the EnvironmentDeploymentProperties class. + /// + public EnvironmentDeploymentProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnvironmentDeploymentProperties class. + /// + + /// The Azure Resource Manager template's identifier. + /// + + /// The parameters of the Azure Resource Manager template. + /// + public EnvironmentDeploymentProperties(string armTemplateId = default(string), System.Collections.Generic.IList parameters = default(System.Collections.Generic.IList)) + + { + this.ArmTemplateId = armTemplateId; + this.Parameters = parameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the Azure Resource Manager template's identifier. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "armTemplateId")] + public string ArmTemplateId {get; set; } + + /// + /// Gets or sets the parameters of the Azure Resource Manager template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "parameters")] + public System.Collections.Generic.IList Parameters {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentProperties.cs new file mode 100644 index 000000000000..d5e0093b9fb3 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EnvironmentProperties.cs @@ -0,0 +1,102 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an environment. + /// + public partial class EnvironmentProperties + { + /// + /// Initializes a new instance of the EnvironmentProperties class. + /// + public EnvironmentProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnvironmentProperties class. + /// + + /// The deployment properties of the environment. + /// + + /// The display name of the Azure Resource Manager template that produced the + /// environment. + /// + + /// The identifier of the resource group containing the environment's + /// resources. + /// + + /// The creator of the environment. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public EnvironmentProperties(EnvironmentDeploymentProperties deploymentProperties = default(EnvironmentDeploymentProperties), string armTemplateDisplayName = default(string), string resourceGroupId = default(string), string createdByUser = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.DeploymentProperties = deploymentProperties; + this.ArmTemplateDisplayName = armTemplateDisplayName; + this.ResourceGroupId = resourceGroupId; + this.CreatedByUser = createdByUser; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the deployment properties of the environment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "deploymentProperties")] + public EnvironmentDeploymentProperties DeploymentProperties {get; set; } + + /// + /// Gets or sets the display name of the Azure Resource Manager template that + /// produced the environment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "armTemplateDisplayName")] + public string ArmTemplateDisplayName {get; set; } + + /// + /// Gets the identifier of the resource group containing the environment's + /// resources. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceGroupId")] + public string ResourceGroupId {get; private set; } + + /// + /// Gets the creator of the environment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByUser")] + public string CreatedByUser {get; private set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesProperties.cs new file mode 100644 index 000000000000..3bc52cfa91a8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties for evaluating a policy set. + /// + public partial class EvaluatePoliciesProperties + { + /// + /// Initializes a new instance of the EvaluatePoliciesProperties class. + /// + public EvaluatePoliciesProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EvaluatePoliciesProperties class. + /// + + /// The fact name. + /// + + /// The fact data. + /// + + /// The value offset. + /// + public EvaluatePoliciesProperties(string factName = default(string), string factData = default(string), string valueOffset = default(string)) + + { + this.FactName = factName; + this.FactData = factData; + this.ValueOffset = valueOffset; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the fact name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "factName")] + public string FactName {get; set; } + + /// + /// Gets or sets the fact data. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "factData")] + public string FactData {get; set; } + + /// + /// Gets or sets the value offset. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "valueOffset")] + public string ValueOffset {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesRequest.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesRequest.cs new file mode 100644 index 000000000000..8ea313544d2a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesRequest.cs @@ -0,0 +1,48 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Request body for evaluating a policy set. + /// + public partial class EvaluatePoliciesRequest + { + /// + /// Initializes a new instance of the EvaluatePoliciesRequest class. + /// + public EvaluatePoliciesRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EvaluatePoliciesRequest class. + /// + + /// Policies to evaluate. + /// + public EvaluatePoliciesRequest(System.Collections.Generic.IList policies = default(System.Collections.Generic.IList)) + + { + this.Policies = policies; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets policies to evaluate. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "policies")] + public System.Collections.Generic.IList Policies {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesResponse.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesResponse.cs new file mode 100644 index 000000000000..0dbd65f4391f --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EvaluatePoliciesResponse.cs @@ -0,0 +1,48 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Response body for evaluating a policy set. + /// + public partial class EvaluatePoliciesResponse + { + /// + /// Initializes a new instance of the EvaluatePoliciesResponse class. + /// + public EvaluatePoliciesResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EvaluatePoliciesResponse class. + /// + + /// Results of evaluating a policy set. + /// + public EvaluatePoliciesResponse(System.Collections.Generic.IList results = default(System.Collections.Generic.IList)) + + { + this.Results = results; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets results of evaluating a policy set. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "results")] + public System.Collections.Generic.IList Results {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventFragment.cs new file mode 100644 index 000000000000..16ceb43dac3e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventFragment.cs @@ -0,0 +1,50 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// An event to be notified for. + /// + public partial class EventFragment + { + /// + /// Initializes a new instance of the EventFragment class. + /// + public EventFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EventFragment class. + /// + + /// The event type for which this notification is enabled (i.e. AutoShutdown, + /// Cost) + /// Possible values include: 'AutoShutdown', 'Cost' + public EventFragment(string eventName = default(string)) + + { + this.EventName = eventName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the event type for which this notification is enabled (i.e. + /// AutoShutdown, Cost) Possible values include: 'AutoShutdown', 'Cost' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "eventName")] + public string EventName {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventModel.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventModel.cs new file mode 100644 index 000000000000..8d0b18eceb8a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/EventModel.cs @@ -0,0 +1,50 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// An event to be notified for. + /// + public partial class EventModel + { + /// + /// Initializes a new instance of the EventModel class. + /// + public EventModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EventModel class. + /// + + /// The event type for which this notification is enabled (i.e. AutoShutdown, + /// Cost) + /// Possible values include: 'AutoShutdown', 'Cost' + public EventModel(string eventName = default(string)) + + { + this.EventName = eventName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the event type for which this notification is enabled (i.e. + /// AutoShutdown, Cost) Possible values include: 'AutoShutdown', 'Cost' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "eventName")] + public string EventName {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExportResourceUsageParameters.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExportResourceUsageParameters.cs new file mode 100644 index 000000000000..4a435cfb7648 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExportResourceUsageParameters.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// The parameters of the export operation. + /// + public partial class ExportResourceUsageParameters + { + /// + /// Initializes a new instance of the ExportResourceUsageParameters class. + /// + public ExportResourceUsageParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExportResourceUsageParameters class. + /// + + /// The blob storage absolute sas uri with write permission to the container + /// which the usage data needs to be uploaded to. + /// + + /// The start time of the usage. If not provided, usage will be reported since + /// the beginning of data collection. + /// + public ExportResourceUsageParameters(string blobStorageAbsoluteSasUri = default(string), System.DateTime? usageStartDate = default(System.DateTime?)) + + { + this.BlobStorageAbsoluteSasUri = blobStorageAbsoluteSasUri; + this.UsageStartDate = usageStartDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the blob storage absolute sas uri with write permission to the + /// container which the usage data needs to be uploaded to. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "blobStorageAbsoluteSasUri")] + public string BlobStorageAbsoluteSasUri {get; set; } + + /// + /// Gets or sets the start time of the usage. If not provided, usage will be + /// reported since the beginning of data collection. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "usageStartDate")] + public System.DateTime? UsageStartDate {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnet.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnet.cs new file mode 100644 index 000000000000..63b833351697 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnet.cs @@ -0,0 +1,58 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Subnet information as returned by the Microsoft.Network API. + /// + public partial class ExternalSubnet + { + /// + /// Initializes a new instance of the ExternalSubnet class. + /// + public ExternalSubnet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExternalSubnet class. + /// + + /// Gets or sets the identifier. + /// + + /// Gets or sets the name. + /// + public ExternalSubnet(string id = default(string), string name = default(string)) + + { + this.Id = id; + this.Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets gets or sets the identifier. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } + + /// + /// Gets or sets gets or sets the name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnetFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnetFragment.cs new file mode 100644 index 000000000000..f82e7398706b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ExternalSubnetFragment.cs @@ -0,0 +1,58 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Subnet information as returned by the Microsoft.Network API. + /// + public partial class ExternalSubnetFragment + { + /// + /// Initializes a new instance of the ExternalSubnetFragment class. + /// + public ExternalSubnetFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExternalSubnetFragment class. + /// + + /// Gets or sets the identifier. + /// + + /// Gets or sets the name. + /// + public ExternalSubnetFragment(string id = default(string), string name = default(string)) + + { + this.Id = id; + this.Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets gets or sets the identifier. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } + + /// + /// Gets or sets gets or sets the name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FileUploadOptions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FileUploadOptions.cs new file mode 100644 index 000000000000..eeb580ffb8c8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FileUploadOptions.cs @@ -0,0 +1,19 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for FileUploadOptions. + /// + + + public static class FileUploadOptions + { + public const string UploadFilesAndGenerateSasTokens = "UploadFilesAndGenerateSasTokens"; + public const string None = "None"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Formula.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Formula.cs new file mode 100644 index 000000000000..a5a22ca401ef --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Formula.cs @@ -0,0 +1,135 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A formula for creating a VM, specifying an image base and other parameters + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Formula : Resource + { + /// + /// Initializes a new instance of the Formula class. + /// + public Formula() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Formula 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 description of the formula. + /// + + /// The author of the formula. + /// + + /// The OS type of the formula. + /// + + /// The creation date of the formula. + /// + + /// The content of the formula. + /// + + /// Information about a VM from which a formula is to be created. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public Formula(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string description = default(string), string author = default(string), string osType = default(string), System.DateTime? creationDate = default(System.DateTime?), LabVirtualMachineCreationParameter formulaContent = default(LabVirtualMachineCreationParameter), FormulaPropertiesFromVm vm = default(FormulaPropertiesFromVm), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.Description = description; + this.Author = author; + this.OSType = osType; + this.CreationDate = creationDate; + this.FormulaContent = formulaContent; + this.VM = vm; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the description of the formula. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } + + /// + /// Gets or sets the author of the formula. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.author")] + public string Author {get; set; } + + /// + /// Gets or sets the OS type of the formula. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.osType")] + public string OSType {get; set; } + + /// + /// Gets the creation date of the formula. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.creationDate")] + public System.DateTime? CreationDate {get; private set; } + + /// + /// Gets or sets the content of the formula. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.formulaContent")] + public LabVirtualMachineCreationParameter FormulaContent {get; set; } + + /// + /// Gets or sets information about a VM from which a formula is to be created. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.vm")] + public FormulaPropertiesFromVm VM {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaProperties.cs new file mode 100644 index 000000000000..9ba7caf9ec10 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaProperties.cs @@ -0,0 +1,118 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a formula. + /// + public partial class FormulaProperties + { + /// + /// Initializes a new instance of the FormulaProperties class. + /// + public FormulaProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FormulaProperties class. + /// + + /// The description of the formula. + /// + + /// The author of the formula. + /// + + /// The OS type of the formula. + /// + + /// The creation date of the formula. + /// + + /// The content of the formula. + /// + + /// Information about a VM from which a formula is to be created. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public FormulaProperties(string description = default(string), string author = default(string), string osType = default(string), System.DateTime? creationDate = default(System.DateTime?), LabVirtualMachineCreationParameter formulaContent = default(LabVirtualMachineCreationParameter), FormulaPropertiesFromVm vm = default(FormulaPropertiesFromVm), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Description = description; + this.Author = author; + this.OSType = osType; + this.CreationDate = creationDate; + this.FormulaContent = formulaContent; + this.VM = vm; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the description of the formula. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the author of the formula. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "author")] + public string Author {get; set; } + + /// + /// Gets or sets the OS type of the formula. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "osType")] + public string OSType {get; set; } + + /// + /// Gets the creation date of the formula. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "creationDate")] + public System.DateTime? CreationDate {get; private set; } + + /// + /// Gets or sets the content of the formula. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "formulaContent")] + public LabVirtualMachineCreationParameter FormulaContent {get; set; } + + /// + /// Gets or sets information about a VM from which a formula is to be created. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "vm")] + public FormulaPropertiesFromVm VM {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVm.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVm.cs new file mode 100644 index 000000000000..5da4ee97675f --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/FormulaPropertiesFromVm.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Information about a VM from which a formula is to be created. + /// + public partial class FormulaPropertiesFromVm + { + /// + /// Initializes a new instance of the FormulaPropertiesFromVm class. + /// + public FormulaPropertiesFromVm() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FormulaPropertiesFromVm class. + /// + + /// The identifier of the VM from which a formula is to be created. + /// + public FormulaPropertiesFromVm(string labVMId = default(string)) + + { + this.LabVMId = labVMId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the identifier of the VM from which a formula is to be + /// created. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labVmId")] + public string LabVMId {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImage.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImage.cs new file mode 100644 index 000000000000..6c968a486825 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImage.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A gallery image. + /// + [Microsoft.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. + /// + public GalleryImage(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string author = default(string), System.DateTime? createdDate = default(System.DateTime?), string description = default(string), GalleryImageReference imageReference = default(GalleryImageReference), string icon = default(string), bool? enabled = default(bool?)) + + : base(id, name, type, location, tags) + { + this.Author = author; + this.CreatedDate = createdDate; + this.Description = description; + this.ImageReference = imageReference; + this.Icon = icon; + this.Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the author of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.author")] + public string Author {get; set; } + + /// + /// Gets the creation date of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the description of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } + + /// + /// Gets or sets the image reference of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.imageReference")] + public GalleryImageReference ImageReference {get; set; } + + /// + /// Gets or sets the icon of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.icon")] + public string Icon {get; set; } + + /// + /// Gets or sets indicates whether this gallery image is enabled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageProperties.cs new file mode 100644 index 000000000000..f1d163cf1fba --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageProperties.cs @@ -0,0 +1,98 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a gallery image. + /// + public partial class GalleryImageProperties + { + /// + /// Initializes a new instance of the GalleryImageProperties class. + /// + public GalleryImageProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImageProperties class. + /// + + /// 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. + /// + public GalleryImageProperties(string author = default(string), System.DateTime? createdDate = default(System.DateTime?), string description = default(string), GalleryImageReference imageReference = default(GalleryImageReference), string icon = default(string), bool? enabled = default(bool?)) + + { + this.Author = author; + this.CreatedDate = createdDate; + this.Description = description; + this.ImageReference = imageReference; + this.Icon = icon; + this.Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the author of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "author")] + public string Author {get; set; } + + /// + /// Gets the creation date of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the description of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the image reference of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "imageReference")] + public GalleryImageReference ImageReference {get; set; } + + /// + /// Gets or sets the icon of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "icon")] + public string Icon {get; set; } + + /// + /// Gets or sets indicates whether this gallery image is enabled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enabled")] + public bool? Enabled {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReference.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReference.cs new file mode 100644 index 000000000000..14164edf7fb1 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReference.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// The reference information for an Azure Marketplace image. + /// + public partial class GalleryImageReference + { + /// + /// Initializes a new instance of the GalleryImageReference class. + /// + public GalleryImageReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImageReference 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)) + + { + this.Offer = offer; + this.Publisher = publisher; + this.Sku = sku; + this.OSType = osType; + this.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. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "offer")] + public string Offer {get; set; } + + /// + /// Gets or sets the publisher of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "publisher")] + public string Publisher {get; set; } + + /// + /// Gets or sets the SKU of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sku")] + public string Sku {get; set; } + + /// + /// Gets or sets the OS type of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "osType")] + public string OSType {get; set; } + + /// + /// Gets or sets the version of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "version")] + public string Version {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReferenceFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReferenceFragment.cs new file mode 100644 index 000000000000..08c01b2b9df5 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GalleryImageReferenceFragment.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + 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)) + + { + this.Offer = offer; + this.Publisher = publisher; + this.Sku = sku; + this.OSType = osType; + this.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. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "offer")] + public string Offer {get; set; } + + /// + /// Gets or sets the publisher of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "publisher")] + public string Publisher {get; set; } + + /// + /// Gets or sets the SKU of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sku")] + public string Sku {get; set; } + + /// + /// Gets or sets the OS type of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "osType")] + public string OSType {get; set; } + + /// + /// Gets or sets the version of the gallery image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "version")] + public string Version {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateArmTemplateRequest.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateArmTemplateRequest.cs new file mode 100644 index 000000000000..ce8eb6882bd9 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateArmTemplateRequest.cs @@ -0,0 +1,80 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Parameters for generating an ARM template for deploying artifacts. + /// + public partial class GenerateArmTemplateRequest + { + /// + /// Initializes a new instance of the GenerateArmTemplateRequest class. + /// + public GenerateArmTemplateRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GenerateArmTemplateRequest class. + /// + + /// The resource name of the virtual machine. + /// + + /// The parameters of the ARM template. + /// + + /// The location of the virtual machine. + /// + + /// Options for uploading the files for the artifact. + /// UploadFilesAndGenerateSasTokens is the default value. + /// Possible values include: 'UploadFilesAndGenerateSasTokens', 'None' + public GenerateArmTemplateRequest(string virtualMachineName = default(string), System.Collections.Generic.IList parameters = default(System.Collections.Generic.IList), string location = default(string), string fileUploadOptions = default(string)) + + { + this.VirtualMachineName = virtualMachineName; + this.Parameters = parameters; + this.Location = location; + this.FileUploadOptions = fileUploadOptions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the resource name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "virtualMachineName")] + public string VirtualMachineName {get; set; } + + /// + /// Gets or sets the parameters of the ARM template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "parameters")] + public System.Collections.Generic.IList Parameters {get; set; } + + /// + /// Gets or sets the location of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; set; } + + /// + /// Gets or sets options for uploading the files for the artifact. + /// UploadFilesAndGenerateSasTokens is the default value. Possible values include: 'UploadFilesAndGenerateSasTokens', 'None' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "fileUploadOptions")] + public string FileUploadOptions {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriParameter.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriParameter.cs new file mode 100644 index 000000000000..fb83c2a22a5a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriParameter.cs @@ -0,0 +1,48 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties for generating an upload URI. + /// + public partial class GenerateUploadUriParameter + { + /// + /// Initializes a new instance of the GenerateUploadUriParameter class. + /// + public GenerateUploadUriParameter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GenerateUploadUriParameter class. + /// + + /// The blob name of the upload URI. + /// + public GenerateUploadUriParameter(string blobName = default(string)) + + { + this.BlobName = blobName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the blob name of the upload URI. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "blobName")] + public string BlobName {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriResponse.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriResponse.cs new file mode 100644 index 000000000000..5109bd4e1886 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/GenerateUploadUriResponse.cs @@ -0,0 +1,48 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Reponse body for generating an upload URI. + /// + public partial class GenerateUploadUriResponse + { + /// + /// Initializes a new instance of the GenerateUploadUriResponse class. + /// + public GenerateUploadUriResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GenerateUploadUriResponse class. + /// + + /// The upload URI for the VHD. + /// + public GenerateUploadUriResponse(string uploadUri = default(string)) + + { + this.UploadUri = uploadUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the upload URI for the VHD. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uploadUri")] + public string UploadUri {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HostCachingOptions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HostCachingOptions.cs new file mode 100644 index 000000000000..5056bcc0e92c --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HostCachingOptions.cs @@ -0,0 +1,20 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for HostCachingOptions. + /// + + + public static class HostCachingOptions + { + public const string None = "None"; + public const string ReadOnly = "ReadOnly"; + public const string ReadWrite = "ReadWrite"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetails.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetails.cs new file mode 100644 index 000000000000..91ade0103cc1 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetails.cs @@ -0,0 +1,48 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an hourly schedule. + /// + public partial class HourDetails + { + /// + /// Initializes a new instance of the HourDetails class. + /// + public HourDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HourDetails class. + /// + + /// Minutes of the hour the schedule will run. + /// + public HourDetails(int? minute = default(int?)) + + { + this.Minute = minute; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets minutes of the hour the schedule will run. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "minute")] + public int? Minute {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetailsFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetailsFragment.cs new file mode 100644 index 000000000000..3e684d8b0bc1 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HourDetailsFragment.cs @@ -0,0 +1,48 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of an hourly schedule. + /// + public partial class HourDetailsFragment + { + /// + /// Initializes a new instance of the HourDetailsFragment class. + /// + public HourDetailsFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HourDetailsFragment class. + /// + + /// Minutes of the hour the schedule will run. + /// + public HourDetailsFragment(int? minute = default(int?)) + + { + this.Minute = minute; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets minutes of the hour the schedule will run. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "minute")] + public int? Minute {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HttpStatusCode.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HttpStatusCode.cs new file mode 100644 index 000000000000..1e678a311415 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/HttpStatusCode.cs @@ -0,0 +1,59 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for HttpStatusCode. + /// + + + public static class HttpStatusCode + { + public const string Continue = "Continue"; + public const string SwitchingProtocols = "SwitchingProtocols"; + public const string OK = "OK"; + public const string Created = "Created"; + public const string Accepted = "Accepted"; + public const string NonAuthoritativeInformation = "NonAuthoritativeInformation"; + public const string NoContent = "NoContent"; + public const string ResetContent = "ResetContent"; + public const string PartialContent = "PartialContent"; + public const string MultipleChoices = "MultipleChoices"; + public const string MovedPermanently = "MovedPermanently"; + public const string Redirect = "Redirect"; + public const string SeeOther = "SeeOther"; + public const string NotModified = "NotModified"; + public const string UseProxy = "UseProxy"; + public const string Unused = "Unused"; + public const string TemporaryRedirect = "TemporaryRedirect"; + public const string BadRequest = "BadRequest"; + public const string Unauthorized = "Unauthorized"; + public const string PaymentRequired = "PaymentRequired"; + public const string Forbidden = "Forbidden"; + public const string NotFound = "NotFound"; + public const string MethodNotAllowed = "MethodNotAllowed"; + public const string NotAcceptable = "NotAcceptable"; + public const string ProxyAuthenticationRequired = "ProxyAuthenticationRequired"; + public const string RequestTimeout = "RequestTimeout"; + public const string Conflict = "Conflict"; + public const string Gone = "Gone"; + public const string LengthRequired = "LengthRequired"; + public const string PreconditionFailed = "PreconditionFailed"; + public const string RequestEntityTooLarge = "RequestEntityTooLarge"; + public const string RequestUriTooLong = "RequestUriTooLong"; + public const string UnsupportedMediaType = "UnsupportedMediaType"; + public const string RequestedRangeNotSatisfiable = "RequestedRangeNotSatisfiable"; + public const string ExpectationFailed = "ExpectationFailed"; + public const string UpgradeRequired = "UpgradeRequired"; + public const string InternalServerError = "InternalServerError"; + public const string NotImplemented = "NotImplemented"; + public const string BadGateway = "BadGateway"; + public const string ServiceUnavailable = "ServiceUnavailable"; + public const string GatewayTimeout = "GatewayTimeout"; + public const string HttpVersionNotSupported = "HttpVersionNotSupported"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/IdentityProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/IdentityProperties.cs new file mode 100644 index 000000000000..0c58fae2b8ce --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/IdentityProperties.cs @@ -0,0 +1,78 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a managed identity + /// + public partial class IdentityProperties + { + /// + /// Initializes a new instance of the IdentityProperties class. + /// + public IdentityProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IdentityProperties class. + /// + + /// Managed identity. + /// + + /// The principal id of resource identity. + /// + + /// The tenant identifier of resource. + /// + + /// The client secret URL of the identity. + /// + public IdentityProperties(string type = default(string), string principalId = default(string), string tenantId = default(string), string clientSecretUrl = default(string)) + + { + this.Type = type; + this.PrincipalId = principalId; + this.TenantId = tenantId; + this.ClientSecretUrl = clientSecretUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets managed identity. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; set; } + + /// + /// Gets or sets the principal id of resource identity. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "principalId")] + public string PrincipalId {get; set; } + + /// + /// Gets or sets the tenant identifier of resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tenantId")] + public string TenantId {get; set; } + + /// + /// Gets or sets the client secret URL of the identity. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "clientSecretUrl")] + public string ClientSecretUrl {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRule.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRule.cs new file mode 100644 index 000000000000..d5dcf179da08 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRule.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A rule for NAT - exposing a VM's port (backendPort) on the public IP + /// address using a load balancer. + /// + public partial class InboundNatRule + { + /// + /// Initializes a new instance of the InboundNatRule class. + /// + public InboundNatRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InboundNatRule class. + /// + + /// The transport protocol for the endpoint. + /// Possible values include: 'Tcp', 'Udp' + + /// The external endpoint port of the inbound connection. Possible values range + /// between 1 and 65535, inclusive. If unspecified, a value will be allocated + /// automatically. + /// + + /// The port to which the external traffic will be redirected. + /// + public InboundNatRule(string transportProtocol = default(string), int? frontendPort = default(int?), int? backendPort = default(int?)) + + { + this.TransportProtocol = transportProtocol; + this.FrontendPort = frontendPort; + this.BackendPort = backendPort; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the transport protocol for the endpoint. Possible values include: 'Tcp', 'Udp' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "transportProtocol")] + public string TransportProtocol {get; set; } + + /// + /// Gets or sets the external endpoint port of the inbound connection. Possible + /// values range between 1 and 65535, inclusive. If unspecified, a value will + /// be allocated automatically. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "frontendPort")] + public int? FrontendPort {get; set; } + + /// + /// Gets or sets the port to which the external traffic will be redirected. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "backendPort")] + public int? BackendPort {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRuleFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRuleFragment.cs new file mode 100644 index 000000000000..830ae26c6ce0 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/InboundNatRuleFragment.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A rule for NAT - exposing a VM's port (backendPort) on the public IP + /// address using a load balancer. + /// + public partial class InboundNatRuleFragment + { + /// + /// Initializes a new instance of the InboundNatRuleFragment class. + /// + public InboundNatRuleFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InboundNatRuleFragment class. + /// + + /// The transport protocol for the endpoint. + /// Possible values include: 'Tcp', 'Udp' + + /// The external endpoint port of the inbound connection. Possible values range + /// between 1 and 65535, inclusive. If unspecified, a value will be allocated + /// automatically. + /// + + /// The port to which the external traffic will be redirected. + /// + public InboundNatRuleFragment(string transportProtocol = default(string), int? frontendPort = default(int?), int? backendPort = default(int?)) + + { + this.TransportProtocol = transportProtocol; + this.FrontendPort = frontendPort; + this.BackendPort = backendPort; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the transport protocol for the endpoint. Possible values include: 'Tcp', 'Udp' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "transportProtocol")] + public string TransportProtocol {get; set; } + + /// + /// Gets or sets the external endpoint port of the inbound connection. Possible + /// values range between 1 and 65535, inclusive. If unspecified, a value will + /// be allocated automatically. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "frontendPort")] + public int? FrontendPort {get; set; } + + /// + /// Gets or sets the port to which the external traffic will be redirected. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "backendPort")] + public int? BackendPort {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Lab.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Lab.cs new file mode 100644 index 000000000000..f82bc16acfa3 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Lab.cs @@ -0,0 +1,165 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A lab. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Lab : Resource + { + /// + /// Initializes a new instance of the Lab class. + /// + public Lab() + { + CustomInit(); + } + + /// + /// 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. + /// + + /// The lab's default storage account. + /// + + /// The lab's default premium storage account. + /// + + /// The lab's artifact storage account. + /// + + /// The lab's premium data disk storage account. + /// + + /// The lab's Key vault. + /// + + /// Type of storage used by the lab. It can be either Premium or Standard. + /// Default is Premium. + /// Possible values include: 'Standard', 'Premium' + + /// The creation date of the lab. + /// + + /// The setting to enable usage of premium data disks. + /// When its value is 'Enabled', creation of standard or premium data disks is + /// allowed. + /// When its value is 'Disabled', only creation of standard data disks is + /// allowed. + /// Possible values include: 'Disabled', 'Enabled' + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public Lab(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string defaultStorageAccount = default(string), string defaultPremiumStorageAccount = default(string), string artifactsStorageAccount = default(string), string premiumDataDiskStorageAccount = default(string), string vaultName = default(string), string labStorageType = default(string), System.DateTime? createdDate = default(System.DateTime?), string premiumDataDisks = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.DefaultStorageAccount = defaultStorageAccount; + this.DefaultPremiumStorageAccount = defaultPremiumStorageAccount; + this.ArtifactsStorageAccount = artifactsStorageAccount; + this.PremiumDataDiskStorageAccount = premiumDataDiskStorageAccount; + this.VaultName = vaultName; + this.LabStorageType = labStorageType; + this.CreatedDate = createdDate; + this.PremiumDataDisks = premiumDataDisks; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the lab's default storage account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.defaultStorageAccount")] + public string DefaultStorageAccount {get; private set; } + + /// + /// Gets the lab's default premium storage account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.defaultPremiumStorageAccount")] + public string DefaultPremiumStorageAccount {get; private set; } + + /// + /// Gets the lab's artifact storage account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.artifactsStorageAccount")] + public string ArtifactsStorageAccount {get; private set; } + + /// + /// Gets the lab's premium data disk storage account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.premiumDataDiskStorageAccount")] + public string PremiumDataDiskStorageAccount {get; private set; } + + /// + /// Gets the lab's Key vault. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.vaultName")] + public string VaultName {get; private set; } + + /// + /// Gets or sets type of storage used by the lab. It can be either Premium or + /// Standard. Default is Premium. Possible values include: 'Standard', 'Premium' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labStorageType")] + public string LabStorageType {get; set; } + + /// + /// Gets the creation date of the lab. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the setting to enable usage of premium data disks. + /// When its value is 'Enabled', creation of standard or premium data disks is + /// allowed. + /// When its value is 'Disabled', only creation of standard data disks is + /// allowed. Possible values include: 'Disabled', 'Enabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.premiumDataDisks")] + public string PremiumDataDisks {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCost.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCost.cs new file mode 100644 index 000000000000..165d221f1e42 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCost.cs @@ -0,0 +1,155 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A cost item. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class LabCost : Resource + { + /// + /// Initializes a new instance of the LabCost class. + /// + public LabCost() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabCost 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 target cost properties + /// + + /// The lab cost summary component of the cost data. + /// + + /// The lab cost details component of the cost data. + /// + + /// The resource cost component of the cost data. + /// + + /// The currency code of the cost. + /// + + /// The start time of the cost data. + /// + + /// The end time of the cost data. + /// + + /// The creation date of the cost. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabCost(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), TargetCostProperties targetCost = default(TargetCostProperties), LabCostSummaryProperties labCostSummary = default(LabCostSummaryProperties), System.Collections.Generic.IList labCostDetails = default(System.Collections.Generic.IList), System.Collections.Generic.IList resourceCosts = default(System.Collections.Generic.IList), string currencyCode = default(string), System.DateTime? startDateTime = default(System.DateTime?), System.DateTime? endDateTime = default(System.DateTime?), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.TargetCost = targetCost; + this.LabCostSummary = labCostSummary; + this.LabCostDetails = labCostDetails; + this.ResourceCosts = resourceCosts; + this.CurrencyCode = currencyCode; + this.StartDateTime = startDateTime; + this.EndDateTime = endDateTime; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the target cost properties + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.targetCost")] + public TargetCostProperties TargetCost {get; set; } + + /// + /// Gets the lab cost summary component of the cost data. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labCostSummary")] + public LabCostSummaryProperties LabCostSummary {get; private set; } + + /// + /// Gets the lab cost details component of the cost data. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labCostDetails")] + public System.Collections.Generic.IList LabCostDetails {get; private set; } + + /// + /// Gets the resource cost component of the cost data. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.resourceCosts")] + public System.Collections.Generic.IList ResourceCosts {get; private set; } + + /// + /// Gets or sets the currency code of the cost. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.currencyCode")] + public string CurrencyCode {get; set; } + + /// + /// Gets or sets the start time of the cost data. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.startDateTime")] + public System.DateTime? StartDateTime {get; set; } + + /// + /// Gets or sets the end time of the cost data. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.endDateTime")] + public System.DateTime? EndDateTime {get; set; } + + /// + /// Gets or sets the creation date of the cost. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostDetailsProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostDetailsProperties.cs new file mode 100644 index 000000000000..b566f2c4d70e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostDetailsProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// The properties of a lab cost item. + /// + public partial class LabCostDetailsProperties + { + /// + /// Initializes a new instance of the LabCostDetailsProperties class. + /// + public LabCostDetailsProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabCostDetailsProperties class. + /// + + /// The date of the cost item. + /// + + /// The cost component of the cost item. + /// + + /// The type of the cost. + /// Possible values include: 'Unavailable', 'Reported', 'Projected' + public LabCostDetailsProperties(System.DateTime? date = default(System.DateTime?), double? cost = default(double?), string costType = default(string)) + + { + this.Date = date; + this.Cost = cost; + this.CostType = costType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the date of the cost item. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "date")] + public System.DateTime? Date {get; set; } + + /// + /// Gets or sets the cost component of the cost item. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "cost")] + public double? Cost {get; set; } + + /// + /// Gets or sets the type of the cost. Possible values include: 'Unavailable', 'Reported', 'Projected' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "costType")] + public string CostType {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostProperties.cs new file mode 100644 index 000000000000..36756fa77542 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostProperties.cs @@ -0,0 +1,138 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a cost item. + /// + public partial class LabCostProperties + { + /// + /// Initializes a new instance of the LabCostProperties class. + /// + public LabCostProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabCostProperties class. + /// + + /// The target cost properties + /// + + /// The lab cost summary component of the cost data. + /// + + /// The lab cost details component of the cost data. + /// + + /// The resource cost component of the cost data. + /// + + /// The currency code of the cost. + /// + + /// The start time of the cost data. + /// + + /// The end time of the cost data. + /// + + /// The creation date of the cost. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabCostProperties(TargetCostProperties targetCost = default(TargetCostProperties), LabCostSummaryProperties labCostSummary = default(LabCostSummaryProperties), System.Collections.Generic.IList labCostDetails = default(System.Collections.Generic.IList), System.Collections.Generic.IList resourceCosts = default(System.Collections.Generic.IList), string currencyCode = default(string), System.DateTime? startDateTime = default(System.DateTime?), System.DateTime? endDateTime = default(System.DateTime?), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.TargetCost = targetCost; + this.LabCostSummary = labCostSummary; + this.LabCostDetails = labCostDetails; + this.ResourceCosts = resourceCosts; + this.CurrencyCode = currencyCode; + this.StartDateTime = startDateTime; + this.EndDateTime = endDateTime; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the target cost properties + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetCost")] + public TargetCostProperties TargetCost {get; set; } + + /// + /// Gets the lab cost summary component of the cost data. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labCostSummary")] + public LabCostSummaryProperties LabCostSummary {get; private set; } + + /// + /// Gets the lab cost details component of the cost data. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labCostDetails")] + public System.Collections.Generic.IList LabCostDetails {get; private set; } + + /// + /// Gets the resource cost component of the cost data. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceCosts")] + public System.Collections.Generic.IList ResourceCosts {get; private set; } + + /// + /// Gets or sets the currency code of the cost. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "currencyCode")] + public string CurrencyCode {get; set; } + + /// + /// Gets or sets the start time of the cost data. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "startDateTime")] + public System.DateTime? StartDateTime {get; set; } + + /// + /// Gets or sets the end time of the cost data. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "endDateTime")] + public System.DateTime? EndDateTime {get; set; } + + /// + /// Gets or sets the creation date of the cost. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostSummaryProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostSummaryProperties.cs new file mode 100644 index 000000000000..28b69fcc8c9a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabCostSummaryProperties.cs @@ -0,0 +1,48 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// The properties of the cost summary. + /// + public partial class LabCostSummaryProperties + { + /// + /// Initializes a new instance of the LabCostSummaryProperties class. + /// + public LabCostSummaryProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabCostSummaryProperties class. + /// + + /// The cost component of the cost item. + /// + public LabCostSummaryProperties(double? estimatedLabCost = default(double?)) + + { + this.EstimatedLabCost = estimatedLabCost; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the cost component of the cost item. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "estimatedLabCost")] + public double? EstimatedLabCost {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabFragment.cs new file mode 100644 index 000000000000..23f1c4933ec2 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabFragment.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A lab. + /// + [Microsoft.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. + /// + + /// Type of storage used by the lab. It can be either Premium or Standard. + /// Default is Premium. + /// Possible values include: 'Standard', 'Premium' + + /// The setting to enable usage of premium data disks. + /// When its value is 'Enabled', creation of standard or premium data disks is + /// allowed. + /// When its value is 'Disabled', only creation of standard data disks is + /// allowed. + /// Possible values include: 'Disabled', 'Enabled' + + /// 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), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string labStorageType = default(string), string premiumDataDisks = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.LabStorageType = labStorageType; + this.PremiumDataDisks = premiumDataDisks; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets type of storage used by the lab. It can be either Premium or + /// Standard. Default is Premium. Possible values include: 'Standard', 'Premium' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labStorageType")] + public string LabStorageType {get; set; } + + /// + /// Gets or sets the setting to enable usage of premium data disks. + /// When its value is 'Enabled', creation of standard or premium data disks is + /// allowed. + /// When its value is 'Disabled', only creation of standard data disks is + /// allowed. Possible values include: 'Disabled', 'Enabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.premiumDataDisks")] + public string PremiumDataDisks {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabProperties.cs new file mode 100644 index 000000000000..bd36554be812 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabProperties.cs @@ -0,0 +1,148 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a lab. + /// + public partial class LabProperties + { + /// + /// Initializes a new instance of the LabProperties class. + /// + public LabProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabProperties class. + /// + + /// The lab's default storage account. + /// + + /// The lab's default premium storage account. + /// + + /// The lab's artifact storage account. + /// + + /// The lab's premium data disk storage account. + /// + + /// The lab's Key vault. + /// + + /// Type of storage used by the lab. It can be either Premium or Standard. + /// Default is Premium. + /// Possible values include: 'Standard', 'Premium' + + /// The creation date of the lab. + /// + + /// The setting to enable usage of premium data disks. + /// When its value is 'Enabled', creation of standard or premium data disks is + /// allowed. + /// When its value is 'Disabled', only creation of standard data disks is + /// allowed. + /// Possible values include: 'Disabled', 'Enabled' + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabProperties(string defaultStorageAccount = default(string), string defaultPremiumStorageAccount = default(string), string artifactsStorageAccount = default(string), string premiumDataDiskStorageAccount = default(string), string vaultName = default(string), string labStorageType = default(string), System.DateTime? createdDate = default(System.DateTime?), string premiumDataDisks = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.DefaultStorageAccount = defaultStorageAccount; + this.DefaultPremiumStorageAccount = defaultPremiumStorageAccount; + this.ArtifactsStorageAccount = artifactsStorageAccount; + this.PremiumDataDiskStorageAccount = premiumDataDiskStorageAccount; + this.VaultName = vaultName; + this.LabStorageType = labStorageType; + this.CreatedDate = createdDate; + this.PremiumDataDisks = premiumDataDisks; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the lab's default storage account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "defaultStorageAccount")] + public string DefaultStorageAccount {get; private set; } + + /// + /// Gets the lab's default premium storage account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "defaultPremiumStorageAccount")] + public string DefaultPremiumStorageAccount {get; private set; } + + /// + /// Gets the lab's artifact storage account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifactsStorageAccount")] + public string ArtifactsStorageAccount {get; private set; } + + /// + /// Gets the lab's premium data disk storage account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "premiumDataDiskStorageAccount")] + public string PremiumDataDiskStorageAccount {get; private set; } + + /// + /// Gets the lab's Key vault. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "vaultName")] + public string VaultName {get; private set; } + + /// + /// Gets or sets type of storage used by the lab. It can be either Premium or + /// Standard. Default is Premium. Possible values include: 'Standard', 'Premium' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labStorageType")] + public string LabStorageType {get; set; } + + /// + /// Gets the creation date of the lab. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the setting to enable usage of premium data disks. + /// When its value is 'Enabled', creation of standard or premium data disks is + /// allowed. + /// When its value is 'Disabled', only creation of standard data disks is + /// allowed. Possible values include: 'Disabled', 'Enabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "premiumDataDisks")] + public string PremiumDataDisks {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabPropertiesFragment.cs new file mode 100644 index 000000000000..95e86f359521 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabPropertiesFragment.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a lab. + /// + public partial class LabPropertiesFragment + { + /// + /// Initializes a new instance of the LabPropertiesFragment class. + /// + public LabPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabPropertiesFragment class. + /// + + /// Type of storage used by the lab. It can be either Premium or Standard. + /// Default is Premium. + /// Possible values include: 'Standard', 'Premium' + + /// The setting to enable usage of premium data disks. + /// When its value is 'Enabled', creation of standard or premium data disks is + /// allowed. + /// When its value is 'Disabled', only creation of standard data disks is + /// allowed. + /// Possible values include: 'Disabled', 'Enabled' + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabPropertiesFragment(string labStorageType = default(string), string premiumDataDisks = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.LabStorageType = labStorageType; + this.PremiumDataDisks = premiumDataDisks; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets type of storage used by the lab. It can be either Premium or + /// Standard. Default is Premium. Possible values include: 'Standard', 'Premium' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labStorageType")] + public string LabStorageType {get; set; } + + /// + /// Gets or sets the setting to enable usage of premium data disks. + /// When its value is 'Enabled', creation of standard or premium data disks is + /// allowed. + /// When its value is 'Disabled', only creation of standard data disks is + /// allowed. Possible values include: 'Disabled', 'Enabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "premiumDataDisks")] + public string PremiumDataDisks {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabResourceCostProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabResourceCostProperties.cs new file mode 100644 index 000000000000..d9c74625cb50 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabResourceCostProperties.cs @@ -0,0 +1,128 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// The properties of a resource cost item. + /// + public partial class LabResourceCostProperties + { + /// + /// Initializes a new instance of the LabResourceCostProperties class. + /// + public LabResourceCostProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabResourceCostProperties class. + /// + + /// The name of the resource. + /// + + /// The unique identifier of the resource. + /// + + /// The cost component of the resource cost item. + /// + + /// The logical resource type (ex. virtualmachine, storageaccount) + /// + + /// The owner of the resource (ex. janedoe@microsoft.com) + /// + + /// The category of the resource (ex. Premium_LRS, Standard_DS1) + /// + + /// The status of the resource (ex. Active) + /// + + /// The ID of the resource + /// + + /// The ID of the external resource + /// + public LabResourceCostProperties(string resourcename = default(string), string resourceUId = default(string), double? resourceCost = default(double?), string resourceType = default(string), string resourceOwner = default(string), string resourcePricingTier = default(string), string resourceStatus = default(string), string resourceId = default(string), string externalResourceId = default(string)) + + { + this.Resourcename = resourcename; + this.ResourceUId = resourceUId; + this.ResourceCost = resourceCost; + this.ResourceType = resourceType; + this.ResourceOwner = resourceOwner; + this.ResourcePricingTier = resourcePricingTier; + this.ResourceStatus = resourceStatus; + this.ResourceId = resourceId; + this.ExternalResourceId = externalResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourcename")] + public string Resourcename {get; set; } + + /// + /// Gets or sets the unique identifier of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceUId")] + public string ResourceUId {get; set; } + + /// + /// Gets or sets the cost component of the resource cost item. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceCost")] + public double? ResourceCost {get; set; } + + /// + /// Gets or sets the logical resource type (ex. virtualmachine, storageaccount) + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceType")] + public string ResourceType {get; set; } + + /// + /// Gets or sets the owner of the resource (ex. janedoe@microsoft.com) + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceOwner")] + public string ResourceOwner {get; set; } + + /// + /// Gets or sets the category of the resource (ex. Premium_LRS, Standard_DS1) + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourcePricingTier")] + public string ResourcePricingTier {get; set; } + + /// + /// Gets or sets the status of the resource (ex. Active) + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceStatus")] + public string ResourceStatus {get; set; } + + /// + /// Gets or sets the ID of the resource + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceId")] + public string ResourceId {get; set; } + + /// + /// Gets or sets the ID of the external resource + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "externalResourceId")] + public string ExternalResourceId {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVhd.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVhd.cs new file mode 100644 index 000000000000..f72ce4fc7d14 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVhd.cs @@ -0,0 +1,48 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a VHD in the lab. + /// + public partial class LabVhd + { + /// + /// Initializes a new instance of the LabVhd class. + /// + public LabVhd() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabVhd class. + /// + + /// The URI to the VHD. + /// + public LabVhd(string id = default(string)) + + { + this.Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the URI to the VHD. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachine.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachine.cs new file mode 100644 index 000000000000..03fedc82a677 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachine.cs @@ -0,0 +1,374 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A virtual machine. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class LabVirtualMachine : Resource + { + /// + /// Initializes a new instance of the LabVirtualMachine class. + /// + public LabVirtualMachine() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabVirtualMachine 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 applicable schedule for the virtual machine. + /// + + /// The notes of the virtual machine. + /// + + /// The object identifier of the owner of the virtual machine. + /// + + /// The user principal name of the virtual machine owner. + /// + + /// The object identifier of the creator of the virtual machine. + /// + + /// The email address of creator of the virtual machine. + /// + + /// The creation date of the virtual machine. + /// + + /// The resource identifier (Microsoft.Compute) of the virtual machine. + /// + + /// The custom image identifier of the virtual machine. + /// + + /// The OS type of the virtual machine. + /// + + /// The size of the virtual machine. + /// + + /// The user name of the virtual machine. + /// + + /// The password of the virtual machine administrator. + /// + + /// The SSH key of the virtual machine administrator. + /// + + /// Indicates whether this virtual machine uses an SSH key for authentication. + /// + + /// The fully-qualified domain name of the virtual machine. + /// + + /// The lab subnet name of the virtual machine. + /// + + /// The lab virtual network identifier of the virtual machine. + /// + + /// Indicates whether the virtual machine is to be created without a public IP + /// address. + /// + + /// The artifacts to be installed on the virtual machine. + /// + + /// The artifact deployment status for the virtual machine. + /// + + /// The Microsoft Azure Marketplace image reference of the virtual machine. + /// + + /// The compute virtual machine properties. + /// + + /// The network interface properties. + /// + + /// The expiration date for VM. + /// + + /// Indicates whether another user can take ownership of the virtual machine + /// + + /// Storage type to use for virtual machine (i.e. Standard, Premium). + /// + + /// Tells source of creation of lab virtual machine. Output property only. + /// Possible values include: 'FromCustomImage', 'FromGalleryImage' + + /// The resource ID of the environment that contains this virtual machine, if + /// any. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabVirtualMachine(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), ApplicableSchedule applicableSchedule = default(ApplicableSchedule), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string computeId = default(string), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIPAddress = default(bool?), System.Collections.Generic.IList artifacts = default(System.Collections.Generic.IList), ArtifactDeploymentStatusProperties artifactDeploymentStatus = default(ArtifactDeploymentStatusProperties), GalleryImageReference galleryImageReference = default(GalleryImageReference), ComputeVmProperties computeVM = default(ComputeVmProperties), NetworkInterfaceProperties networkInterface = default(NetworkInterfaceProperties), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.ApplicableSchedule = applicableSchedule; + this.Notes = notes; + this.OwnerObjectId = ownerObjectId; + this.OwnerUserPrincipalName = ownerUserPrincipalName; + this.CreatedByUserId = createdByUserId; + this.CreatedByUser = createdByUser; + this.CreatedDate = createdDate; + this.ComputeId = computeId; + this.CustomImageId = customImageId; + this.OSType = osType; + this.Size = size; + this.UserName = userName; + this.Password = password; + this.SshKey = sshKey; + this.IsAuthenticationWithSshKey = isAuthenticationWithSshKey; + this.Fqdn = fqdn; + this.LabSubnetName = labSubnetName; + this.LabVirtualNetworkId = labVirtualNetworkId; + this.DisallowPublicIPAddress = disallowPublicIPAddress; + this.Artifacts = artifacts; + this.ArtifactDeploymentStatus = artifactDeploymentStatus; + this.GalleryImageReference = galleryImageReference; + this.ComputeVM = computeVM; + this.NetworkInterface = networkInterface; + this.ExpirationDate = expirationDate; + this.AllowClaim = allowClaim; + this.StorageType = storageType; + this.VirtualMachineCreationSource = virtualMachineCreationSource; + this.EnvironmentId = environmentId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the applicable schedule for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.applicableSchedule")] + public ApplicableSchedule ApplicableSchedule {get; set; } + + /// + /// Gets or sets the notes of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.notes")] + public string Notes {get; set; } + + /// + /// Gets or sets the object identifier of the owner of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.ownerObjectId")] + public string OwnerObjectId {get; set; } + + /// + /// Gets or sets the user principal name of the virtual machine owner. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.ownerUserPrincipalName")] + public string OwnerUserPrincipalName {get; set; } + + /// + /// Gets or sets the object identifier of the creator of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByUserId")] + public string CreatedByUserId {get; set; } + + /// + /// Gets or sets the email address of creator of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByUser")] + public string CreatedByUser {get; set; } + + /// + /// Gets or sets the creation date of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; set; } + + /// + /// Gets the resource identifier (Microsoft.Compute) of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.computeId")] + public string ComputeId {get; private set; } + + /// + /// Gets or sets the custom image identifier of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customImageId")] + public string CustomImageId {get; set; } + + /// + /// Gets or sets the OS type of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.osType")] + public string OSType {get; set; } + + /// + /// Gets or sets the size of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.size")] + public string Size {get; set; } + + /// + /// Gets or sets the user name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.userName")] + public string UserName {get; set; } + + /// + /// Gets or sets the password of the virtual machine administrator. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.password")] + public string Password {get; set; } + + /// + /// Gets or sets the SSH key of the virtual machine administrator. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.sshKey")] + public string SshKey {get; set; } + + /// + /// Gets or sets indicates whether this virtual machine uses an SSH key for + /// authentication. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.isAuthenticationWithSshKey")] + public bool? IsAuthenticationWithSshKey {get; set; } + + /// + /// Gets or sets the fully-qualified domain name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.fqdn")] + public string Fqdn {get; set; } + + /// + /// Gets or sets the lab subnet name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labSubnetName")] + public string LabSubnetName {get; set; } + + /// + /// Gets or sets the lab virtual network identifier of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labVirtualNetworkId")] + public string LabVirtualNetworkId {get; set; } + + /// + /// Gets or sets indicates whether the virtual machine is to be created without + /// a public IP address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.disallowPublicIpAddress")] + public bool? DisallowPublicIPAddress {get; set; } + + /// + /// Gets or sets the artifacts to be installed on the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.artifacts")] + public System.Collections.Generic.IList Artifacts {get; set; } + + /// + /// Gets or sets the artifact deployment status for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.artifactDeploymentStatus")] + public ArtifactDeploymentStatusProperties ArtifactDeploymentStatus {get; set; } + + /// + /// Gets or sets the Microsoft Azure Marketplace image reference of the virtual + /// machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.galleryImageReference")] + public GalleryImageReference GalleryImageReference {get; set; } + + /// + /// Gets or sets the compute virtual machine properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.computeVm")] + public ComputeVmProperties ComputeVM {get; set; } + + /// + /// Gets or sets the network interface properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.networkInterface")] + public NetworkInterfaceProperties NetworkInterface {get; set; } + + /// + /// Gets or sets the expiration date for VM. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.expirationDate")] + public System.DateTime? ExpirationDate {get; set; } + + /// + /// Gets or sets indicates whether another user can take ownership of the + /// virtual machine + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.allowClaim")] + public bool? AllowClaim {get; set; } + + /// + /// Gets or sets storage type to use for virtual machine (i.e. Standard, + /// Premium). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.storageType")] + public string StorageType {get; set; } + + /// + /// Gets or sets tells source of creation of lab virtual machine. Output + /// property only. Possible values include: 'FromCustomImage', 'FromGalleryImage' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.virtualMachineCreationSource")] + public string VirtualMachineCreationSource {get; set; } + + /// + /// Gets or sets the resource ID of the environment that contains this virtual + /// machine, if any. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.environmentId")] + public string EnvironmentId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameter.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameter.cs new file mode 100644 index 000000000000..7b93f0eba553 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameter.cs @@ -0,0 +1,388 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties for creating a virtual machine. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class LabVirtualMachineCreationParameter + { + /// + /// Initializes a new instance of the LabVirtualMachineCreationParameter class. + /// + public LabVirtualMachineCreationParameter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabVirtualMachineCreationParameter class. + /// + + /// The name of the virtual machine or environment + /// + + /// The location of the new virtual machine or environment + /// + + /// The tags of the resource. + /// + + /// The applicable schedule for the virtual machine. + /// + + /// The number of virtual machine instances to create. + /// + + /// The notes of the virtual machine. + /// + + /// The object identifier of the owner of the virtual machine. + /// + + /// The user principal name of the virtual machine owner. + /// + + /// The object identifier of the creator of the virtual machine. + /// + + /// The email address of creator of the virtual machine. + /// + + /// The creation date of the virtual machine. + /// + + /// The custom image identifier of the virtual machine. + /// + + /// The OS type of the virtual machine. + /// + + /// The size of the virtual machine. + /// + + /// The user name of the virtual machine. + /// + + /// The password of the virtual machine administrator. + /// + + /// The SSH key of the virtual machine administrator. + /// + + /// Indicates whether this virtual machine uses an SSH key for authentication. + /// + + /// The fully-qualified domain name of the virtual machine. + /// + + /// The lab subnet name of the virtual machine. + /// + + /// The lab virtual network identifier of the virtual machine. + /// + + /// Indicates whether the virtual machine is to be created without a public IP + /// address. + /// + + /// The artifacts to be installed on the virtual machine. + /// + + /// The artifact deployment status for the virtual machine. + /// + + /// The Microsoft Azure Marketplace image reference of the virtual machine. + /// + + /// The compute virtual machine properties. + /// + + /// The network interface properties. + /// + + /// The expiration date for VM. + /// + + /// Indicates whether another user can take ownership of the virtual machine + /// + + /// Storage type to use for virtual machine (i.e. Standard, Premium). + /// + + /// Tells source of creation of lab virtual machine. Output property only. + /// Possible values include: 'FromCustomImage', 'FromGalleryImage' + + /// The resource ID of the environment that contains this virtual machine, if + /// any. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabVirtualMachineCreationParameter(string name = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), ApplicableSchedule applicableSchedule = default(ApplicableSchedule), BulkCreationParameters bulkCreationParameters = default(BulkCreationParameters), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIPAddress = default(bool?), System.Collections.Generic.IList artifacts = default(System.Collections.Generic.IList), ArtifactDeploymentStatusProperties artifactDeploymentStatus = default(ArtifactDeploymentStatusProperties), GalleryImageReference galleryImageReference = default(GalleryImageReference), ComputeVmProperties computeVM = default(ComputeVmProperties), NetworkInterfaceProperties networkInterface = default(NetworkInterfaceProperties), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Name = name; + this.Location = location; + this.Tags = tags; + this.ApplicableSchedule = applicableSchedule; + this.BulkCreationParameters = bulkCreationParameters; + this.Notes = notes; + this.OwnerObjectId = ownerObjectId; + this.OwnerUserPrincipalName = ownerUserPrincipalName; + this.CreatedByUserId = createdByUserId; + this.CreatedByUser = createdByUser; + this.CreatedDate = createdDate; + this.CustomImageId = customImageId; + this.OSType = osType; + this.Size = size; + this.UserName = userName; + this.Password = password; + this.SshKey = sshKey; + this.IsAuthenticationWithSshKey = isAuthenticationWithSshKey; + this.Fqdn = fqdn; + this.LabSubnetName = labSubnetName; + this.LabVirtualNetworkId = labVirtualNetworkId; + this.DisallowPublicIPAddress = disallowPublicIPAddress; + this.Artifacts = artifacts; + this.ArtifactDeploymentStatus = artifactDeploymentStatus; + this.GalleryImageReference = galleryImageReference; + this.ComputeVM = computeVM; + this.NetworkInterface = networkInterface; + this.ExpirationDate = expirationDate; + this.AllowClaim = allowClaim; + this.StorageType = storageType; + this.VirtualMachineCreationSource = virtualMachineCreationSource; + this.EnvironmentId = environmentId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the virtual machine or environment + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets the location of the new virtual machine or environment + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; set; } + + /// + /// Gets or sets the tags of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } + + /// + /// Gets or sets the applicable schedule for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.applicableSchedule")] + public ApplicableSchedule ApplicableSchedule {get; set; } + + /// + /// Gets or sets the number of virtual machine instances to create. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.bulkCreationParameters")] + public BulkCreationParameters BulkCreationParameters {get; set; } + + /// + /// Gets or sets the notes of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.notes")] + public string Notes {get; set; } + + /// + /// Gets or sets the object identifier of the owner of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.ownerObjectId")] + public string OwnerObjectId {get; set; } + + /// + /// Gets or sets the user principal name of the virtual machine owner. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.ownerUserPrincipalName")] + public string OwnerUserPrincipalName {get; set; } + + /// + /// Gets or sets the object identifier of the creator of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByUserId")] + public string CreatedByUserId {get; set; } + + /// + /// Gets or sets the email address of creator of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByUser")] + public string CreatedByUser {get; set; } + + /// + /// Gets or sets the creation date of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; set; } + + /// + /// Gets or sets the custom image identifier of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customImageId")] + public string CustomImageId {get; set; } + + /// + /// Gets or sets the OS type of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.osType")] + public string OSType {get; set; } + + /// + /// Gets or sets the size of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.size")] + public string Size {get; set; } + + /// + /// Gets or sets the user name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.userName")] + public string UserName {get; set; } + + /// + /// Gets or sets the password of the virtual machine administrator. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.password")] + public string Password {get; set; } + + /// + /// Gets or sets the SSH key of the virtual machine administrator. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.sshKey")] + public string SshKey {get; set; } + + /// + /// Gets or sets indicates whether this virtual machine uses an SSH key for + /// authentication. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.isAuthenticationWithSshKey")] + public bool? IsAuthenticationWithSshKey {get; set; } + + /// + /// Gets or sets the fully-qualified domain name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.fqdn")] + public string Fqdn {get; set; } + + /// + /// Gets or sets the lab subnet name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labSubnetName")] + public string LabSubnetName {get; set; } + + /// + /// Gets or sets the lab virtual network identifier of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labVirtualNetworkId")] + public string LabVirtualNetworkId {get; set; } + + /// + /// Gets or sets indicates whether the virtual machine is to be created without + /// a public IP address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.disallowPublicIpAddress")] + public bool? DisallowPublicIPAddress {get; set; } + + /// + /// Gets or sets the artifacts to be installed on the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.artifacts")] + public System.Collections.Generic.IList Artifacts {get; set; } + + /// + /// Gets or sets the artifact deployment status for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.artifactDeploymentStatus")] + public ArtifactDeploymentStatusProperties ArtifactDeploymentStatus {get; set; } + + /// + /// Gets or sets the Microsoft Azure Marketplace image reference of the virtual + /// machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.galleryImageReference")] + public GalleryImageReference GalleryImageReference {get; set; } + + /// + /// Gets or sets the compute virtual machine properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.computeVm")] + public ComputeVmProperties ComputeVM {get; set; } + + /// + /// Gets or sets the network interface properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.networkInterface")] + public NetworkInterfaceProperties NetworkInterface {get; set; } + + /// + /// Gets or sets the expiration date for VM. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.expirationDate")] + public System.DateTime? ExpirationDate {get; set; } + + /// + /// Gets or sets indicates whether another user can take ownership of the + /// virtual machine + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.allowClaim")] + public bool? AllowClaim {get; set; } + + /// + /// Gets or sets storage type to use for virtual machine (i.e. Standard, + /// Premium). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.storageType")] + public string StorageType {get; set; } + + /// + /// Gets or sets tells source of creation of lab virtual machine. Output + /// property only. Possible values include: 'FromCustomImage', 'FromGalleryImage' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.virtualMachineCreationSource")] + public string VirtualMachineCreationSource {get; set; } + + /// + /// Gets or sets the resource ID of the environment that contains this virtual + /// machine, if any. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.environmentId")] + public string EnvironmentId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameterProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameterProperties.cs new file mode 100644 index 000000000000..6d1152d4946a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineCreationParameterProperties.cs @@ -0,0 +1,357 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties for virtual machine creation. + /// + public partial class LabVirtualMachineCreationParameterProperties + { + /// + /// Initializes a new instance of the LabVirtualMachineCreationParameterProperties class. + /// + public LabVirtualMachineCreationParameterProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabVirtualMachineCreationParameterProperties class. + /// + + /// The number of virtual machine instances to create. + /// + + /// The notes of the virtual machine. + /// + + /// The object identifier of the owner of the virtual machine. + /// + + /// The user principal name of the virtual machine owner. + /// + + /// The object identifier of the creator of the virtual machine. + /// + + /// The email address of creator of the virtual machine. + /// + + /// The creation date of the virtual machine. + /// + + /// The custom image identifier of the virtual machine. + /// + + /// The OS type of the virtual machine. + /// + + /// The size of the virtual machine. + /// + + /// The user name of the virtual machine. + /// + + /// The password of the virtual machine administrator. + /// + + /// The SSH key of the virtual machine administrator. + /// + + /// Indicates whether this virtual machine uses an SSH key for authentication. + /// + + /// The fully-qualified domain name of the virtual machine. + /// + + /// The lab subnet name of the virtual machine. + /// + + /// The lab virtual network identifier of the virtual machine. + /// + + /// Indicates whether the virtual machine is to be created without a public IP + /// address. + /// + + /// The artifacts to be installed on the virtual machine. + /// + + /// The artifact deployment status for the virtual machine. + /// + + /// The Microsoft Azure Marketplace image reference of the virtual machine. + /// + + /// The compute virtual machine properties. + /// + + /// The network interface properties. + /// + + /// The applicable schedule for the virtual machine. + /// + + /// The expiration date for VM. + /// + + /// Indicates whether another user can take ownership of the virtual machine + /// + + /// Storage type to use for virtual machine (i.e. Standard, Premium). + /// + + /// Tells source of creation of lab virtual machine. Output property only. + /// Possible values include: 'FromCustomImage', 'FromGalleryImage' + + /// The resource ID of the environment that contains this virtual machine, if + /// any. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabVirtualMachineCreationParameterProperties(BulkCreationParameters bulkCreationParameters = default(BulkCreationParameters), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIPAddress = default(bool?), System.Collections.Generic.IList artifacts = default(System.Collections.Generic.IList), ArtifactDeploymentStatusProperties artifactDeploymentStatus = default(ArtifactDeploymentStatusProperties), GalleryImageReference galleryImageReference = default(GalleryImageReference), ComputeVmProperties computeVM = default(ComputeVmProperties), NetworkInterfaceProperties networkInterface = default(NetworkInterfaceProperties), ApplicableSchedule applicableSchedule = default(ApplicableSchedule), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.BulkCreationParameters = bulkCreationParameters; + this.Notes = notes; + this.OwnerObjectId = ownerObjectId; + this.OwnerUserPrincipalName = ownerUserPrincipalName; + this.CreatedByUserId = createdByUserId; + this.CreatedByUser = createdByUser; + this.CreatedDate = createdDate; + this.CustomImageId = customImageId; + this.OSType = osType; + this.Size = size; + this.UserName = userName; + this.Password = password; + this.SshKey = sshKey; + this.IsAuthenticationWithSshKey = isAuthenticationWithSshKey; + this.Fqdn = fqdn; + this.LabSubnetName = labSubnetName; + this.LabVirtualNetworkId = labVirtualNetworkId; + this.DisallowPublicIPAddress = disallowPublicIPAddress; + this.Artifacts = artifacts; + this.ArtifactDeploymentStatus = artifactDeploymentStatus; + this.GalleryImageReference = galleryImageReference; + this.ComputeVM = computeVM; + this.NetworkInterface = networkInterface; + this.ApplicableSchedule = applicableSchedule; + this.ExpirationDate = expirationDate; + this.AllowClaim = allowClaim; + this.StorageType = storageType; + this.VirtualMachineCreationSource = virtualMachineCreationSource; + this.EnvironmentId = environmentId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the number of virtual machine instances to create. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "bulkCreationParameters")] + public BulkCreationParameters BulkCreationParameters {get; set; } + + /// + /// Gets or sets the notes of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "notes")] + public string Notes {get; set; } + + /// + /// Gets or sets the object identifier of the owner of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ownerObjectId")] + public string OwnerObjectId {get; set; } + + /// + /// Gets or sets the user principal name of the virtual machine owner. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ownerUserPrincipalName")] + public string OwnerUserPrincipalName {get; set; } + + /// + /// Gets or sets the object identifier of the creator of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByUserId")] + public string CreatedByUserId {get; set; } + + /// + /// Gets or sets the email address of creator of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByUser")] + public string CreatedByUser {get; set; } + + /// + /// Gets or sets the creation date of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; set; } + + /// + /// Gets or sets the custom image identifier of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "customImageId")] + public string CustomImageId {get; set; } + + /// + /// Gets or sets the OS type of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "osType")] + public string OSType {get; set; } + + /// + /// Gets or sets the size of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "size")] + public string Size {get; set; } + + /// + /// Gets or sets the user name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "userName")] + public string UserName {get; set; } + + /// + /// Gets or sets the password of the virtual machine administrator. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "password")] + public string Password {get; set; } + + /// + /// Gets or sets the SSH key of the virtual machine administrator. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sshKey")] + public string SshKey {get; set; } + + /// + /// Gets or sets indicates whether this virtual machine uses an SSH key for + /// authentication. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "isAuthenticationWithSshKey")] + public bool? IsAuthenticationWithSshKey {get; set; } + + /// + /// Gets or sets the fully-qualified domain name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "fqdn")] + public string Fqdn {get; set; } + + /// + /// Gets or sets the lab subnet name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labSubnetName")] + public string LabSubnetName {get; set; } + + /// + /// Gets or sets the lab virtual network identifier of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labVirtualNetworkId")] + public string LabVirtualNetworkId {get; set; } + + /// + /// Gets or sets indicates whether the virtual machine is to be created without + /// a public IP address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "disallowPublicIpAddress")] + public bool? DisallowPublicIPAddress {get; set; } + + /// + /// Gets or sets the artifacts to be installed on the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifacts")] + public System.Collections.Generic.IList Artifacts {get; set; } + + /// + /// Gets or sets the artifact deployment status for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifactDeploymentStatus")] + public ArtifactDeploymentStatusProperties ArtifactDeploymentStatus {get; set; } + + /// + /// Gets or sets the Microsoft Azure Marketplace image reference of the virtual + /// machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "galleryImageReference")] + public GalleryImageReference GalleryImageReference {get; set; } + + /// + /// Gets or sets the compute virtual machine properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "computeVm")] + public ComputeVmProperties ComputeVM {get; set; } + + /// + /// Gets or sets the network interface properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "networkInterface")] + public NetworkInterfaceProperties NetworkInterface {get; set; } + + /// + /// Gets or sets the applicable schedule for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "applicableSchedule")] + public ApplicableSchedule ApplicableSchedule {get; set; } + + /// + /// Gets or sets the expiration date for VM. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "expirationDate")] + public System.DateTime? ExpirationDate {get; set; } + + /// + /// Gets or sets indicates whether another user can take ownership of the + /// virtual machine + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowClaim")] + public bool? AllowClaim {get; set; } + + /// + /// Gets or sets storage type to use for virtual machine (i.e. Standard, + /// Premium). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "storageType")] + public string StorageType {get; set; } + + /// + /// Gets or sets tells source of creation of lab virtual machine. Output + /// property only. Possible values include: 'FromCustomImage', 'FromGalleryImage' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "virtualMachineCreationSource")] + public string VirtualMachineCreationSource {get; set; } + + /// + /// Gets or sets the resource ID of the environment that contains this virtual + /// machine, if any. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "environmentId")] + public string EnvironmentId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineFragment.cs new file mode 100644 index 000000000000..1179a08dcbe4 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineFragment.cs @@ -0,0 +1,364 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A virtual machine. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class LabVirtualMachineFragment : Resource + { + /// + /// Initializes a new instance of the LabVirtualMachineFragment class. + /// + public LabVirtualMachineFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabVirtualMachineFragment 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 notes of the virtual machine. + /// + + /// The object identifier of the owner of the virtual machine. + /// + + /// The user principal name of the virtual machine owner. + /// + + /// The object identifier of the creator of the virtual machine. + /// + + /// The email address of creator of the virtual machine. + /// + + /// The creation date of the virtual machine. + /// + + /// The custom image identifier of the virtual machine. + /// + + /// The OS type of the virtual machine. + /// + + /// The size of the virtual machine. + /// + + /// The user name of the virtual machine. + /// + + /// The password of the virtual machine administrator. + /// + + /// The SSH key of the virtual machine administrator. + /// + + /// Indicates whether this virtual machine uses an SSH key for authentication. + /// + + /// The fully-qualified domain name of the virtual machine. + /// + + /// The lab subnet name of the virtual machine. + /// + + /// The lab virtual network identifier of the virtual machine. + /// + + /// Indicates whether the virtual machine is to be created without a public IP + /// address. + /// + + /// The artifacts to be installed on the virtual machine. + /// + + /// The artifact deployment status for the virtual machine. + /// + + /// The Microsoft Azure Marketplace image reference of the virtual machine. + /// + + /// The compute virtual machine properties. + /// + + /// The network interface properties. + /// + + /// The applicable schedule for the virtual machine. + /// + + /// The expiration date for VM. + /// + + /// Indicates whether another user can take ownership of the virtual machine + /// + + /// Storage type to use for virtual machine (i.e. Standard, Premium). + /// + + /// Tells source of creation of lab virtual machine. Output property only. + /// Possible values include: 'FromCustomImage', 'FromGalleryImage' + + /// The resource ID of the environment that contains this virtual machine, if + /// any. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabVirtualMachineFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIPAddress = default(bool?), System.Collections.Generic.IList artifacts = default(System.Collections.Generic.IList), ArtifactDeploymentStatusPropertiesFragment artifactDeploymentStatus = default(ArtifactDeploymentStatusPropertiesFragment), GalleryImageReferenceFragment galleryImageReference = default(GalleryImageReferenceFragment), ComputeVmPropertiesFragment computeVM = default(ComputeVmPropertiesFragment), NetworkInterfacePropertiesFragment networkInterface = default(NetworkInterfacePropertiesFragment), ApplicableScheduleFragment applicableSchedule = default(ApplicableScheduleFragment), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.Notes = notes; + this.OwnerObjectId = ownerObjectId; + this.OwnerUserPrincipalName = ownerUserPrincipalName; + this.CreatedByUserId = createdByUserId; + this.CreatedByUser = createdByUser; + this.CreatedDate = createdDate; + this.CustomImageId = customImageId; + this.OSType = osType; + this.Size = size; + this.UserName = userName; + this.Password = password; + this.SshKey = sshKey; + this.IsAuthenticationWithSshKey = isAuthenticationWithSshKey; + this.Fqdn = fqdn; + this.LabSubnetName = labSubnetName; + this.LabVirtualNetworkId = labVirtualNetworkId; + this.DisallowPublicIPAddress = disallowPublicIPAddress; + this.Artifacts = artifacts; + this.ArtifactDeploymentStatus = artifactDeploymentStatus; + this.GalleryImageReference = galleryImageReference; + this.ComputeVM = computeVM; + this.NetworkInterface = networkInterface; + this.ApplicableSchedule = applicableSchedule; + this.ExpirationDate = expirationDate; + this.AllowClaim = allowClaim; + this.StorageType = storageType; + this.VirtualMachineCreationSource = virtualMachineCreationSource; + this.EnvironmentId = environmentId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the notes of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.notes")] + public string Notes {get; set; } + + /// + /// Gets or sets the object identifier of the owner of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.ownerObjectId")] + public string OwnerObjectId {get; set; } + + /// + /// Gets or sets the user principal name of the virtual machine owner. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.ownerUserPrincipalName")] + public string OwnerUserPrincipalName {get; set; } + + /// + /// Gets or sets the object identifier of the creator of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByUserId")] + public string CreatedByUserId {get; set; } + + /// + /// Gets or sets the email address of creator of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByUser")] + public string CreatedByUser {get; set; } + + /// + /// Gets or sets the creation date of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; set; } + + /// + /// Gets or sets the custom image identifier of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customImageId")] + public string CustomImageId {get; set; } + + /// + /// Gets or sets the OS type of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.osType")] + public string OSType {get; set; } + + /// + /// Gets or sets the size of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.size")] + public string Size {get; set; } + + /// + /// Gets or sets the user name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.userName")] + public string UserName {get; set; } + + /// + /// Gets or sets the password of the virtual machine administrator. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.password")] + public string Password {get; set; } + + /// + /// Gets or sets the SSH key of the virtual machine administrator. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.sshKey")] + public string SshKey {get; set; } + + /// + /// Gets or sets indicates whether this virtual machine uses an SSH key for + /// authentication. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.isAuthenticationWithSshKey")] + public bool? IsAuthenticationWithSshKey {get; set; } + + /// + /// Gets or sets the fully-qualified domain name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.fqdn")] + public string Fqdn {get; set; } + + /// + /// Gets or sets the lab subnet name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labSubnetName")] + public string LabSubnetName {get; set; } + + /// + /// Gets or sets the lab virtual network identifier of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labVirtualNetworkId")] + public string LabVirtualNetworkId {get; set; } + + /// + /// Gets or sets indicates whether the virtual machine is to be created without + /// a public IP address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.disallowPublicIpAddress")] + public bool? DisallowPublicIPAddress {get; set; } + + /// + /// Gets or sets the artifacts to be installed on the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.artifacts")] + public System.Collections.Generic.IList Artifacts {get; set; } + + /// + /// Gets or sets the artifact deployment status for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.artifactDeploymentStatus")] + public ArtifactDeploymentStatusPropertiesFragment ArtifactDeploymentStatus {get; set; } + + /// + /// Gets or sets the Microsoft Azure Marketplace image reference of the virtual + /// machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.galleryImageReference")] + public GalleryImageReferenceFragment GalleryImageReference {get; set; } + + /// + /// Gets or sets the compute virtual machine properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.computeVm")] + public ComputeVmPropertiesFragment ComputeVM {get; set; } + + /// + /// Gets or sets the network interface properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.networkInterface")] + public NetworkInterfacePropertiesFragment NetworkInterface {get; set; } + + /// + /// Gets or sets the applicable schedule for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.applicableSchedule")] + public ApplicableScheduleFragment ApplicableSchedule {get; set; } + + /// + /// Gets or sets the expiration date for VM. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.expirationDate")] + public System.DateTime? ExpirationDate {get; set; } + + /// + /// Gets or sets indicates whether another user can take ownership of the + /// virtual machine + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.allowClaim")] + public bool? AllowClaim {get; set; } + + /// + /// Gets or sets storage type to use for virtual machine (i.e. Standard, + /// Premium). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.storageType")] + public string StorageType {get; set; } + + /// + /// Gets or sets tells source of creation of lab virtual machine. Output + /// property only. Possible values include: 'FromCustomImage', 'FromGalleryImage' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.virtualMachineCreationSource")] + public string VirtualMachineCreationSource {get; set; } + + /// + /// Gets or sets the resource ID of the environment that contains this virtual + /// machine, if any. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.environmentId")] + public string EnvironmentId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineProperties.cs new file mode 100644 index 000000000000..98af8448e611 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachineProperties.cs @@ -0,0 +1,357 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a virtual machine. + /// + public partial class LabVirtualMachineProperties + { + /// + /// Initializes a new instance of the LabVirtualMachineProperties class. + /// + public LabVirtualMachineProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabVirtualMachineProperties class. + /// + + /// The notes of the virtual machine. + /// + + /// The object identifier of the owner of the virtual machine. + /// + + /// The user principal name of the virtual machine owner. + /// + + /// The object identifier of the creator of the virtual machine. + /// + + /// The email address of creator of the virtual machine. + /// + + /// The creation date of the virtual machine. + /// + + /// The resource identifier (Microsoft.Compute) of the virtual machine. + /// + + /// The custom image identifier of the virtual machine. + /// + + /// The OS type of the virtual machine. + /// + + /// The size of the virtual machine. + /// + + /// The user name of the virtual machine. + /// + + /// The password of the virtual machine administrator. + /// + + /// The SSH key of the virtual machine administrator. + /// + + /// Indicates whether this virtual machine uses an SSH key for authentication. + /// + + /// The fully-qualified domain name of the virtual machine. + /// + + /// The lab subnet name of the virtual machine. + /// + + /// The lab virtual network identifier of the virtual machine. + /// + + /// Indicates whether the virtual machine is to be created without a public IP + /// address. + /// + + /// The artifacts to be installed on the virtual machine. + /// + + /// The artifact deployment status for the virtual machine. + /// + + /// The Microsoft Azure Marketplace image reference of the virtual machine. + /// + + /// The compute virtual machine properties. + /// + + /// The network interface properties. + /// + + /// The applicable schedule for the virtual machine. + /// + + /// The expiration date for VM. + /// + + /// Indicates whether another user can take ownership of the virtual machine + /// + + /// Storage type to use for virtual machine (i.e. Standard, Premium). + /// + + /// Tells source of creation of lab virtual machine. Output property only. + /// Possible values include: 'FromCustomImage', 'FromGalleryImage' + + /// The resource ID of the environment that contains this virtual machine, if + /// any. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabVirtualMachineProperties(string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string computeId = default(string), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIPAddress = default(bool?), System.Collections.Generic.IList artifacts = default(System.Collections.Generic.IList), ArtifactDeploymentStatusProperties artifactDeploymentStatus = default(ArtifactDeploymentStatusProperties), GalleryImageReference galleryImageReference = default(GalleryImageReference), ComputeVmProperties computeVM = default(ComputeVmProperties), NetworkInterfaceProperties networkInterface = default(NetworkInterfaceProperties), ApplicableSchedule applicableSchedule = default(ApplicableSchedule), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Notes = notes; + this.OwnerObjectId = ownerObjectId; + this.OwnerUserPrincipalName = ownerUserPrincipalName; + this.CreatedByUserId = createdByUserId; + this.CreatedByUser = createdByUser; + this.CreatedDate = createdDate; + this.ComputeId = computeId; + this.CustomImageId = customImageId; + this.OSType = osType; + this.Size = size; + this.UserName = userName; + this.Password = password; + this.SshKey = sshKey; + this.IsAuthenticationWithSshKey = isAuthenticationWithSshKey; + this.Fqdn = fqdn; + this.LabSubnetName = labSubnetName; + this.LabVirtualNetworkId = labVirtualNetworkId; + this.DisallowPublicIPAddress = disallowPublicIPAddress; + this.Artifacts = artifacts; + this.ArtifactDeploymentStatus = artifactDeploymentStatus; + this.GalleryImageReference = galleryImageReference; + this.ComputeVM = computeVM; + this.NetworkInterface = networkInterface; + this.ApplicableSchedule = applicableSchedule; + this.ExpirationDate = expirationDate; + this.AllowClaim = allowClaim; + this.StorageType = storageType; + this.VirtualMachineCreationSource = virtualMachineCreationSource; + this.EnvironmentId = environmentId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the notes of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "notes")] + public string Notes {get; set; } + + /// + /// Gets or sets the object identifier of the owner of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ownerObjectId")] + public string OwnerObjectId {get; set; } + + /// + /// Gets or sets the user principal name of the virtual machine owner. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ownerUserPrincipalName")] + public string OwnerUserPrincipalName {get; set; } + + /// + /// Gets or sets the object identifier of the creator of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByUserId")] + public string CreatedByUserId {get; set; } + + /// + /// Gets or sets the email address of creator of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByUser")] + public string CreatedByUser {get; set; } + + /// + /// Gets or sets the creation date of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; set; } + + /// + /// Gets the resource identifier (Microsoft.Compute) of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "computeId")] + public string ComputeId {get; private set; } + + /// + /// Gets or sets the custom image identifier of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "customImageId")] + public string CustomImageId {get; set; } + + /// + /// Gets or sets the OS type of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "osType")] + public string OSType {get; set; } + + /// + /// Gets or sets the size of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "size")] + public string Size {get; set; } + + /// + /// Gets or sets the user name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "userName")] + public string UserName {get; set; } + + /// + /// Gets or sets the password of the virtual machine administrator. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "password")] + public string Password {get; set; } + + /// + /// Gets or sets the SSH key of the virtual machine administrator. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sshKey")] + public string SshKey {get; set; } + + /// + /// Gets or sets indicates whether this virtual machine uses an SSH key for + /// authentication. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "isAuthenticationWithSshKey")] + public bool? IsAuthenticationWithSshKey {get; set; } + + /// + /// Gets or sets the fully-qualified domain name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "fqdn")] + public string Fqdn {get; set; } + + /// + /// Gets or sets the lab subnet name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labSubnetName")] + public string LabSubnetName {get; set; } + + /// + /// Gets or sets the lab virtual network identifier of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labVirtualNetworkId")] + public string LabVirtualNetworkId {get; set; } + + /// + /// Gets or sets indicates whether the virtual machine is to be created without + /// a public IP address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "disallowPublicIpAddress")] + public bool? DisallowPublicIPAddress {get; set; } + + /// + /// Gets or sets the artifacts to be installed on the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifacts")] + public System.Collections.Generic.IList Artifacts {get; set; } + + /// + /// Gets or sets the artifact deployment status for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifactDeploymentStatus")] + public ArtifactDeploymentStatusProperties ArtifactDeploymentStatus {get; set; } + + /// + /// Gets or sets the Microsoft Azure Marketplace image reference of the virtual + /// machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "galleryImageReference")] + public GalleryImageReference GalleryImageReference {get; set; } + + /// + /// Gets or sets the compute virtual machine properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "computeVm")] + public ComputeVmProperties ComputeVM {get; set; } + + /// + /// Gets or sets the network interface properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "networkInterface")] + public NetworkInterfaceProperties NetworkInterface {get; set; } + + /// + /// Gets or sets the applicable schedule for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "applicableSchedule")] + public ApplicableSchedule ApplicableSchedule {get; set; } + + /// + /// Gets or sets the expiration date for VM. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "expirationDate")] + public System.DateTime? ExpirationDate {get; set; } + + /// + /// Gets or sets indicates whether another user can take ownership of the + /// virtual machine + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowClaim")] + public bool? AllowClaim {get; set; } + + /// + /// Gets or sets storage type to use for virtual machine (i.e. Standard, + /// Premium). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "storageType")] + public string StorageType {get; set; } + + /// + /// Gets or sets tells source of creation of lab virtual machine. Output + /// property only. Possible values include: 'FromCustomImage', 'FromGalleryImage' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "virtualMachineCreationSource")] + public string VirtualMachineCreationSource {get; set; } + + /// + /// Gets or sets the resource ID of the environment that contains this virtual + /// machine, if any. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "environmentId")] + public string EnvironmentId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachinePropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachinePropertiesFragment.cs new file mode 100644 index 000000000000..356465ca92c8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LabVirtualMachinePropertiesFragment.cs @@ -0,0 +1,347 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a virtual machine. + /// + public partial class LabVirtualMachinePropertiesFragment + { + /// + /// Initializes a new instance of the LabVirtualMachinePropertiesFragment class. + /// + public LabVirtualMachinePropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabVirtualMachinePropertiesFragment class. + /// + + /// The notes of the virtual machine. + /// + + /// The object identifier of the owner of the virtual machine. + /// + + /// The user principal name of the virtual machine owner. + /// + + /// The object identifier of the creator of the virtual machine. + /// + + /// The email address of creator of the virtual machine. + /// + + /// The creation date of the virtual machine. + /// + + /// The custom image identifier of the virtual machine. + /// + + /// The OS type of the virtual machine. + /// + + /// The size of the virtual machine. + /// + + /// The user name of the virtual machine. + /// + + /// The password of the virtual machine administrator. + /// + + /// The SSH key of the virtual machine administrator. + /// + + /// Indicates whether this virtual machine uses an SSH key for authentication. + /// + + /// The fully-qualified domain name of the virtual machine. + /// + + /// The lab subnet name of the virtual machine. + /// + + /// The lab virtual network identifier of the virtual machine. + /// + + /// Indicates whether the virtual machine is to be created without a public IP + /// address. + /// + + /// The artifacts to be installed on the virtual machine. + /// + + /// The artifact deployment status for the virtual machine. + /// + + /// The Microsoft Azure Marketplace image reference of the virtual machine. + /// + + /// The compute virtual machine properties. + /// + + /// The network interface properties. + /// + + /// The applicable schedule for the virtual machine. + /// + + /// The expiration date for VM. + /// + + /// Indicates whether another user can take ownership of the virtual machine + /// + + /// Storage type to use for virtual machine (i.e. Standard, Premium). + /// + + /// Tells source of creation of lab virtual machine. Output property only. + /// Possible values include: 'FromCustomImage', 'FromGalleryImage' + + /// The resource ID of the environment that contains this virtual machine, if + /// any. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public LabVirtualMachinePropertiesFragment(string notes = default(string), string ownerObjectId = default(string), string ownerUserPrincipalName = default(string), string createdByUserId = default(string), string createdByUser = default(string), System.DateTime? createdDate = default(System.DateTime?), string customImageId = default(string), string osType = default(string), string size = default(string), string userName = default(string), string password = default(string), string sshKey = default(string), bool? isAuthenticationWithSshKey = default(bool?), string fqdn = default(string), string labSubnetName = default(string), string labVirtualNetworkId = default(string), bool? disallowPublicIPAddress = default(bool?), System.Collections.Generic.IList artifacts = default(System.Collections.Generic.IList), ArtifactDeploymentStatusPropertiesFragment artifactDeploymentStatus = default(ArtifactDeploymentStatusPropertiesFragment), GalleryImageReferenceFragment galleryImageReference = default(GalleryImageReferenceFragment), ComputeVmPropertiesFragment computeVM = default(ComputeVmPropertiesFragment), NetworkInterfacePropertiesFragment networkInterface = default(NetworkInterfacePropertiesFragment), ApplicableScheduleFragment applicableSchedule = default(ApplicableScheduleFragment), System.DateTime? expirationDate = default(System.DateTime?), bool? allowClaim = default(bool?), string storageType = default(string), string virtualMachineCreationSource = default(string), string environmentId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Notes = notes; + this.OwnerObjectId = ownerObjectId; + this.OwnerUserPrincipalName = ownerUserPrincipalName; + this.CreatedByUserId = createdByUserId; + this.CreatedByUser = createdByUser; + this.CreatedDate = createdDate; + this.CustomImageId = customImageId; + this.OSType = osType; + this.Size = size; + this.UserName = userName; + this.Password = password; + this.SshKey = sshKey; + this.IsAuthenticationWithSshKey = isAuthenticationWithSshKey; + this.Fqdn = fqdn; + this.LabSubnetName = labSubnetName; + this.LabVirtualNetworkId = labVirtualNetworkId; + this.DisallowPublicIPAddress = disallowPublicIPAddress; + this.Artifacts = artifacts; + this.ArtifactDeploymentStatus = artifactDeploymentStatus; + this.GalleryImageReference = galleryImageReference; + this.ComputeVM = computeVM; + this.NetworkInterface = networkInterface; + this.ApplicableSchedule = applicableSchedule; + this.ExpirationDate = expirationDate; + this.AllowClaim = allowClaim; + this.StorageType = storageType; + this.VirtualMachineCreationSource = virtualMachineCreationSource; + this.EnvironmentId = environmentId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the notes of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "notes")] + public string Notes {get; set; } + + /// + /// Gets or sets the object identifier of the owner of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ownerObjectId")] + public string OwnerObjectId {get; set; } + + /// + /// Gets or sets the user principal name of the virtual machine owner. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ownerUserPrincipalName")] + public string OwnerUserPrincipalName {get; set; } + + /// + /// Gets or sets the object identifier of the creator of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByUserId")] + public string CreatedByUserId {get; set; } + + /// + /// Gets or sets the email address of creator of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByUser")] + public string CreatedByUser {get; set; } + + /// + /// Gets or sets the creation date of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; set; } + + /// + /// Gets or sets the custom image identifier of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "customImageId")] + public string CustomImageId {get; set; } + + /// + /// Gets or sets the OS type of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "osType")] + public string OSType {get; set; } + + /// + /// Gets or sets the size of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "size")] + public string Size {get; set; } + + /// + /// Gets or sets the user name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "userName")] + public string UserName {get; set; } + + /// + /// Gets or sets the password of the virtual machine administrator. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "password")] + public string Password {get; set; } + + /// + /// Gets or sets the SSH key of the virtual machine administrator. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sshKey")] + public string SshKey {get; set; } + + /// + /// Gets or sets indicates whether this virtual machine uses an SSH key for + /// authentication. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "isAuthenticationWithSshKey")] + public bool? IsAuthenticationWithSshKey {get; set; } + + /// + /// Gets or sets the fully-qualified domain name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "fqdn")] + public string Fqdn {get; set; } + + /// + /// Gets or sets the lab subnet name of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labSubnetName")] + public string LabSubnetName {get; set; } + + /// + /// Gets or sets the lab virtual network identifier of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labVirtualNetworkId")] + public string LabVirtualNetworkId {get; set; } + + /// + /// Gets or sets indicates whether the virtual machine is to be created without + /// a public IP address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "disallowPublicIpAddress")] + public bool? DisallowPublicIPAddress {get; set; } + + /// + /// Gets or sets the artifacts to be installed on the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifacts")] + public System.Collections.Generic.IList Artifacts {get; set; } + + /// + /// Gets or sets the artifact deployment status for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "artifactDeploymentStatus")] + public ArtifactDeploymentStatusPropertiesFragment ArtifactDeploymentStatus {get; set; } + + /// + /// Gets or sets the Microsoft Azure Marketplace image reference of the virtual + /// machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "galleryImageReference")] + public GalleryImageReferenceFragment GalleryImageReference {get; set; } + + /// + /// Gets or sets the compute virtual machine properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "computeVm")] + public ComputeVmPropertiesFragment ComputeVM {get; set; } + + /// + /// Gets or sets the network interface properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "networkInterface")] + public NetworkInterfacePropertiesFragment NetworkInterface {get; set; } + + /// + /// Gets or sets the applicable schedule for the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "applicableSchedule")] + public ApplicableScheduleFragment ApplicableSchedule {get; set; } + + /// + /// Gets or sets the expiration date for VM. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "expirationDate")] + public System.DateTime? ExpirationDate {get; set; } + + /// + /// Gets or sets indicates whether another user can take ownership of the + /// virtual machine + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowClaim")] + public bool? AllowClaim {get; set; } + + /// + /// Gets or sets storage type to use for virtual machine (i.e. Standard, + /// Premium). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "storageType")] + public string StorageType {get; set; } + + /// + /// Gets or sets tells source of creation of lab virtual machine. Output + /// property only. Possible values include: 'FromCustomImage', 'FromGalleryImage' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "virtualMachineCreationSource")] + public string VirtualMachineCreationSource {get; set; } + + /// + /// Gets or sets the resource ID of the environment that contains this virtual + /// machine, if any. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "environmentId")] + public string EnvironmentId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfo.cs new file mode 100644 index 000000000000..3c5634f8c405 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsInfo.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Information about a Linux OS. + /// + public partial class LinuxOsInfo + { + /// + /// Initializes a new instance of the LinuxOsInfo class. + /// + public LinuxOsInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LinuxOsInfo class. + /// + + /// The state of the Linux OS (i.e. NonDeprovisioned, DeprovisionRequested, + /// DeprovisionApplied). + /// Possible values include: 'NonDeprovisioned', 'DeprovisionRequested', + /// 'DeprovisionApplied' + public LinuxOsInfo(string linuxOSState = default(string)) + + { + this.LinuxOSState = linuxOSState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the state of the Linux OS (i.e. NonDeprovisioned, + /// DeprovisionRequested, DeprovisionApplied). Possible values include: 'NonDeprovisioned', 'DeprovisionRequested', 'DeprovisionApplied' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "linuxOsState")] + public string LinuxOSState {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsState.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsState.cs new file mode 100644 index 000000000000..35fad833c348 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/LinuxOsState.cs @@ -0,0 +1,20 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for LinuxOsState. + /// + + + public static class LinuxOsState + { + public const string NonDeprovisioned = "NonDeprovisioned"; + public const string DeprovisionRequested = "DeprovisionRequested"; + public const string DeprovisionApplied = "DeprovisionApplied"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfaceProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfaceProperties.cs new file mode 100644 index 000000000000..59d8c15b832a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfaceProperties.cs @@ -0,0 +1,135 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a network interface. + /// + public partial class NetworkInterfaceProperties + { + /// + /// Initializes a new instance of the NetworkInterfaceProperties class. + /// + public NetworkInterfaceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkInterfaceProperties class. + /// + + /// The resource ID of the virtual network. + /// + + /// The resource ID of the sub net. + /// + + /// The resource ID of the public IP address. + /// + + /// The public IP address. + /// + + /// The private IP address. + /// + + /// The DNS name. + /// + + /// 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 configuration for sharing a public IP address across multiple virtual + /// machines. + /// + public NetworkInterfaceProperties(string virtualNetworkId = default(string), string subnetId = default(string), string publicIPAddressId = default(string), string publicIPAddress = default(string), string privateIPAddress = default(string), string dnsName = default(string), string rdpAuthority = default(string), string sshAuthority = default(string), SharedPublicIpAddressConfiguration sharedPublicIPAddressConfiguration = default(SharedPublicIpAddressConfiguration)) + + { + this.VirtualNetworkId = virtualNetworkId; + this.SubnetId = subnetId; + this.PublicIPAddressId = publicIPAddressId; + this.PublicIPAddress = publicIPAddress; + this.PrivateIPAddress = privateIPAddress; + this.DnsName = dnsName; + this.RdpAuthority = rdpAuthority; + this.SshAuthority = sshAuthority; + this.SharedPublicIPAddressConfiguration = sharedPublicIPAddressConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the resource ID of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "virtualNetworkId")] + public string VirtualNetworkId {get; set; } + + /// + /// Gets or sets the resource ID of the sub net. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subnetId")] + public string SubnetId {get; set; } + + /// + /// Gets or sets the resource ID of the public IP address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "publicIpAddressId")] + public string PublicIPAddressId {get; set; } + + /// + /// Gets or sets the public IP address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "publicIpAddress")] + public string PublicIPAddress {get; set; } + + /// + /// Gets or sets the private IP address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "privateIpAddress")] + public string PrivateIPAddress {get; set; } + + /// + /// Gets or sets the DNS name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dnsName")] + public string DnsName {get; set; } + + /// + /// Gets or sets the RdpAuthority property is a server DNS host name or IP + /// address followed by the service port number for RDP (Remote Desktop + /// Protocol). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "rdpAuthority")] + public string RdpAuthority {get; set; } + + /// + /// Gets or sets the SshAuthority property is a server DNS host name or IP + /// address followed by the service port number for SSH. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sshAuthority")] + public string SshAuthority {get; set; } + + /// + /// Gets or sets the configuration for sharing a public IP address across + /// multiple virtual machines. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sharedPublicIpAddressConfiguration")] + public SharedPublicIpAddressConfiguration SharedPublicIPAddressConfiguration {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfacePropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfacePropertiesFragment.cs new file mode 100644 index 000000000000..4bfdb7a76adc --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NetworkInterfacePropertiesFragment.cs @@ -0,0 +1,135 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a network interface. + /// + public partial class NetworkInterfacePropertiesFragment + { + /// + /// Initializes a new instance of the NetworkInterfacePropertiesFragment class. + /// + public NetworkInterfacePropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkInterfacePropertiesFragment class. + /// + + /// The resource ID of the virtual network. + /// + + /// The resource ID of the sub net. + /// + + /// The resource ID of the public IP address. + /// + + /// The public IP address. + /// + + /// The private IP address. + /// + + /// The DNS name. + /// + + /// 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 configuration for sharing a public IP address across multiple virtual + /// machines. + /// + public NetworkInterfacePropertiesFragment(string virtualNetworkId = default(string), string subnetId = default(string), string publicIPAddressId = default(string), string publicIPAddress = default(string), string privateIPAddress = default(string), string dnsName = default(string), string rdpAuthority = default(string), string sshAuthority = default(string), SharedPublicIpAddressConfigurationFragment sharedPublicIPAddressConfiguration = default(SharedPublicIpAddressConfigurationFragment)) + + { + this.VirtualNetworkId = virtualNetworkId; + this.SubnetId = subnetId; + this.PublicIPAddressId = publicIPAddressId; + this.PublicIPAddress = publicIPAddress; + this.PrivateIPAddress = privateIPAddress; + this.DnsName = dnsName; + this.RdpAuthority = rdpAuthority; + this.SshAuthority = sshAuthority; + this.SharedPublicIPAddressConfiguration = sharedPublicIPAddressConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the resource ID of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "virtualNetworkId")] + public string VirtualNetworkId {get; set; } + + /// + /// Gets or sets the resource ID of the sub net. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subnetId")] + public string SubnetId {get; set; } + + /// + /// Gets or sets the resource ID of the public IP address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "publicIpAddressId")] + public string PublicIPAddressId {get; set; } + + /// + /// Gets or sets the public IP address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "publicIpAddress")] + public string PublicIPAddress {get; set; } + + /// + /// Gets or sets the private IP address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "privateIpAddress")] + public string PrivateIPAddress {get; set; } + + /// + /// Gets or sets the DNS name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dnsName")] + public string DnsName {get; set; } + + /// + /// Gets or sets the RdpAuthority property is a server DNS host name or IP + /// address followed by the service port number for RDP (Remote Desktop + /// Protocol). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "rdpAuthority")] + public string RdpAuthority {get; set; } + + /// + /// Gets or sets the SshAuthority property is a server DNS host name or IP + /// address followed by the service port number for SSH. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sshAuthority")] + public string SshAuthority {get; set; } + + /// + /// Gets or sets the configuration for sharing a public IP address across + /// multiple virtual machines. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sharedPublicIpAddressConfiguration")] + public SharedPublicIpAddressConfigurationFragment SharedPublicIPAddressConfiguration {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannel.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannel.cs new file mode 100644 index 000000000000..0b21883bf506 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannel.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A notification. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class NotificationChannel : Resource + { + /// + /// Initializes a new instance of the NotificationChannel class. + /// + public NotificationChannel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NotificationChannel 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 webhook URL to send notifications to. + /// + + /// Description of notification. + /// + + /// The list of event for which this notification is enabled. + /// + + /// The creation date of the notification channel. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public NotificationChannel(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string webHookUrl = default(string), string description = default(string), System.Collections.Generic.IList events = default(System.Collections.Generic.IList), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.WebHookUrl = webHookUrl; + this.Description = description; + this.Events = events; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the webhook URL to send notifications to. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.webHookUrl")] + public string WebHookUrl {get; set; } + + /// + /// Gets or sets description of notification. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } + + /// + /// Gets or sets the list of event for which this notification is enabled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.events")] + public System.Collections.Generic.IList Events {get; set; } + + /// + /// Gets the creation date of the notification channel. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelEventType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelEventType.cs new file mode 100644 index 000000000000..bbd575f13ab4 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelEventType.cs @@ -0,0 +1,19 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for NotificationChannelEventType. + /// + + + public static class NotificationChannelEventType + { + public const string AutoShutdown = "AutoShutdown"; + public const string Cost = "Cost"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelFragment.cs new file mode 100644 index 000000000000..a49b7e4fbc66 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelFragment.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A notification. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class NotificationChannelFragment : Resource + { + /// + /// Initializes a new instance of the NotificationChannelFragment class. + /// + public NotificationChannelFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NotificationChannelFragment 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 webhook URL to send notifications to. + /// + + /// Description of notification. + /// + + /// The list of event for which this notification is enabled. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public NotificationChannelFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string webHookUrl = default(string), string description = default(string), System.Collections.Generic.IList events = default(System.Collections.Generic.IList), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.WebHookUrl = webHookUrl; + this.Description = description; + this.Events = events; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the webhook URL to send notifications to. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.webHookUrl")] + public string WebHookUrl {get; set; } + + /// + /// Gets or sets description of notification. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } + + /// + /// Gets or sets the list of event for which this notification is enabled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.events")] + public System.Collections.Generic.IList Events {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelProperties.cs new file mode 100644 index 000000000000..bf1b0b85c3d9 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelProperties.cs @@ -0,0 +1,98 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a schedule. + /// + public partial class NotificationChannelProperties + { + /// + /// Initializes a new instance of the NotificationChannelProperties class. + /// + public NotificationChannelProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NotificationChannelProperties class. + /// + + /// The webhook URL to send notifications to. + /// + + /// Description of notification. + /// + + /// The list of event for which this notification is enabled. + /// + + /// The creation date of the notification channel. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public NotificationChannelProperties(string webHookUrl = default(string), string description = default(string), System.Collections.Generic.IList events = default(System.Collections.Generic.IList), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.WebHookUrl = webHookUrl; + this.Description = description; + this.Events = events; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the webhook URL to send notifications to. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "webHookUrl")] + public string WebHookUrl {get; set; } + + /// + /// Gets or sets description of notification. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the list of event for which this notification is enabled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "events")] + public System.Collections.Generic.IList Events {get; set; } + + /// + /// Gets the creation date of the notification channel. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelPropertiesFragment.cs new file mode 100644 index 000000000000..dc51ec48b22a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationChannelPropertiesFragment.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a schedule. + /// + public partial class NotificationChannelPropertiesFragment + { + /// + /// Initializes a new instance of the NotificationChannelPropertiesFragment class. + /// + public NotificationChannelPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NotificationChannelPropertiesFragment class. + /// + + /// The webhook URL to send notifications to. + /// + + /// Description of notification. + /// + + /// The list of event for which this notification is enabled. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public NotificationChannelPropertiesFragment(string webHookUrl = default(string), string description = default(string), System.Collections.Generic.IList events = default(System.Collections.Generic.IList), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.WebHookUrl = webHookUrl; + this.Description = description; + this.Events = events; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the webhook URL to send notifications to. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "webHookUrl")] + public string WebHookUrl {get; set; } + + /// + /// Gets or sets description of notification. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the list of event for which this notification is enabled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "events")] + public System.Collections.Generic.IList Events {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettings.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettings.cs new file mode 100644 index 000000000000..e0fb24892023 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettings.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Notification settings for a schedule. + /// + public partial class NotificationSettings + { + /// + /// Initializes a new instance of the NotificationSettings class. + /// + public NotificationSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NotificationSettings class. + /// + + /// If notifications are enabled for this schedule (i.e. Enabled, Disabled). + /// Possible values include: 'Disabled', 'Enabled' + + /// Time in minutes before event at which notification will be sent. + /// + + /// The webhook URL to which the notification will be sent. + /// + public NotificationSettings(string status = default(string), int? timeInMinutes = default(int?), string webhookUrl = default(string)) + + { + this.Status = status; + this.TimeInMinutes = timeInMinutes; + this.WebhookUrl = webhookUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets if notifications are enabled for this schedule (i.e. Enabled, + /// Disabled). Possible values include: 'Disabled', 'Enabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets time in minutes before event at which notification will be + /// sent. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "timeInMinutes")] + public int? TimeInMinutes {get; set; } + + /// + /// Gets or sets the webhook URL to which the notification will be sent. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "webhookUrl")] + public string WebhookUrl {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettingsFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettingsFragment.cs new file mode 100644 index 000000000000..dbfff46f87ce --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationSettingsFragment.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Notification settings for a schedule. + /// + public partial class NotificationSettingsFragment + { + /// + /// Initializes a new instance of the NotificationSettingsFragment class. + /// + public NotificationSettingsFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NotificationSettingsFragment class. + /// + + /// If notifications are enabled for this schedule (i.e. Enabled, Disabled). + /// Possible values include: 'Disabled', 'Enabled' + + /// Time in minutes before event at which notification will be sent. + /// + + /// The webhook URL to which the notification will be sent. + /// + public NotificationSettingsFragment(string status = default(string), int? timeInMinutes = default(int?), string webhookUrl = default(string)) + + { + this.Status = status; + this.TimeInMinutes = timeInMinutes; + this.WebhookUrl = webhookUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets if notifications are enabled for this schedule (i.e. Enabled, + /// Disabled). Possible values include: 'Disabled', 'Enabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets time in minutes before event at which notification will be + /// sent. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "timeInMinutes")] + public int? TimeInMinutes {get; set; } + + /// + /// Gets or sets the webhook URL to which the notification will be sent. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "webhookUrl")] + public string WebhookUrl {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationStatus.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationStatus.cs new file mode 100644 index 000000000000..5122c4032625 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotificationStatus.cs @@ -0,0 +1,19 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for NotificationStatus. + /// + + + public static class NotificationStatus + { + public const string Disabled = "Disabled"; + public const string Enabled = "Enabled"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotifyParameters.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotifyParameters.cs new file mode 100644 index 000000000000..ce49888fd808 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/NotifyParameters.cs @@ -0,0 +1,58 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties for generating a Notification. + /// + public partial class NotifyParameters + { + /// + /// Initializes a new instance of the NotifyParameters class. + /// + public NotifyParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NotifyParameters class. + /// + + /// The type of event (i.e. AutoShutdown, Cost) + /// Possible values include: 'AutoShutdown', 'Cost' + + /// Properties for the notification in json format. + /// + public NotifyParameters(string eventName = default(string), string jsonPayload = default(string)) + + { + this.EventName = eventName; + this.JsonPayload = jsonPayload; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the type of event (i.e. AutoShutdown, Cost) Possible values include: 'AutoShutdown', 'Cost' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "eventName")] + public string EventName {get; set; } + + /// + /// Gets or sets properties for the notification in json format. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "jsonPayload")] + public string JsonPayload {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationError.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationError.cs new file mode 100644 index 000000000000..430e5b266635 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationError.cs @@ -0,0 +1,58 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Error details for the operation in case of a failure. + /// + public partial class OperationError + { + /// + /// Initializes a new instance of the OperationError class. + /// + public OperationError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationError 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)) + + { + this.Code = code; + this.Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the error code of the operation error. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } + + /// + /// Gets or sets the error message of the operation error. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadata.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadata.cs new file mode 100644 index 000000000000..7aa67649a8e4 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadata.cs @@ -0,0 +1,58 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// The REST API operation supported by DevTestLab ResourceProvider. + /// + public partial class OperationMetadata + { + /// + /// Initializes a new instance of the OperationMetadata class. + /// + public OperationMetadata() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationMetadata class. + /// + + /// Operation name: {provider}/{resource}/{operation} + /// + + /// The object that describes the operations + /// + public OperationMetadata(string name = default(string), OperationMetadataDisplay display = default(OperationMetadataDisplay)) + + { + this.Name = name; + this.Display = display; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets operation name: {provider}/{resource}/{operation} + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets the object that describes the operations + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "display")] + public OperationMetadataDisplay Display {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadataDisplay.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadataDisplay.cs new file mode 100644 index 000000000000..c37892758b8f --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationMetadataDisplay.cs @@ -0,0 +1,78 @@ +// 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.DevTestLabs.Models +{ + 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)) + + { + this.Provider = provider; + this.Resource = resource; + this.Operation = operation; + this.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 + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provider")] + public string Provider {get; set; } + + /// + /// Gets or sets resource type on which the operation is performed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resource")] + public string Resource {get; set; } + + /// + /// Gets or sets operation type: read, write, delete, listKeys/action, etc. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "operation")] + public string Operation {get; set; } + + /// + /// Gets or sets friendly name of the operation + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationResult.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationResult.cs new file mode 100644 index 000000000000..b0d375b52b68 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/OperationResult.cs @@ -0,0 +1,79 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// An Operation Result + /// + public partial class OperationResult + { + /// + /// Initializes a new instance of the OperationResult class. + /// + public OperationResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationResult class. + /// + + /// The operation status. + /// + + /// The status code for the operation. + /// Possible values include: 'Continue', 'SwitchingProtocols', 'OK', 'Created', + /// 'Accepted', 'NonAuthoritativeInformation', 'NoContent', 'ResetContent', + /// 'PartialContent', 'MultipleChoices', 'MovedPermanently', 'Redirect', + /// 'SeeOther', 'NotModified', 'UseProxy', 'Unused', 'TemporaryRedirect', + /// 'BadRequest', 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', + /// 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', + /// 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', + /// 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestUriTooLong', + /// 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', + /// 'ExpectationFailed', 'UpgradeRequired', 'InternalServerError', + /// 'NotImplemented', 'BadGateway', 'ServiceUnavailable', 'GatewayTimeout', + /// 'HttpVersionNotSupported' + + /// Error details for the operation in case of a failure. + /// + public OperationResult(string status = default(string), string statusCode = default(string), OperationError error = default(OperationError)) + + { + this.Status = status; + this.StatusCode = statusCode; + this.Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the operation status. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets the status code for the operation. Possible values include: 'Continue', 'SwitchingProtocols', 'OK', 'Created', 'Accepted', 'NonAuthoritativeInformation', 'NoContent', 'ResetContent', 'PartialContent', 'MultipleChoices', 'MovedPermanently', 'Redirect', 'SeeOther', 'NotModified', 'UseProxy', 'Unused', 'TemporaryRedirect', 'BadRequest', 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestUriTooLong', 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', 'ExpectationFailed', 'UpgradeRequired', 'InternalServerError', 'NotImplemented', 'BadGateway', 'ServiceUnavailable', 'GatewayTimeout', 'HttpVersionNotSupported' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "statusCode")] + public string StatusCode {get; set; } + + /// + /// Gets or sets error details for the operation in case of a failure. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "error")] + public OperationError Error {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Page.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Page.cs new file mode 100644 index 000000000000..f202354a7ece --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Page.cs @@ -0,0 +1,43 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [Newtonsoft.Json.JsonObject] + public class Page : Microsoft.Rest.Azure.IPage + { + /// + /// Gets the link to the next page. + /// + [Newtonsoft.Json.JsonProperty("nextLink")] + public System.String NextPageLink { get; private set; } + + [Newtonsoft.Json.JsonProperty("value")] + private System.Collections.Generic.IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public System.Collections.Generic.IEnumerator GetEnumerator() + { + return (Items == null) ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParameterInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParameterInfo.cs new file mode 100644 index 000000000000..699195fbd9d6 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParameterInfo.cs @@ -0,0 +1,58 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Information about an artifact's parameter. + /// + public partial class ParameterInfo + { + /// + /// Initializes a new instance of the ParameterInfo class. + /// + public ParameterInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ParameterInfo class. + /// + + /// The name of the artifact parameter. + /// + + /// The value of the artifact parameter. + /// + public ParameterInfo(string name = default(string), string value = default(string)) + + { + this.Name = name; + this.Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the artifact parameter. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets the value of the artifact parameter. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParametersValueFileInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParametersValueFileInfo.cs new file mode 100644 index 000000000000..443d1e3c3685 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ParametersValueFileInfo.cs @@ -0,0 +1,58 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A file containing a set of parameter values for an ARM template. + /// + public partial class ParametersValueFileInfo + { + /// + /// Initializes a new instance of the ParametersValueFileInfo class. + /// + public ParametersValueFileInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ParametersValueFileInfo class. + /// + + /// File name. + /// + + /// Contents of the file. + /// + public ParametersValueFileInfo(string fileName = default(string), object parametersValueInfo = default(object)) + + { + this.FileName = fileName; + this.ParametersValueInfo = parametersValueInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets file name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "fileName")] + public string FileName {get; set; } + + /// + /// Gets or sets contents of the file. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "parametersValueInfo")] + public object ParametersValueInfo {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PercentageCostThresholdProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PercentageCostThresholdProperties.cs new file mode 100644 index 000000000000..283778490333 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PercentageCostThresholdProperties.cs @@ -0,0 +1,48 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a percentage cost threshold. + /// + public partial class PercentageCostThresholdProperties + { + /// + /// Initializes a new instance of the PercentageCostThresholdProperties class. + /// + public PercentageCostThresholdProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PercentageCostThresholdProperties class. + /// + + /// The cost threshold value. + /// + public PercentageCostThresholdProperties(double? thresholdValue = default(double?)) + + { + this.ThresholdValue = thresholdValue; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the cost threshold value. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "thresholdValue")] + public double? ThresholdValue {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Policy.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Policy.cs new file mode 100644 index 000000000000..c6fce4446f91 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Policy.cs @@ -0,0 +1,153 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A Policy. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Policy : Resource + { + /// + /// Initializes a new instance of the Policy class. + /// + public Policy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Policy 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 description of the policy. + /// + + /// The status of the policy. + /// Possible values include: 'Enabled', 'Disabled' + + /// The fact name of the policy (e.g. LabVmCount, LabVmSize, + /// MaxVmsAllowedPerLab, etc. + /// Possible values include: 'UserOwnedLabVmCount', + /// 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', + /// 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' + + /// The fact data of the policy. + /// + + /// The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON + /// array of values for AllowedValuesPolicy). + /// + + /// The evaluator type of the policy (i.e. AllowedValuesPolicy, + /// MaxValuePolicy). + /// Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' + + /// The creation date of the policy. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public Policy(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string description = default(string), string status = default(string), string factName = default(string), string factData = default(string), string threshold = default(string), string evaluatorType = default(string), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.Description = description; + this.Status = status; + this.FactName = factName; + this.FactData = factData; + this.Threshold = threshold; + this.EvaluatorType = evaluatorType; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the description of the policy. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } + + /// + /// Gets or sets the status of the policy. Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; set; } + + /// + /// Gets or sets the fact name of the policy (e.g. LabVmCount, LabVmSize, + /// MaxVmsAllowedPerLab, etc. Possible values include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.factName")] + public string FactName {get; set; } + + /// + /// Gets or sets the fact data of the policy. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.factData")] + public string FactData {get; set; } + + /// + /// Gets or sets the threshold of the policy (i.e. a number for MaxValuePolicy, + /// and a JSON array of values for AllowedValuesPolicy). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.threshold")] + public string Threshold {get; set; } + + /// + /// Gets or sets the evaluator type of the policy (i.e. AllowedValuesPolicy, + /// MaxValuePolicy). Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.evaluatorType")] + public string EvaluatorType {get; set; } + + /// + /// Gets the creation date of the policy. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyEvaluatorType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyEvaluatorType.cs new file mode 100644 index 000000000000..6c8fcc602ffd --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyEvaluatorType.cs @@ -0,0 +1,19 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for PolicyEvaluatorType. + /// + + + public static class PolicyEvaluatorType + { + public const string AllowedValuesPolicy = "AllowedValuesPolicy"; + public const string MaxValuePolicy = "MaxValuePolicy"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFactName.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFactName.cs new file mode 100644 index 000000000000..2ebafb70a263 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFactName.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + + /// + /// Defines values for PolicyFactName. + /// + + + public static class PolicyFactName + { + public const string UserOwnedLabVmCount = "UserOwnedLabVmCount"; + public const string UserOwnedLabPremiumVmCount = "UserOwnedLabPremiumVmCount"; + public const string LabVmCount = "LabVmCount"; + public const string LabPremiumVmCount = "LabPremiumVmCount"; + public const string LabVmSize = "LabVmSize"; + public const string GalleryImage = "GalleryImage"; + public const string UserOwnedLabVmCountInSubnet = "UserOwnedLabVmCountInSubnet"; + public const string LabTargetCost = "LabTargetCost"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFragment.cs new file mode 100644 index 000000000000..61558eda2e0c --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyFragment.cs @@ -0,0 +1,143 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A Policy. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class PolicyFragment : Resource + { + /// + /// Initializes a new instance of the PolicyFragment class. + /// + public PolicyFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyFragment 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 description of the policy. + /// + + /// The status of the policy. + /// Possible values include: 'Enabled', 'Disabled' + + /// The fact name of the policy (e.g. LabVmCount, LabVmSize, + /// MaxVmsAllowedPerLab, etc. + /// Possible values include: 'UserOwnedLabVmCount', + /// 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', + /// 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' + + /// The fact data of the policy. + /// + + /// The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON + /// array of values for AllowedValuesPolicy). + /// + + /// The evaluator type of the policy (i.e. AllowedValuesPolicy, + /// MaxValuePolicy). + /// Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public PolicyFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string description = default(string), string status = default(string), string factName = default(string), string factData = default(string), string threshold = default(string), string evaluatorType = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.Description = description; + this.Status = status; + this.FactName = factName; + this.FactData = factData; + this.Threshold = threshold; + this.EvaluatorType = evaluatorType; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the description of the policy. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } + + /// + /// Gets or sets the status of the policy. Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; set; } + + /// + /// Gets or sets the fact name of the policy (e.g. LabVmCount, LabVmSize, + /// MaxVmsAllowedPerLab, etc. Possible values include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.factName")] + public string FactName {get; set; } + + /// + /// Gets or sets the fact data of the policy. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.factData")] + public string FactData {get; set; } + + /// + /// Gets or sets the threshold of the policy (i.e. a number for MaxValuePolicy, + /// and a JSON array of values for AllowedValuesPolicy). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.threshold")] + public string Threshold {get; set; } + + /// + /// Gets or sets the evaluator type of the policy (i.e. AllowedValuesPolicy, + /// MaxValuePolicy). Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.evaluatorType")] + public string EvaluatorType {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyProperties.cs new file mode 100644 index 000000000000..428b3a6ce689 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyProperties.cs @@ -0,0 +1,136 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a Policy. + /// + public partial class PolicyProperties + { + /// + /// Initializes a new instance of the PolicyProperties class. + /// + public PolicyProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyProperties class. + /// + + /// The description of the policy. + /// + + /// The status of the policy. + /// Possible values include: 'Enabled', 'Disabled' + + /// The fact name of the policy (e.g. LabVmCount, LabVmSize, + /// MaxVmsAllowedPerLab, etc. + /// Possible values include: 'UserOwnedLabVmCount', + /// 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', + /// 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' + + /// The fact data of the policy. + /// + + /// The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON + /// array of values for AllowedValuesPolicy). + /// + + /// The evaluator type of the policy (i.e. AllowedValuesPolicy, + /// MaxValuePolicy). + /// Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' + + /// The creation date of the policy. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public PolicyProperties(string description = default(string), string status = default(string), string factName = default(string), string factData = default(string), string threshold = default(string), string evaluatorType = default(string), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Description = description; + this.Status = status; + this.FactName = factName; + this.FactData = factData; + this.Threshold = threshold; + this.EvaluatorType = evaluatorType; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the description of the policy. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the status of the policy. Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets the fact name of the policy (e.g. LabVmCount, LabVmSize, + /// MaxVmsAllowedPerLab, etc. Possible values include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "factName")] + public string FactName {get; set; } + + /// + /// Gets or sets the fact data of the policy. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "factData")] + public string FactData {get; set; } + + /// + /// Gets or sets the threshold of the policy (i.e. a number for MaxValuePolicy, + /// and a JSON array of values for AllowedValuesPolicy). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "threshold")] + public string Threshold {get; set; } + + /// + /// Gets or sets the evaluator type of the policy (i.e. AllowedValuesPolicy, + /// MaxValuePolicy). Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "evaluatorType")] + public string EvaluatorType {get; set; } + + /// + /// Gets the creation date of the policy. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyPropertiesFragment.cs new file mode 100644 index 000000000000..e5c3d7e2c685 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyPropertiesFragment.cs @@ -0,0 +1,126 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a Policy. + /// + public partial class PolicyPropertiesFragment + { + /// + /// Initializes a new instance of the PolicyPropertiesFragment class. + /// + public PolicyPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyPropertiesFragment class. + /// + + /// The description of the policy. + /// + + /// The status of the policy. + /// Possible values include: 'Enabled', 'Disabled' + + /// The fact name of the policy (e.g. LabVmCount, LabVmSize, + /// MaxVmsAllowedPerLab, etc. + /// Possible values include: 'UserOwnedLabVmCount', + /// 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', + /// 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' + + /// The fact data of the policy. + /// + + /// The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON + /// array of values for AllowedValuesPolicy). + /// + + /// The evaluator type of the policy (i.e. AllowedValuesPolicy, + /// MaxValuePolicy). + /// Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public PolicyPropertiesFragment(string description = default(string), string status = default(string), string factName = default(string), string factData = default(string), string threshold = default(string), string evaluatorType = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Description = description; + this.Status = status; + this.FactName = factName; + this.FactData = factData; + this.Threshold = threshold; + this.EvaluatorType = evaluatorType; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the description of the policy. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the status of the policy. Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets the fact name of the policy (e.g. LabVmCount, LabVmSize, + /// MaxVmsAllowedPerLab, etc. Possible values include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "factName")] + public string FactName {get; set; } + + /// + /// Gets or sets the fact data of the policy. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "factData")] + public string FactData {get; set; } + + /// + /// Gets or sets the threshold of the policy (i.e. a number for MaxValuePolicy, + /// and a JSON array of values for AllowedValuesPolicy). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "threshold")] + public string Threshold {get; set; } + + /// + /// Gets or sets the evaluator type of the policy (i.e. AllowedValuesPolicy, + /// MaxValuePolicy). Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "evaluatorType")] + public string EvaluatorType {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicySetResult.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicySetResult.cs new file mode 100644 index 000000000000..8372cdc5ae24 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicySetResult.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Result of a policy set evaluation. + /// + public partial class PolicySetResult + { + /// + /// Initializes a new instance of the PolicySetResult class. + /// + public PolicySetResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicySetResult class. + /// + + /// A value indicating whether this policy set evaluation has discovered + /// violations. + /// + + /// The list of policy violations. + /// + public PolicySetResult(bool? hasError = default(bool?), System.Collections.Generic.IList policyViolations = default(System.Collections.Generic.IList)) + + { + this.HasError = hasError; + this.PolicyViolations = policyViolations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets a value indicating whether this policy set evaluation has + /// discovered violations. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "hasError")] + public bool? HasError {get; set; } + + /// + /// Gets or sets the list of policy violations. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "policyViolations")] + public System.Collections.Generic.IList PolicyViolations {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyStatus.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyStatus.cs new file mode 100644 index 000000000000..a11d6aa3cf93 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyStatus.cs @@ -0,0 +1,19 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for PolicyStatus. + /// + + + public static class PolicyStatus + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyViolation.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyViolation.cs new file mode 100644 index 000000000000..371b7a0e1442 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PolicyViolation.cs @@ -0,0 +1,58 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Policy violation. + /// + public partial class PolicyViolation + { + /// + /// Initializes a new instance of the PolicyViolation class. + /// + public PolicyViolation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyViolation class. + /// + + /// The code of the policy violation. + /// + + /// The message of the policy violation. + /// + public PolicyViolation(string code = default(string), string message = default(string)) + + { + this.Code = code; + this.Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the code of the policy violation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } + + /// + /// Gets or sets the message of the policy violation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Port.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Port.cs new file mode 100644 index 000000000000..c630eea6e2dc --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Port.cs @@ -0,0 +1,58 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a network port. + /// + public partial class Port + { + /// + /// Initializes a new instance of the Port class. + /// + public Port() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Port class. + /// + + /// Protocol type of the port. + /// Possible values include: 'Tcp', 'Udp' + + /// Backend port of the target virtual machine. + /// + public Port(string transportProtocol = default(string), int? backendPort = default(int?)) + + { + this.TransportProtocol = transportProtocol; + this.BackendPort = backendPort; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets protocol type of the port. Possible values include: 'Tcp', 'Udp' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "transportProtocol")] + public string TransportProtocol {get; set; } + + /// + /// Gets or sets backend port of the target virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "backendPort")] + public int? BackendPort {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PortFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PortFragment.cs new file mode 100644 index 000000000000..365e29c006b1 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PortFragment.cs @@ -0,0 +1,58 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a network port. + /// + public partial class PortFragment + { + /// + /// Initializes a new instance of the PortFragment class. + /// + public PortFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PortFragment class. + /// + + /// Protocol type of the port. + /// Possible values include: 'Tcp', 'Udp' + + /// Backend port of the target virtual machine. + /// + public PortFragment(string transportProtocol = default(string), int? backendPort = default(int?)) + + { + this.TransportProtocol = transportProtocol; + this.BackendPort = backendPort; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets protocol type of the port. Possible values include: 'Tcp', 'Udp' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "transportProtocol")] + public string TransportProtocol {get; set; } + + /// + /// Gets or sets backend port of the target virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "backendPort")] + public int? BackendPort {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PremiumDataDisk.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PremiumDataDisk.cs new file mode 100644 index 000000000000..92e300364695 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/PremiumDataDisk.cs @@ -0,0 +1,19 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for PremiumDataDisk. + /// + + + public static class PremiumDataDisk + { + public const string Disabled = "Disabled"; + public const string Enabled = "Enabled"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ReportingCycleType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ReportingCycleType.cs new file mode 100644 index 000000000000..03e0b6fb31df --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ReportingCycleType.cs @@ -0,0 +1,19 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for ReportingCycleType. + /// + + + public static class ReportingCycleType + { + public const string CalendarMonth = "CalendarMonth"; + public const string Custom = "Custom"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Resource.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Resource.cs new file mode 100644 index 000000000000..2319efe74553 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Resource.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// An Azure resource. + /// + public partial class Resource : Microsoft.Rest.Azure.IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// 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), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary)) + + { + this.Id = id; + this.Name = name; + this.Type = type; + this.Location = location; + this.Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the identifier of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; private set; } + + /// + /// Gets the name of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } + + /// + /// Gets the type of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } + + /// + /// Gets or sets the location of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; set; } + + /// + /// Gets or sets the tags of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RetargetScheduleProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RetargetScheduleProperties.cs new file mode 100644 index 000000000000..8fd8de30b827 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/RetargetScheduleProperties.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties for retargeting a virtual machine schedule. + /// + public partial class RetargetScheduleProperties + { + /// + /// Initializes a new instance of the RetargetScheduleProperties class. + /// + public RetargetScheduleProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RetargetScheduleProperties class. + /// + + /// The resource Id of the virtual machine on which the schedule operates + /// + + /// The resource Id of the virtual machine that the schedule should be + /// retargeted to + /// + public RetargetScheduleProperties(string currentResourceId = default(string), string targetResourceId = default(string)) + + { + this.CurrentResourceId = currentResourceId; + this.TargetResourceId = targetResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the resource Id of the virtual machine on which the schedule + /// operates + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "currentResourceId")] + public string CurrentResourceId {get; set; } + + /// + /// Gets or sets the resource Id of the virtual machine that the schedule + /// should be retargeted to + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetResourceId")] + public string TargetResourceId {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Schedule.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Schedule.cs new file mode 100644 index 000000000000..5519392b30f0 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Schedule.cs @@ -0,0 +1,172 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A schedule. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Schedule : Resource + { + /// + /// Initializes a new instance of the Schedule class. + /// + public Schedule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Schedule 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. + /// + + /// Notification settings. + /// + + /// The status of the schedule (i.e. Enabled, Disabled) + /// Possible values include: 'Enabled', 'Disabled' + + /// The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + /// + + /// If the schedule will occur only some days of the week, specify the weekly + /// recurrence. + /// + + /// If the schedule will occur once each day of the week, specify the daily + /// recurrence. + /// + + /// If the schedule will occur multiple times a day, specify the hourly + /// recurrence. + /// + + /// The time zone ID (e.g. Pacific Standard time). + /// + + /// The creation date of the schedule. + /// + + /// The resource ID to which the schedule belongs + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public Schedule(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), NotificationSettings notificationSettings = default(NotificationSettings), string status = default(string), string taskType = default(string), WeekDetails weeklyRecurrence = default(WeekDetails), DayDetails dailyRecurrence = default(DayDetails), HourDetails hourlyRecurrence = default(HourDetails), string timeZoneId = default(string), System.DateTime? createdDate = default(System.DateTime?), string targetResourceId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.NotificationSettings = notificationSettings; + this.Status = status; + this.TaskType = taskType; + this.WeeklyRecurrence = weeklyRecurrence; + this.DailyRecurrence = dailyRecurrence; + this.HourlyRecurrence = hourlyRecurrence; + this.TimeZoneId = timeZoneId; + this.CreatedDate = createdDate; + this.TargetResourceId = targetResourceId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets notification settings. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.notificationSettings")] + public NotificationSettings NotificationSettings {get; set; } + + /// + /// Gets or sets the status of the schedule (i.e. Enabled, Disabled) Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; set; } + + /// + /// Gets or sets the task type of the schedule (e.g. LabVmsShutdownTask, + /// LabVmAutoStart). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.taskType")] + public string TaskType {get; set; } + + /// + /// Gets or sets if the schedule will occur only some days of the week, specify + /// the weekly recurrence. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.weeklyRecurrence")] + public WeekDetails WeeklyRecurrence {get; set; } + + /// + /// Gets or sets if the schedule will occur once each day of the week, specify + /// the daily recurrence. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.dailyRecurrence")] + public DayDetails DailyRecurrence {get; set; } + + /// + /// Gets or sets if the schedule will occur multiple times a day, specify the + /// hourly recurrence. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.hourlyRecurrence")] + public HourDetails HourlyRecurrence {get; set; } + + /// + /// Gets or sets the time zone ID (e.g. Pacific Standard time). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.timeZoneId")] + public string TimeZoneId {get; set; } + + /// + /// Gets the creation date of the schedule. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the resource ID to which the schedule belongs + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.targetResourceId")] + public string TargetResourceId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleFragment.cs new file mode 100644 index 000000000000..27f0f9fc9723 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleFragment.cs @@ -0,0 +1,162 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A schedule. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class ScheduleFragment : Resource + { + /// + /// Initializes a new instance of the ScheduleFragment class. + /// + public ScheduleFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScheduleFragment 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 status of the schedule (i.e. Enabled, Disabled) + /// Possible values include: 'Enabled', 'Disabled' + + /// The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + /// + + /// If the schedule will occur only some days of the week, specify the weekly + /// recurrence. + /// + + /// If the schedule will occur once each day of the week, specify the daily + /// recurrence. + /// + + /// If the schedule will occur multiple times a day, specify the hourly + /// recurrence. + /// + + /// The time zone ID (e.g. Pacific Standard time). + /// + + /// Notification settings. + /// + + /// The resource ID to which the schedule belongs + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public ScheduleFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string status = default(string), string taskType = default(string), WeekDetailsFragment weeklyRecurrence = default(WeekDetailsFragment), DayDetailsFragment dailyRecurrence = default(DayDetailsFragment), HourDetailsFragment hourlyRecurrence = default(HourDetailsFragment), string timeZoneId = default(string), NotificationSettingsFragment notificationSettings = default(NotificationSettingsFragment), string targetResourceId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.Status = status; + this.TaskType = taskType; + this.WeeklyRecurrence = weeklyRecurrence; + this.DailyRecurrence = dailyRecurrence; + this.HourlyRecurrence = hourlyRecurrence; + this.TimeZoneId = timeZoneId; + this.NotificationSettings = notificationSettings; + this.TargetResourceId = targetResourceId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the status of the schedule (i.e. Enabled, Disabled) Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; set; } + + /// + /// Gets or sets the task type of the schedule (e.g. LabVmsShutdownTask, + /// LabVmAutoStart). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.taskType")] + public string TaskType {get; set; } + + /// + /// Gets or sets if the schedule will occur only some days of the week, specify + /// the weekly recurrence. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.weeklyRecurrence")] + public WeekDetailsFragment WeeklyRecurrence {get; set; } + + /// + /// Gets or sets if the schedule will occur once each day of the week, specify + /// the daily recurrence. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.dailyRecurrence")] + public DayDetailsFragment DailyRecurrence {get; set; } + + /// + /// Gets or sets if the schedule will occur multiple times a day, specify the + /// hourly recurrence. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.hourlyRecurrence")] + public HourDetailsFragment HourlyRecurrence {get; set; } + + /// + /// Gets or sets the time zone ID (e.g. Pacific Standard time). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.timeZoneId")] + public string TimeZoneId {get; set; } + + /// + /// Gets or sets notification settings. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.notificationSettings")] + public NotificationSettingsFragment NotificationSettings {get; set; } + + /// + /// Gets or sets the resource ID to which the schedule belongs + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.targetResourceId")] + public string TargetResourceId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleProperties.cs new file mode 100644 index 000000000000..e2eb2a1760c0 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ScheduleProperties.cs @@ -0,0 +1,155 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a schedule. + /// + public partial class ScheduleProperties + { + /// + /// Initializes a new instance of the ScheduleProperties class. + /// + public ScheduleProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScheduleProperties class. + /// + + /// The status of the schedule (i.e. Enabled, Disabled) + /// Possible values include: 'Enabled', 'Disabled' + + /// The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + /// + + /// If the schedule will occur only some days of the week, specify the weekly + /// recurrence. + /// + + /// If the schedule will occur once each day of the week, specify the daily + /// recurrence. + /// + + /// If the schedule will occur multiple times a day, specify the hourly + /// recurrence. + /// + + /// The time zone ID (e.g. Pacific Standard time). + /// + + /// Notification settings. + /// + + /// The creation date of the schedule. + /// + + /// The resource ID to which the schedule belongs + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public ScheduleProperties(string status = default(string), string taskType = default(string), WeekDetails weeklyRecurrence = default(WeekDetails), DayDetails dailyRecurrence = default(DayDetails), HourDetails hourlyRecurrence = default(HourDetails), string timeZoneId = default(string), NotificationSettings notificationSettings = default(NotificationSettings), System.DateTime? createdDate = default(System.DateTime?), string targetResourceId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Status = status; + this.TaskType = taskType; + this.WeeklyRecurrence = weeklyRecurrence; + this.DailyRecurrence = dailyRecurrence; + this.HourlyRecurrence = hourlyRecurrence; + this.TimeZoneId = timeZoneId; + this.NotificationSettings = notificationSettings; + this.CreatedDate = createdDate; + this.TargetResourceId = targetResourceId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the status of the schedule (i.e. Enabled, Disabled) Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets the task type of the schedule (e.g. LabVmsShutdownTask, + /// LabVmAutoStart). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "taskType")] + public string TaskType {get; set; } + + /// + /// Gets or sets if the schedule will occur only some days of the week, specify + /// the weekly recurrence. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "weeklyRecurrence")] + public WeekDetails WeeklyRecurrence {get; set; } + + /// + /// Gets or sets if the schedule will occur once each day of the week, specify + /// the daily recurrence. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dailyRecurrence")] + public DayDetails DailyRecurrence {get; set; } + + /// + /// Gets or sets if the schedule will occur multiple times a day, specify the + /// hourly recurrence. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "hourlyRecurrence")] + public HourDetails HourlyRecurrence {get; set; } + + /// + /// Gets or sets the time zone ID (e.g. Pacific Standard time). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "timeZoneId")] + public string TimeZoneId {get; set; } + + /// + /// Gets or sets notification settings. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "notificationSettings")] + public NotificationSettings NotificationSettings {get; set; } + + /// + /// Gets the creation date of the schedule. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the resource ID to which the schedule belongs + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetResourceId")] + public string TargetResourceId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SchedulePropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SchedulePropertiesFragment.cs new file mode 100644 index 000000000000..3fa59447b223 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SchedulePropertiesFragment.cs @@ -0,0 +1,145 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a schedule. + /// + public partial class SchedulePropertiesFragment + { + /// + /// Initializes a new instance of the SchedulePropertiesFragment class. + /// + public SchedulePropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SchedulePropertiesFragment class. + /// + + /// The status of the schedule (i.e. Enabled, Disabled) + /// Possible values include: 'Enabled', 'Disabled' + + /// The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + /// + + /// If the schedule will occur only some days of the week, specify the weekly + /// recurrence. + /// + + /// If the schedule will occur once each day of the week, specify the daily + /// recurrence. + /// + + /// If the schedule will occur multiple times a day, specify the hourly + /// recurrence. + /// + + /// The time zone ID (e.g. Pacific Standard time). + /// + + /// Notification settings. + /// + + /// The resource ID to which the schedule belongs + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public SchedulePropertiesFragment(string status = default(string), string taskType = default(string), WeekDetailsFragment weeklyRecurrence = default(WeekDetailsFragment), DayDetailsFragment dailyRecurrence = default(DayDetailsFragment), HourDetailsFragment hourlyRecurrence = default(HourDetailsFragment), string timeZoneId = default(string), NotificationSettingsFragment notificationSettings = default(NotificationSettingsFragment), string targetResourceId = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Status = status; + this.TaskType = taskType; + this.WeeklyRecurrence = weeklyRecurrence; + this.DailyRecurrence = dailyRecurrence; + this.HourlyRecurrence = hourlyRecurrence; + this.TimeZoneId = timeZoneId; + this.NotificationSettings = notificationSettings; + this.TargetResourceId = targetResourceId; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the status of the schedule (i.e. Enabled, Disabled) Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets the task type of the schedule (e.g. LabVmsShutdownTask, + /// LabVmAutoStart). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "taskType")] + public string TaskType {get; set; } + + /// + /// Gets or sets if the schedule will occur only some days of the week, specify + /// the weekly recurrence. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "weeklyRecurrence")] + public WeekDetailsFragment WeeklyRecurrence {get; set; } + + /// + /// Gets or sets if the schedule will occur once each day of the week, specify + /// the daily recurrence. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dailyRecurrence")] + public DayDetailsFragment DailyRecurrence {get; set; } + + /// + /// Gets or sets if the schedule will occur multiple times a day, specify the + /// hourly recurrence. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "hourlyRecurrence")] + public HourDetailsFragment HourlyRecurrence {get; set; } + + /// + /// Gets or sets the time zone ID (e.g. Pacific Standard time). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "timeZoneId")] + public string TimeZoneId {get; set; } + + /// + /// Gets or sets notification settings. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "notificationSettings")] + public NotificationSettingsFragment NotificationSettings {get; set; } + + /// + /// Gets or sets the resource ID to which the schedule belongs + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetResourceId")] + public string TargetResourceId {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Secret.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Secret.cs new file mode 100644 index 000000000000..bc6f6d6a38fa --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Secret.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A secret. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Secret : Resource + { + /// + /// Initializes a new instance of the Secret class. + /// + public Secret() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Secret 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 value of the secret for secret creation. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public Secret(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string value = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.Value = value; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the value of the secret for secret creation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.value")] + public string Value {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SecretProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SecretProperties.cs new file mode 100644 index 000000000000..426c3e8cd196 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SecretProperties.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a secret. + /// + public partial class SecretProperties + { + /// + /// Initializes a new instance of the SecretProperties class. + /// + public SecretProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecretProperties class. + /// + + /// The value of the secret for secret creation. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public SecretProperties(string value = default(string), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Value = value; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the value of the secret for secret creation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceRunner.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceRunner.cs new file mode 100644 index 000000000000..087fbdb8338c --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ServiceRunner.cs @@ -0,0 +1,64 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A container for a managed identity to execute DevTest lab services. + /// + public partial class ServiceRunner : Resource + { + /// + /// Initializes a new instance of the ServiceRunner class. + /// + public ServiceRunner() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceRunner 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 identity of the resource. + /// + public ServiceRunner(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), IdentityProperties identity = default(IdentityProperties)) + + : base(id, name, type, location, tags) + { + this.Identity = identity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the identity of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "identity")] + public IdentityProperties Identity {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfiguration.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfiguration.cs new file mode 100644 index 000000000000..faf28f9e33c7 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfiguration.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a virtual machine that determine how it is connected to a + /// load balancer. + /// + public partial class SharedPublicIpAddressConfiguration + { + /// + /// Initializes a new instance of the SharedPublicIpAddressConfiguration class. + /// + public SharedPublicIpAddressConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharedPublicIpAddressConfiguration class. + /// + + /// The incoming NAT rules + /// + public SharedPublicIpAddressConfiguration(System.Collections.Generic.IList inboundNatRules = default(System.Collections.Generic.IList)) + + { + this.InboundNatRules = inboundNatRules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the incoming NAT rules + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "inboundNatRules")] + public System.Collections.Generic.IList InboundNatRules {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfigurationFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfigurationFragment.cs new file mode 100644 index 000000000000..d3291b2e23a2 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SharedPublicIpAddressConfigurationFragment.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a virtual machine that determine how it is connected to a + /// load balancer. + /// + public partial class SharedPublicIpAddressConfigurationFragment + { + /// + /// Initializes a new instance of the SharedPublicIpAddressConfigurationFragment class. + /// + public SharedPublicIpAddressConfigurationFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharedPublicIpAddressConfigurationFragment class. + /// + + /// The incoming NAT rules + /// + public SharedPublicIpAddressConfigurationFragment(System.Collections.Generic.IList inboundNatRules = default(System.Collections.Generic.IList)) + + { + this.InboundNatRules = inboundNatRules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the incoming NAT rules + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "inboundNatRules")] + public System.Collections.Generic.IList InboundNatRules {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ShutdownNotificationContent.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ShutdownNotificationContent.cs new file mode 100644 index 000000000000..2a84f6ecffa6 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/ShutdownNotificationContent.cs @@ -0,0 +1,150 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// The contents of a shutdown notification. Webhooks can use this type to + /// deserialize the request body when they get notified of an imminent + /// shutdown. + /// + public partial class ShutdownNotificationContent + { + /// + /// Initializes a new instance of the ShutdownNotificationContent class. + /// + public ShutdownNotificationContent() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ShutdownNotificationContent class. + /// + + /// The URL to skip auto-shutdown. + /// + + /// The URL to delay shutdown by 60 minutes. + /// + + /// The URL to delay shutdown by 2 hours. + /// + + /// The virtual machine to be shut down. + /// + + /// The GUID for the virtual machine to be shut down. + /// + + /// The owner of the virtual machine. + /// + + /// The event for which a notification will be sent. + /// + + /// The text for the notification. + /// + + /// The subscription ID for the schedule. + /// + + /// The resource group name for the schedule. + /// + + /// The lab for the schedule. + /// + public ShutdownNotificationContent(string skipUrl = default(string), string delayUrl60 = default(string), string delayUrl120 = default(string), string vmName = default(string), string guid = default(string), string owner = default(string), string eventType = default(string), string text = default(string), string subscriptionId = default(string), string resourceGroupName = default(string), string labName = default(string)) + + { + this.SkipUrl = skipUrl; + this.DelayUrl60 = delayUrl60; + this.DelayUrl120 = delayUrl120; + this.VMName = vmName; + this.Guid = guid; + this.Owner = owner; + this.EventType = eventType; + this.Text = text; + this.SubscriptionId = subscriptionId; + this.ResourceGroupName = resourceGroupName; + this.LabName = labName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the URL to skip auto-shutdown. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "skipUrl")] + public string SkipUrl {get; set; } + + /// + /// Gets or sets the URL to delay shutdown by 60 minutes. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "delayUrl60")] + public string DelayUrl60 {get; set; } + + /// + /// Gets or sets the URL to delay shutdown by 2 hours. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "delayUrl120")] + public string DelayUrl120 {get; set; } + + /// + /// Gets or sets the virtual machine to be shut down. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "vmName")] + public string VMName {get; set; } + + /// + /// Gets or sets the GUID for the virtual machine to be shut down. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "guid")] + public string Guid {get; set; } + + /// + /// Gets or sets the owner of the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "owner")] + public string Owner {get; set; } + + /// + /// Gets or sets the event for which a notification will be sent. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "eventType")] + public string EventType {get; set; } + + /// + /// Gets or sets the text for the notification. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "text")] + public string Text {get; set; } + + /// + /// Gets or sets the subscription ID for the schedule. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId {get; set; } + + /// + /// Gets or sets the resource group name for the schedule. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceGroupName")] + public string ResourceGroupName {get; set; } + + /// + /// Gets or sets the lab for the schedule. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labName")] + public string LabName {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SourceControlType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SourceControlType.cs new file mode 100644 index 000000000000..6326b6a79b1d --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SourceControlType.cs @@ -0,0 +1,19 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for SourceControlType. + /// + + + public static class SourceControlType + { + public const string VsoGit = "VsoGit"; + public const string GitHub = "GitHub"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/StorageType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/StorageType.cs new file mode 100644 index 000000000000..52852464f326 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/StorageType.cs @@ -0,0 +1,19 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for StorageType. + /// + + + public static class StorageType + { + public const string Standard = "Standard"; + public const string Premium = "Premium"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Subnet.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Subnet.cs new file mode 100644 index 000000000000..b8a453af0da5 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/Subnet.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Subnet information. + /// + public partial class Subnet + { + /// + /// Initializes a new instance of the Subnet class. + /// + public Subnet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Subnet class. + /// + + /// The resource ID of the subnet. + /// + + /// The name of the subnet as seen in the lab. + /// + + /// The permission policy of the subnet for allowing public IP addresses (i.e. + /// Allow, Deny)). + /// Possible values include: 'Default', 'Deny', 'Allow' + public Subnet(string resourceId = default(string), string labSubnetName = default(string), string allowPublicIP = default(string)) + + { + this.ResourceId = resourceId; + this.LabSubnetName = labSubnetName; + this.AllowPublicIP = allowPublicIP; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the resource ID of the subnet. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceId")] + public string ResourceId {get; set; } + + /// + /// Gets or sets the name of the subnet as seen in the lab. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labSubnetName")] + public string LabSubnetName {get; set; } + + /// + /// Gets or sets the permission policy of the subnet for allowing public IP + /// addresses (i.e. Allow, Deny)). Possible values include: 'Default', 'Deny', 'Allow' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowPublicIp")] + public string AllowPublicIP {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetFragment.cs new file mode 100644 index 000000000000..3016eccf28c6 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetFragment.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Subnet information. + /// + public partial class SubnetFragment + { + /// + /// Initializes a new instance of the SubnetFragment class. + /// + public SubnetFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubnetFragment class. + /// + + /// The resource ID of the subnet. + /// + + /// The name of the subnet as seen in the lab. + /// + + /// The permission policy of the subnet for allowing public IP addresses (i.e. + /// Allow, Deny)). + /// Possible values include: 'Default', 'Deny', 'Allow' + public SubnetFragment(string resourceId = default(string), string labSubnetName = default(string), string allowPublicIP = default(string)) + + { + this.ResourceId = resourceId; + this.LabSubnetName = labSubnetName; + this.AllowPublicIP = allowPublicIP; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the resource ID of the subnet. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceId")] + public string ResourceId {get; set; } + + /// + /// Gets or sets the name of the subnet as seen in the lab. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labSubnetName")] + public string LabSubnetName {get; set; } + + /// + /// Gets or sets the permission policy of the subnet for allowing public IP + /// addresses (i.e. Allow, Deny)). Possible values include: 'Default', 'Deny', 'Allow' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowPublicIp")] + public string AllowPublicIP {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverride.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverride.cs new file mode 100644 index 000000000000..d24869e8cfaf --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverride.cs @@ -0,0 +1,102 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Property overrides on a subnet of a virtual network. + /// + public partial class SubnetOverride + { + /// + /// Initializes a new instance of the SubnetOverride class. + /// + public SubnetOverride() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubnetOverride class. + /// + + /// The resource ID of the subnet. + /// + + /// The name given to the subnet within the lab. + /// + + /// Indicates whether this subnet can be used during virtual machine creation + /// (i.e. Allow, Deny). + /// Possible values include: 'Default', 'Deny', 'Allow' + + /// Indicates whether public IP addresses can be assigned to virtual machines + /// on this subnet (i.e. Allow, Deny). + /// Possible values include: 'Default', 'Deny', 'Allow' + + /// Properties that virtual machines on this subnet will share. + /// + + /// The virtual network pool associated with this subnet. + /// + public SubnetOverride(string resourceId = default(string), string labSubnetName = default(string), string useInVMCreationPermission = default(string), string usePublicIPAddressPermission = default(string), SubnetSharedPublicIpAddressConfiguration sharedPublicIPAddressConfiguration = default(SubnetSharedPublicIpAddressConfiguration), string virtualNetworkPoolName = default(string)) + + { + this.ResourceId = resourceId; + this.LabSubnetName = labSubnetName; + this.UseInVMCreationPermission = useInVMCreationPermission; + this.UsePublicIPAddressPermission = usePublicIPAddressPermission; + this.SharedPublicIPAddressConfiguration = sharedPublicIPAddressConfiguration; + this.VirtualNetworkPoolName = virtualNetworkPoolName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the resource ID of the subnet. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceId")] + public string ResourceId {get; set; } + + /// + /// Gets or sets the name given to the subnet within the lab. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labSubnetName")] + public string LabSubnetName {get; set; } + + /// + /// Gets or sets indicates whether this subnet can be used during virtual + /// machine creation (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', 'Allow' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "useInVmCreationPermission")] + public string UseInVMCreationPermission {get; set; } + + /// + /// Gets or sets indicates whether public IP addresses can be assigned to + /// virtual machines on this subnet (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', 'Allow' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "usePublicIpAddressPermission")] + public string UsePublicIPAddressPermission {get; set; } + + /// + /// Gets or sets properties that virtual machines on this subnet will share. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sharedPublicIpAddressConfiguration")] + public SubnetSharedPublicIpAddressConfiguration SharedPublicIPAddressConfiguration {get; set; } + + /// + /// Gets or sets the virtual network pool associated with this subnet. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "virtualNetworkPoolName")] + public string VirtualNetworkPoolName {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverrideFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverrideFragment.cs new file mode 100644 index 000000000000..1799f9ddd1ba --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetOverrideFragment.cs @@ -0,0 +1,102 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Property overrides on a subnet of a virtual network. + /// + public partial class SubnetOverrideFragment + { + /// + /// Initializes a new instance of the SubnetOverrideFragment class. + /// + public SubnetOverrideFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubnetOverrideFragment class. + /// + + /// The resource ID of the subnet. + /// + + /// The name given to the subnet within the lab. + /// + + /// Indicates whether this subnet can be used during virtual machine creation + /// (i.e. Allow, Deny). + /// Possible values include: 'Default', 'Deny', 'Allow' + + /// Indicates whether public IP addresses can be assigned to virtual machines + /// on this subnet (i.e. Allow, Deny). + /// Possible values include: 'Default', 'Deny', 'Allow' + + /// Properties that virtual machines on this subnet will share. + /// + + /// The virtual network pool associated with this subnet. + /// + public SubnetOverrideFragment(string resourceId = default(string), string labSubnetName = default(string), string useInVMCreationPermission = default(string), string usePublicIPAddressPermission = default(string), SubnetSharedPublicIpAddressConfigurationFragment sharedPublicIPAddressConfiguration = default(SubnetSharedPublicIpAddressConfigurationFragment), string virtualNetworkPoolName = default(string)) + + { + this.ResourceId = resourceId; + this.LabSubnetName = labSubnetName; + this.UseInVMCreationPermission = useInVMCreationPermission; + this.UsePublicIPAddressPermission = usePublicIPAddressPermission; + this.SharedPublicIPAddressConfiguration = sharedPublicIPAddressConfiguration; + this.VirtualNetworkPoolName = virtualNetworkPoolName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the resource ID of the subnet. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceId")] + public string ResourceId {get; set; } + + /// + /// Gets or sets the name given to the subnet within the lab. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labSubnetName")] + public string LabSubnetName {get; set; } + + /// + /// Gets or sets indicates whether this subnet can be used during virtual + /// machine creation (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', 'Allow' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "useInVmCreationPermission")] + public string UseInVMCreationPermission {get; set; } + + /// + /// Gets or sets indicates whether public IP addresses can be assigned to + /// virtual machines on this subnet (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', 'Allow' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "usePublicIpAddressPermission")] + public string UsePublicIPAddressPermission {get; set; } + + /// + /// Gets or sets properties that virtual machines on this subnet will share. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sharedPublicIpAddressConfiguration")] + public SubnetSharedPublicIpAddressConfigurationFragment SharedPublicIPAddressConfiguration {get; set; } + + /// + /// Gets or sets the virtual network pool associated with this subnet. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "virtualNetworkPoolName")] + public string VirtualNetworkPoolName {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfiguration.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfiguration.cs new file mode 100644 index 000000000000..8d697cd39740 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfiguration.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Configuration for public IP address sharing. + /// + public partial class SubnetSharedPublicIpAddressConfiguration + { + /// + /// Initializes a new instance of the SubnetSharedPublicIpAddressConfiguration class. + /// + public SubnetSharedPublicIpAddressConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubnetSharedPublicIpAddressConfiguration class. + /// + + /// Backend ports that virtual machines on this subnet are allowed to expose + /// + public SubnetSharedPublicIpAddressConfiguration(System.Collections.Generic.IList allowedPorts = default(System.Collections.Generic.IList)) + + { + this.AllowedPorts = allowedPorts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets backend ports that virtual machines on this subnet are allowed + /// to expose + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowedPorts")] + public System.Collections.Generic.IList AllowedPorts {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfigurationFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfigurationFragment.cs new file mode 100644 index 000000000000..58c484bc2ee3 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/SubnetSharedPublicIpAddressConfigurationFragment.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Configuration for public IP address sharing. + /// + public partial class SubnetSharedPublicIpAddressConfigurationFragment + { + /// + /// Initializes a new instance of the SubnetSharedPublicIpAddressConfigurationFragment class. + /// + public SubnetSharedPublicIpAddressConfigurationFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubnetSharedPublicIpAddressConfigurationFragment class. + /// + + /// Backend ports that virtual machines on this subnet are allowed to expose + /// + public SubnetSharedPublicIpAddressConfigurationFragment(System.Collections.Generic.IList allowedPorts = default(System.Collections.Generic.IList)) + + { + this.AllowedPorts = allowedPorts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets backend ports that virtual machines on this subnet are allowed + /// to expose + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowedPorts")] + public System.Collections.Generic.IList AllowedPorts {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostProperties.cs new file mode 100644 index 000000000000..8585ef488981 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostProperties.cs @@ -0,0 +1,98 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a cost target. + /// + public partial class TargetCostProperties + { + /// + /// Initializes a new instance of the TargetCostProperties class. + /// + public TargetCostProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TargetCostProperties class. + /// + + /// Target cost status + /// Possible values include: 'Enabled', 'Disabled' + + /// Lab target cost + /// + + /// Cost thresholds. + /// + + /// Reporting cycle start date. + /// + + /// Reporting cycle end date. + /// + + /// Reporting cycle type. + /// Possible values include: 'CalendarMonth', 'Custom' + public TargetCostProperties(string status = default(string), int? target = default(int?), System.Collections.Generic.IList costThresholds = default(System.Collections.Generic.IList), System.DateTime? cycleStartDateTime = default(System.DateTime?), System.DateTime? cycleEndDateTime = default(System.DateTime?), string cycleType = default(string)) + + { + this.Status = status; + this.Target = target; + this.CostThresholds = costThresholds; + this.CycleStartDateTime = cycleStartDateTime; + this.CycleEndDateTime = cycleEndDateTime; + this.CycleType = cycleType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets target cost status Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets lab target cost + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "target")] + public int? Target {get; set; } + + /// + /// Gets or sets cost thresholds. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "costThresholds")] + public System.Collections.Generic.IList CostThresholds {get; set; } + + /// + /// Gets or sets reporting cycle start date. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "cycleStartDateTime")] + public System.DateTime? CycleStartDateTime {get; set; } + + /// + /// Gets or sets reporting cycle end date. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "cycleEndDateTime")] + public System.DateTime? CycleEndDateTime {get; set; } + + /// + /// Gets or sets reporting cycle type. Possible values include: 'CalendarMonth', 'Custom' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "cycleType")] + public string CycleType {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostStatus.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostStatus.cs new file mode 100644 index 000000000000..922c1481e423 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TargetCostStatus.cs @@ -0,0 +1,19 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for TargetCostStatus. + /// + + + public static class TargetCostStatus + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TransportProtocol.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TransportProtocol.cs new file mode 100644 index 000000000000..0974b2aab3e6 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/TransportProtocol.cs @@ -0,0 +1,19 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for TransportProtocol. + /// + + + public static class TransportProtocol + { + public const string Tcp = "Tcp"; + public const string Udp = "Udp"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UsagePermissionType.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UsagePermissionType.cs new file mode 100644 index 000000000000..29a2c9d2c1d2 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UsagePermissionType.cs @@ -0,0 +1,20 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for UsagePermissionType. + /// + + + public static class UsagePermissionType + { + public const string Default = "Default"; + public const string Deny = "Deny"; + public const string Allow = "Allow"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/User.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/User.cs new file mode 100644 index 000000000000..bd36e740e425 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/User.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Profile of a lab user. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class User : Resource + { + /// + /// Initializes a new instance of the User class. + /// + public User() + { + CustomInit(); + } + + /// + /// 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 identity of the user. + /// + + /// The secret store of the user. + /// + + /// The creation date of the user profile. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public User(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), UserIdentity identity = default(UserIdentity), UserSecretStore secretStore = default(UserSecretStore), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.Identity = identity; + this.SecretStore = secretStore; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the identity of the user. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.identity")] + public UserIdentity Identity {get; set; } + + /// + /// Gets or sets the secret store of the user. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.secretStore")] + public UserSecretStore SecretStore {get; set; } + + /// + /// Gets the creation date of the user profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserFragment.cs new file mode 100644 index 000000000000..c3d7c2702de7 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserFragment.cs @@ -0,0 +1,95 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Profile of a lab user. + /// + [Microsoft.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 identity of the user. + /// + + /// The secret store of the user. + /// + + /// 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), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), UserIdentityFragment identity = default(UserIdentityFragment), UserSecretStoreFragment secretStore = default(UserSecretStoreFragment), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.Identity = identity; + this.SecretStore = secretStore; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the identity of the user. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.identity")] + public UserIdentityFragment Identity {get; set; } + + /// + /// Gets or sets the secret store of the user. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.secretStore")] + public UserSecretStoreFragment SecretStore {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentity.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentity.cs new file mode 100644 index 000000000000..a7515273362f --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentity.cs @@ -0,0 +1,95 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Identity attributes of a lab user. + /// + public partial class UserIdentity + { + /// + /// Initializes a new instance of the UserIdentity class. + /// + public UserIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserIdentity class. + /// + + /// Set to the principal name / UPN of the client JWT making the request. + /// + + /// Set to the principal Id of the client JWT making the request. Service + /// principal will not have the principal Id. + /// + + /// Set to the tenant ID of the client JWT making the request. + /// + + /// Set to the object Id of the client JWT making the request. Not all users + /// have object Id. For CSP (reseller) scenarios for example, object Id is not + /// available. + /// + + /// Set to the app Id of the client JWT making the request. + /// + public UserIdentity(string principalName = default(string), string principalId = default(string), string tenantId = default(string), string objectId = default(string), string appId = default(string)) + + { + this.PrincipalName = principalName; + this.PrincipalId = principalId; + this.TenantId = tenantId; + this.ObjectId = objectId; + this.AppId = appId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets set to the principal name / UPN of the client JWT making the + /// request. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "principalName")] + public string PrincipalName {get; set; } + + /// + /// Gets or sets set to the principal Id of the client JWT making the request. + /// Service principal will not have the principal Id. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "principalId")] + public string PrincipalId {get; set; } + + /// + /// Gets or sets set to the tenant ID of the client JWT making the request. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tenantId")] + public string TenantId {get; set; } + + /// + /// Gets or sets set to the object Id of the client JWT making the request. Not + /// all users have object Id. For CSP (reseller) scenarios for example, object + /// Id is not available. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "objectId")] + public string ObjectId {get; set; } + + /// + /// Gets or sets set to the app Id of the client JWT making the request. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "appId")] + public string AppId {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentityFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentityFragment.cs new file mode 100644 index 000000000000..360e39177e8c --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserIdentityFragment.cs @@ -0,0 +1,95 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Identity attributes of a lab user. + /// + public partial class UserIdentityFragment + { + /// + /// Initializes a new instance of the UserIdentityFragment class. + /// + public UserIdentityFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserIdentityFragment class. + /// + + /// Set to the principal name / UPN of the client JWT making the request. + /// + + /// Set to the principal Id of the client JWT making the request. Service + /// principal will not have the principal Id. + /// + + /// Set to the tenant ID of the client JWT making the request. + /// + + /// Set to the object Id of the client JWT making the request. Not all users + /// have object Id. For CSP (reseller) scenarios for example, object Id is not + /// available. + /// + + /// Set to the app Id of the client JWT making the request. + /// + public UserIdentityFragment(string principalName = default(string), string principalId = default(string), string tenantId = default(string), string objectId = default(string), string appId = default(string)) + + { + this.PrincipalName = principalName; + this.PrincipalId = principalId; + this.TenantId = tenantId; + this.ObjectId = objectId; + this.AppId = appId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets set to the principal name / UPN of the client JWT making the + /// request. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "principalName")] + public string PrincipalName {get; set; } + + /// + /// Gets or sets set to the principal Id of the client JWT making the request. + /// Service principal will not have the principal Id. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "principalId")] + public string PrincipalId {get; set; } + + /// + /// Gets or sets set to the tenant ID of the client JWT making the request. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tenantId")] + public string TenantId {get; set; } + + /// + /// Gets or sets set to the object Id of the client JWT making the request. Not + /// all users have object Id. For CSP (reseller) scenarios for example, object + /// Id is not available. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "objectId")] + public string ObjectId {get; set; } + + /// + /// Gets or sets set to the app Id of the client JWT making the request. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "appId")] + public string AppId {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserProperties.cs new file mode 100644 index 000000000000..cd593f581cf0 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserProperties.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a lab user profile. + /// + public partial class UserProperties + { + /// + /// Initializes a new instance of the UserProperties class. + /// + public UserProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserProperties class. + /// + + /// The identity of the user. + /// + + /// The secret store of the user. + /// + + /// The creation date of the user profile. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public UserProperties(UserIdentity identity = default(UserIdentity), UserSecretStore secretStore = default(UserSecretStore), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Identity = identity; + this.SecretStore = secretStore; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the identity of the user. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "identity")] + public UserIdentity Identity {get; set; } + + /// + /// Gets or sets the secret store of the user. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "secretStore")] + public UserSecretStore SecretStore {get; set; } + + /// + /// Gets the creation date of the user profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserPropertiesFragment.cs new file mode 100644 index 000000000000..a3d6821a5a51 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserPropertiesFragment.cs @@ -0,0 +1,78 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a lab user profile. + /// + public partial class UserPropertiesFragment + { + /// + /// Initializes a new instance of the UserPropertiesFragment class. + /// + public UserPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserPropertiesFragment class. + /// + + /// The identity of the user. + /// + + /// The secret store of the user. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public UserPropertiesFragment(UserIdentityFragment identity = default(UserIdentityFragment), UserSecretStoreFragment secretStore = default(UserSecretStoreFragment), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.Identity = identity; + this.SecretStore = secretStore; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the identity of the user. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "identity")] + public UserIdentityFragment Identity {get; set; } + + /// + /// Gets or sets the secret store of the user. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "secretStore")] + public UserSecretStoreFragment SecretStore {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStore.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStore.cs new file mode 100644 index 000000000000..b8a08876232b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStore.cs @@ -0,0 +1,58 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a user's secret store. + /// + public partial class UserSecretStore + { + /// + /// Initializes a new instance of the UserSecretStore class. + /// + public UserSecretStore() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserSecretStore class. + /// + + /// The URI of the user's Key vault. + /// + + /// The ID of the user's Key vault. + /// + public UserSecretStore(string keyVaultUri = default(string), string keyVaultId = default(string)) + + { + this.KeyVaultUri = keyVaultUri; + this.KeyVaultId = keyVaultId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the URI of the user's Key vault. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "keyVaultUri")] + public string KeyVaultUri {get; set; } + + /// + /// Gets or sets the ID of the user's Key vault. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "keyVaultId")] + public string KeyVaultId {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStoreFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStoreFragment.cs new file mode 100644 index 000000000000..b47a2fe79336 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/UserSecretStoreFragment.cs @@ -0,0 +1,58 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a user's secret store. + /// + public partial class UserSecretStoreFragment + { + /// + /// Initializes a new instance of the UserSecretStoreFragment class. + /// + public UserSecretStoreFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserSecretStoreFragment class. + /// + + /// The URI of the user's Key vault. + /// + + /// The ID of the user's Key vault. + /// + public UserSecretStoreFragment(string keyVaultUri = default(string), string keyVaultId = default(string)) + + { + this.KeyVaultUri = keyVaultUri; + this.KeyVaultId = keyVaultId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the URI of the user's Key vault. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "keyVaultUri")] + public string KeyVaultUri {get; set; } + + /// + /// Gets or sets the ID of the user's Key vault. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "keyVaultId")] + public string KeyVaultId {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualMachineCreationSource.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualMachineCreationSource.cs new file mode 100644 index 000000000000..3af568a510c5 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualMachineCreationSource.cs @@ -0,0 +1,19 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for VirtualMachineCreationSource. + /// + + + public static class VirtualMachineCreationSource + { + public const string FromCustomImage = "FromCustomImage"; + public const string FromGalleryImage = "FromGalleryImage"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetwork.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetwork.cs new file mode 100644 index 000000000000..f8dde6a443e5 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetwork.cs @@ -0,0 +1,136 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A virtual network. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class VirtualNetwork : Resource + { + /// + /// Initializes a new instance of the VirtualNetwork class. + /// + public VirtualNetwork() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualNetwork 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 allowed subnets of the virtual network. + /// + + /// The description of the virtual network. + /// + + /// The Microsoft.Network resource identifier of the virtual network. + /// + + /// The external subnet properties. + /// + + /// The subnet overrides of the virtual network. + /// + + /// The creation date of the virtual network. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public VirtualNetwork(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), System.Collections.Generic.IList allowedSubnets = default(System.Collections.Generic.IList), string description = default(string), string externalProviderResourceId = default(string), System.Collections.Generic.IList externalSubnets = default(System.Collections.Generic.IList), System.Collections.Generic.IList subnetOverrides = default(System.Collections.Generic.IList), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.AllowedSubnets = allowedSubnets; + this.Description = description; + this.ExternalProviderResourceId = externalProviderResourceId; + this.ExternalSubnets = externalSubnets; + this.SubnetOverrides = subnetOverrides; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the allowed subnets of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.allowedSubnets")] + public System.Collections.Generic.IList AllowedSubnets {get; set; } + + /// + /// Gets or sets the description of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } + + /// + /// Gets or sets the Microsoft.Network resource identifier of the virtual + /// network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.externalProviderResourceId")] + public string ExternalProviderResourceId {get; set; } + + /// + /// Gets or sets the external subnet properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.externalSubnets")] + public System.Collections.Generic.IList ExternalSubnets {get; set; } + + /// + /// Gets or sets the subnet overrides of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.subnetOverrides")] + public System.Collections.Generic.IList SubnetOverrides {get; set; } + + /// + /// Gets the creation date of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkFragment.cs new file mode 100644 index 000000000000..ae364e9d1ba2 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkFragment.cs @@ -0,0 +1,126 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// A virtual network. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class VirtualNetworkFragment : Resource + { + /// + /// Initializes a new instance of the VirtualNetworkFragment class. + /// + public VirtualNetworkFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualNetworkFragment 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 allowed subnets of the virtual network. + /// + + /// The description of the virtual network. + /// + + /// The Microsoft.Network resource identifier of the virtual network. + /// + + /// The external subnet properties. + /// + + /// The subnet overrides of the virtual network. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public VirtualNetworkFragment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), System.Collections.Generic.IList allowedSubnets = default(System.Collections.Generic.IList), string description = default(string), string externalProviderResourceId = default(string), System.Collections.Generic.IList externalSubnets = default(System.Collections.Generic.IList), System.Collections.Generic.IList subnetOverrides = default(System.Collections.Generic.IList), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + : base(id, name, type, location, tags) + { + this.AllowedSubnets = allowedSubnets; + this.Description = description; + this.ExternalProviderResourceId = externalProviderResourceId; + this.ExternalSubnets = externalSubnets; + this.SubnetOverrides = subnetOverrides; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the allowed subnets of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.allowedSubnets")] + public System.Collections.Generic.IList AllowedSubnets {get; set; } + + /// + /// Gets or sets the description of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; set; } + + /// + /// Gets or sets the Microsoft.Network resource identifier of the virtual + /// network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.externalProviderResourceId")] + public string ExternalProviderResourceId {get; set; } + + /// + /// Gets or sets the external subnet properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.externalSubnets")] + public System.Collections.Generic.IList ExternalSubnets {get; set; } + + /// + /// Gets or sets the subnet overrides of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.subnetOverrides")] + public System.Collections.Generic.IList SubnetOverrides {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkProperties.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkProperties.cs new file mode 100644 index 000000000000..19170159dc64 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkProperties.cs @@ -0,0 +1,119 @@ +// 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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a virtual network. + /// + public partial class VirtualNetworkProperties + { + /// + /// Initializes a new instance of the VirtualNetworkProperties class. + /// + public VirtualNetworkProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualNetworkProperties class. + /// + + /// The allowed subnets of the virtual network. + /// + + /// The description of the virtual network. + /// + + /// The Microsoft.Network resource identifier of the virtual network. + /// + + /// The external subnet properties. + /// + + /// The subnet overrides of the virtual network. + /// + + /// The creation date of the virtual network. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public VirtualNetworkProperties(System.Collections.Generic.IList allowedSubnets = default(System.Collections.Generic.IList), string description = default(string), string externalProviderResourceId = default(string), System.Collections.Generic.IList externalSubnets = default(System.Collections.Generic.IList), System.Collections.Generic.IList subnetOverrides = default(System.Collections.Generic.IList), System.DateTime? createdDate = default(System.DateTime?), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.AllowedSubnets = allowedSubnets; + this.Description = description; + this.ExternalProviderResourceId = externalProviderResourceId; + this.ExternalSubnets = externalSubnets; + this.SubnetOverrides = subnetOverrides; + this.CreatedDate = createdDate; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the allowed subnets of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowedSubnets")] + public System.Collections.Generic.IList AllowedSubnets {get; set; } + + /// + /// Gets or sets the description of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the Microsoft.Network resource identifier of the virtual + /// network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "externalProviderResourceId")] + public string ExternalProviderResourceId {get; set; } + + /// + /// Gets or sets the external subnet properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "externalSubnets")] + public System.Collections.Generic.IList ExternalSubnets {get; set; } + + /// + /// Gets or sets the subnet overrides of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subnetOverrides")] + public System.Collections.Generic.IList SubnetOverrides {get; set; } + + /// + /// Gets the creation date of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate {get; private set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkPropertiesFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkPropertiesFragment.cs new file mode 100644 index 000000000000..98a2e99a0291 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/VirtualNetworkPropertiesFragment.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a virtual network. + /// + public partial class VirtualNetworkPropertiesFragment + { + /// + /// Initializes a new instance of the VirtualNetworkPropertiesFragment class. + /// + public VirtualNetworkPropertiesFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualNetworkPropertiesFragment class. + /// + + /// The allowed subnets of the virtual network. + /// + + /// The description of the virtual network. + /// + + /// The Microsoft.Network resource identifier of the virtual network. + /// + + /// The external subnet properties. + /// + + /// The subnet overrides of the virtual network. + /// + + /// The provisioning status of the resource. + /// + + /// The unique immutable identifier of a resource (Guid). + /// + public VirtualNetworkPropertiesFragment(System.Collections.Generic.IList allowedSubnets = default(System.Collections.Generic.IList), string description = default(string), string externalProviderResourceId = default(string), System.Collections.Generic.IList externalSubnets = default(System.Collections.Generic.IList), System.Collections.Generic.IList subnetOverrides = default(System.Collections.Generic.IList), string provisioningState = default(string), string uniqueIdentifier = default(string)) + + { + this.AllowedSubnets = allowedSubnets; + this.Description = description; + this.ExternalProviderResourceId = externalProviderResourceId; + this.ExternalSubnets = externalSubnets; + this.SubnetOverrides = subnetOverrides; + this.ProvisioningState = provisioningState; + this.UniqueIdentifier = uniqueIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the allowed subnets of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowedSubnets")] + public System.Collections.Generic.IList AllowedSubnets {get; set; } + + /// + /// Gets or sets the description of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the Microsoft.Network resource identifier of the virtual + /// network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "externalProviderResourceId")] + public string ExternalProviderResourceId {get; set; } + + /// + /// Gets or sets the external subnet properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "externalSubnets")] + public System.Collections.Generic.IList ExternalSubnets {get; set; } + + /// + /// Gets or sets the subnet overrides of the virtual network. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subnetOverrides")] + public System.Collections.Generic.IList SubnetOverrides {get; set; } + + /// + /// Gets or sets the provisioning status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } + + /// + /// Gets or sets the unique immutable identifier of a resource (Guid). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uniqueIdentifier")] + public string UniqueIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetails.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetails.cs new file mode 100644 index 000000000000..3259956ca1b0 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetails.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a weekly schedule. + /// + public partial class WeekDetails + { + /// + /// Initializes a new instance of the WeekDetails class. + /// + public WeekDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WeekDetails class. + /// + + /// The days of the week for which the schedule is set (e.g. Sunday, Monday, + /// Tuesday, etc.). + /// + + /// The time of the day the schedule will occur. + /// + public WeekDetails(System.Collections.Generic.IList weekdays = default(System.Collections.Generic.IList), string time = default(string)) + + { + this.Weekdays = weekdays; + this.Time = time; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the days of the week for which the schedule is set (e.g. + /// Sunday, Monday, Tuesday, etc.). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "weekdays")] + public System.Collections.Generic.IList Weekdays {get; set; } + + /// + /// Gets or sets the time of the day the schedule will occur. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "time")] + public string Time {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetailsFragment.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetailsFragment.cs new file mode 100644 index 000000000000..ea53f93d4f0e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WeekDetailsFragment.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.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Properties of a weekly schedule. + /// + public partial class WeekDetailsFragment + { + /// + /// Initializes a new instance of the WeekDetailsFragment class. + /// + public WeekDetailsFragment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WeekDetailsFragment class. + /// + + /// The days of the week for which the schedule is set (e.g. Sunday, Monday, + /// Tuesday, etc.). + /// + + /// The time of the day the schedule will occur. + /// + public WeekDetailsFragment(System.Collections.Generic.IList weekdays = default(System.Collections.Generic.IList), string time = default(string)) + + { + this.Weekdays = weekdays; + this.Time = time; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the days of the week for which the schedule is set (e.g. + /// Sunday, Monday, Tuesday, etc.). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "weekdays")] + public System.Collections.Generic.IList Weekdays {get; set; } + + /// + /// Gets or sets the time of the day the schedule will occur. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "time")] + public string Time {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfo.cs new file mode 100644 index 000000000000..0efc7b403976 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsInfo.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.DevTestLabs.Models +{ + using System.Linq; + + /// + /// Information about a Windows OS. + /// + public partial class WindowsOsInfo + { + /// + /// Initializes a new instance of the WindowsOsInfo class. + /// + public WindowsOsInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WindowsOsInfo class. + /// + + /// The state of the Windows OS (i.e. NonSysprepped, SysprepRequested, + /// SysprepApplied). + /// Possible values include: 'NonSysprepped', 'SysprepRequested', + /// 'SysprepApplied' + public WindowsOsInfo(string windowsOSState = default(string)) + + { + this.WindowsOSState = windowsOSState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the state of the Windows OS (i.e. NonSysprepped, + /// SysprepRequested, SysprepApplied). Possible values include: 'NonSysprepped', 'SysprepRequested', 'SysprepApplied' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "windowsOsState")] + public string WindowsOSState {get; set; } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsState.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsState.cs new file mode 100644 index 000000000000..f02e7aa9b563 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Models/WindowsOsState.cs @@ -0,0 +1,20 @@ +// 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.DevTestLabs.Models +{ + + /// + /// Defines values for WindowsOsState. + /// + + + public static class WindowsOsState + { + public const string NonSysprepped = "NonSysprepped"; + public const string SysprepRequested = "SysprepRequested"; + public const string SysprepApplied = "SysprepApplied"; + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperations.cs new file mode 100644 index 000000000000..2f5b8f48e0ea --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperations.cs @@ -0,0 +1,1570 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// NotificationChannelsOperations operations. + /// + internal partial class NotificationChannelsOperations : Microsoft.Rest.IServiceOperations, INotificationChannelsOperations + { + /// + /// Initializes a new instance of the NotificationChannelsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal NotificationChannelsOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List notificationchannels in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("labName", labName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _notificationChannel = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_notificationChannel)) + { + _queryParameters.Add(_notificationChannel); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get notificationchannel. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// Specify the $expand query. Example: 'properties($select=webHookUrl)' + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing notificationChannel. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// A notification. + /// + /// + /// 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 System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, NotificationChannel notificationChannel, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (notificationChannel == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "notificationChannel"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("notificationChannel", notificationChannel); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(notificationChannel != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(notificationChannel, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete notificationchannel. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// 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 System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Modify properties of notificationchannels. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// A notification. + /// + /// + /// 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 System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, NotificationChannelFragment notificationChannel, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (notificationChannel == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "notificationChannel"); + } + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("notificationChannel", notificationChannel); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(notificationChannel != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(notificationChannel, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Send notification to provided channel. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// Properties for generating a Notification. + /// + /// + /// 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 System.Threading.Tasks.Task NotifyWithHttpMessagesAsync(string labName, string name, NotifyParameters notifyParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (notifyParameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "notifyParameters"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("notifyParameters", notifyParameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Notify", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}/notify").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(notifyParameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(notifyParameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List notificationchannels in a given lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperationsExtensions.cs new file mode 100644 index 000000000000..7ffcc4f19268 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/NotificationChannelsOperationsExtensions.cs @@ -0,0 +1,283 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for NotificationChannelsOperations + /// + public static partial class NotificationChannelsOperationsExtensions + { + /// + /// List notificationchannels in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this INotificationChannelsOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((INotificationChannelsOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List notificationchannels in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this INotificationChannelsOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get notificationchannel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// Specify the $expand query. Example: 'properties($select=webHookUrl)' + /// + public static NotificationChannel Get(this INotificationChannelsOperations operations, string labName, string name, string expand = default(string)) + { + return ((INotificationChannelsOperations)operations).GetAsync(labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get notificationchannel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// Specify the $expand query. Example: 'properties($select=webHookUrl)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this INotificationChannelsOperations operations, string labName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing notificationChannel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + public static NotificationChannel CreateOrUpdate(this INotificationChannelsOperations operations, string labName, string name, NotificationChannel notificationChannel) + { + return ((INotificationChannelsOperations)operations).CreateOrUpdateAsync(labName, name, notificationChannel).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing notificationChannel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this INotificationChannelsOperations operations, string labName, string name, NotificationChannel notificationChannel, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, notificationChannel, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete notificationchannel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + public static void Delete(this INotificationChannelsOperations operations, string labName, string name) + { + ((INotificationChannelsOperations)operations).DeleteAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete notificationchannel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this INotificationChannelsOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of notificationchannels. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + public static NotificationChannel Update(this INotificationChannelsOperations operations, string labName, string name, NotificationChannelFragment notificationChannel) + { + return ((INotificationChannelsOperations)operations).UpdateAsync(labName, name, notificationChannel).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of notificationchannels. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this INotificationChannelsOperations operations, string labName, string name, NotificationChannelFragment notificationChannel, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, notificationChannel, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Send notification to provided channel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + public static void Notify(this INotificationChannelsOperations operations, string labName, string name, NotifyParameters notifyParameters) + { + ((INotificationChannelsOperations)operations).NotifyAsync(labName, name, notifyParameters).GetAwaiter().GetResult(); + } + + /// + /// Send notification to provided channel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the notificationChannel. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task NotifyAsync(this INotificationChannelsOperations operations, string labName, string name, NotifyParameters notifyParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.NotifyWithHttpMessagesAsync(labName, name, notifyParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List notificationchannels in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this INotificationChannelsOperations operations, string nextPageLink) + { + return ((INotificationChannelsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List notificationchannels 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 System.Threading.Tasks.Task> ListNextAsync(this INotificationChannelsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Operations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Operations.cs new file mode 100644 index 000000000000..482d5a329730 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/Operations.cs @@ -0,0 +1,255 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// Operations operations. + /// + internal partial class Operations : Microsoft.Rest.IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// Get operation. + /// + /// + /// The name of the location. + /// + /// + /// The name of 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string locationName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (locationName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "locationName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/locations/{locationName}/operations/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/OperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..241e7290f43b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/OperationsExtensions.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for Operations + /// + public static partial class OperationsExtensions + { + /// + /// Get operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the location. + /// + /// + /// The name of the operation. + /// + public static OperationResult Get(this IOperations operations, string locationName, string name) + { + return ((IOperations)operations).GetAsync(locationName, name).GetAwaiter().GetResult(); + } + + /// + /// Get operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the location. + /// + /// + /// The name of the operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IOperations operations, string locationName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(locationName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperations.cs new file mode 100644 index 000000000000..1f4c44da5521 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperations.cs @@ -0,0 +1,1407 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// PoliciesOperations operations. + /// + internal partial class PoliciesOperations : Microsoft.Rest.IServiceOperations, IPoliciesOperations + { + /// + /// Initializes a new instance of the PoliciesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PoliciesOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List policies in a given policy set. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string policySetName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (policySetName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policySetName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("labName", labName); + tracingParameters.Add("policySetName", policySetName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _policy = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_policy)) + { + _queryParameters.Add(_policy); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get policy. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// Specify the $expand query. Example: 'properties($select=description)' + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string policySetName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (policySetName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policySetName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("policySetName", policySetName); + tracingParameters.Add("name", name); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing policy. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// A Policy. + /// + /// + /// 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 System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string policySetName, string name, Policy policy, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (policy == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policy"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (policySetName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policySetName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("policySetName", policySetName); + tracingParameters.Add("name", name); + + tracingParameters.Add("policy", policy); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(policy != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(policy, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete policy. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// 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 System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string policySetName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (policySetName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policySetName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("policySetName", policySetName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Modify properties of policies. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// A Policy. + /// + /// + /// 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 System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string policySetName, string name, PolicyFragment policy, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (policy == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policy"); + } + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (policySetName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policySetName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("policySetName", policySetName); + tracingParameters.Add("name", name); + + tracingParameters.Add("policy", policy); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{policySetName}", System.Uri.EscapeDataString(policySetName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(policy != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(policy, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List policies in a given policy set. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperationsExtensions.cs new file mode 100644 index 000000000000..aecc58316be9 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PoliciesOperationsExtensions.cs @@ -0,0 +1,277 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for PoliciesOperations + /// + public static partial class PoliciesOperationsExtensions + { + /// + /// List policies in a given policy set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + public static Microsoft.Rest.Azure.IPage List(this IPoliciesOperations operations, string labName, string policySetName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IPoliciesOperations)operations).ListAsync(labName, policySetName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List policies in a given policy set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IPoliciesOperations operations, string labName, string policySetName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, policySetName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// Specify the $expand query. Example: 'properties($select=description)' + /// + public static Policy Get(this IPoliciesOperations operations, string labName, string policySetName, string name, string expand = default(string)) + { + return ((IPoliciesOperations)operations).GetAsync(labName, policySetName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// Specify the $expand query. Example: 'properties($select=description)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IPoliciesOperations operations, string labName, string policySetName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, policySetName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + public static Policy CreateOrUpdate(this IPoliciesOperations operations, string labName, string policySetName, string name, Policy policy) + { + return ((IPoliciesOperations)operations).CreateOrUpdateAsync(labName, policySetName, name, policy).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IPoliciesOperations operations, string labName, string policySetName, string name, Policy policy, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, policySetName, name, policy, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + public static void Delete(this IPoliciesOperations operations, string labName, string policySetName, string name) + { + ((IPoliciesOperations)operations).DeleteAsync(labName, policySetName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IPoliciesOperations operations, string labName, string policySetName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, policySetName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of policies. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + public static Policy Update(this IPoliciesOperations operations, string labName, string policySetName, string name, PolicyFragment policy) + { + return ((IPoliciesOperations)operations).UpdateAsync(labName, policySetName, name, policy).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of policies. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The name of the policy. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IPoliciesOperations operations, string labName, string policySetName, string name, PolicyFragment policy, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, policySetName, name, policy, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List policies in a given policy set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IPoliciesOperations operations, string nextPageLink) + { + return ((IPoliciesOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List policies in a given policy set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IPoliciesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperations.cs new file mode 100644 index 000000000000..7ea694dea180 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperations.cs @@ -0,0 +1,276 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// PolicySetsOperations operations. + /// + internal partial class PolicySetsOperations : Microsoft.Rest.IServiceOperations, IPolicySetsOperations + { + /// + /// Initializes a new instance of the PolicySetsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PolicySetsOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// Evaluates lab policy. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// Request body for evaluating a policy set. + /// + /// + /// 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 System.Threading.Tasks.Task> EvaluatePoliciesWithHttpMessagesAsync(string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (evaluatePoliciesRequest == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "evaluatePoliciesRequest"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("evaluatePoliciesRequest", evaluatePoliciesRequest); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "EvaluatePolicies", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{name}/evaluatePolicies").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(evaluatePoliciesRequest != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(evaluatePoliciesRequest, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperationsExtensions.cs new file mode 100644 index 000000000000..fefddc56c986 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/PolicySetsOperationsExtensions.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for PolicySetsOperations + /// + public static partial class PolicySetsOperationsExtensions + { + /// + /// Evaluates lab policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + public static EvaluatePoliciesResponse EvaluatePolicies(this IPolicySetsOperations operations, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest) + { + return ((IPolicySetsOperations)operations).EvaluatePoliciesAsync(labName, name, evaluatePoliciesRequest).GetAwaiter().GetResult(); + } + + /// + /// Evaluates lab policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the policy set. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task EvaluatePoliciesAsync(this IPolicySetsOperations operations, string labName, string name, EvaluatePoliciesRequest evaluatePoliciesRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.EvaluatePoliciesWithHttpMessagesAsync(labName, name, evaluatePoliciesRequest, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperations.cs new file mode 100644 index 000000000000..dc756db7f657 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperations.cs @@ -0,0 +1,411 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// ProviderOperations operations. + /// + internal partial class ProviderOperations : Microsoft.Rest.IServiceOperations, IProviderOperations + { + /// + /// Initializes a new instance of the ProviderOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ProviderOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.DevTestLab/operations").ToString(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperationsExtensions.cs new file mode 100644 index 000000000000..0a70971db733 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ProviderOperationsExtensions.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// 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 Microsoft.Rest.Azure.IPage List(this IProviderOperations operations) + { + return ((IProviderOperations)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 System.Threading.Tasks.Task> ListAsync(this IProviderOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.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 Microsoft.Rest.Azure.IPage ListNext(this IProviderOperations operations, string nextPageLink) + { + return ((IProviderOperations)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 System.Threading.Tasks.Task> ListNextAsync(this IProviderOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperations.cs new file mode 100644 index 000000000000..5ad54ac2202e --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperations.cs @@ -0,0 +1,1978 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// SchedulesOperations operations. + /// + internal partial class SchedulesOperations : Microsoft.Rest.IServiceOperations, ISchedulesOperations + { + /// + /// Initializes a new instance of the SchedulesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SchedulesOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List schedules in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("labName", labName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _schedule = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_schedule)) + { + _queryParameters.Add(_schedule); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get schedule. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing schedule. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// 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 System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, Schedule schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (schedule == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "schedule"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("schedule", schedule); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(schedule != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete schedule. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Modify properties of schedules. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// 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 System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, ScheduleFragment schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (schedule == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "schedule"); + } + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("schedule", schedule); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(schedule != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task ExecuteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all applicable schedules + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListApplicableWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListApplicable", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/listApplicable").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 System.Threading.Tasks.Task BeginExecuteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginExecute", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List schedules in a given lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists all applicable schedules + /// + /// + /// 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 System.Threading.Tasks.Task>> ListApplicableNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListApplicableNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperationsExtensions.cs new file mode 100644 index 000000000000..15a2117f1275 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SchedulesOperationsExtensions.cs @@ -0,0 +1,391 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for SchedulesOperations + /// + public static partial class SchedulesOperationsExtensions + { + /// + /// List schedules in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this ISchedulesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((ISchedulesOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List schedules in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this ISchedulesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + public static Schedule Get(this ISchedulesOperations operations, string labName, string name, string expand = default(string)) + { + return ((ISchedulesOperations)operations).GetAsync(labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this ISchedulesOperations operations, string labName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + public static Schedule CreateOrUpdate(this ISchedulesOperations operations, string labName, string name, Schedule schedule) + { + return ((ISchedulesOperations)operations).CreateOrUpdateAsync(labName, name, schedule).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this ISchedulesOperations operations, string labName, string name, Schedule schedule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, schedule, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + public static void Delete(this ISchedulesOperations operations, string labName, string name) + { + ((ISchedulesOperations)operations).DeleteAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this ISchedulesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + public static Schedule Update(this ISchedulesOperations operations, string labName, string name, ScheduleFragment schedule) + { + return ((ISchedulesOperations)operations).UpdateAsync(labName, name, schedule).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this ISchedulesOperations operations, string labName, string name, ScheduleFragment schedule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, schedule, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + public static void Execute(this ISchedulesOperations operations, string labName, string name) + { + ((ISchedulesOperations)operations).ExecuteAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ExecuteAsync(this ISchedulesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.ExecuteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Lists all applicable schedules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + public static Microsoft.Rest.Azure.IPage ListApplicable(this ISchedulesOperations operations, string labName, string name) + { + return ((ISchedulesOperations)operations).ListApplicableAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Lists all applicable schedules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListApplicableAsync(this ISchedulesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListApplicableWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + public static void BeginExecute(this ISchedulesOperations operations, string labName, string name) + { + ((ISchedulesOperations)operations).BeginExecuteAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginExecuteAsync(this ISchedulesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginExecuteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List schedules in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this ISchedulesOperations operations, string nextPageLink) + { + return ((ISchedulesOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List schedules 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 System.Threading.Tasks.Task> ListNextAsync(this ISchedulesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists all applicable schedules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListApplicableNext(this ISchedulesOperations operations, string nextPageLink) + { + return ((ISchedulesOperations)operations).ListApplicableNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all applicable schedules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListApplicableNextAsync(this ISchedulesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListApplicableNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperations.cs new file mode 100644 index 000000000000..1c4eb72b7812 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperations.cs @@ -0,0 +1,1164 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// SecretsOperations operations. + /// + internal partial class SecretsOperations : Microsoft.Rest.IServiceOperations, ISecretsOperations + { + /// + /// Initializes a new instance of the SecretsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SecretsOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List secrets in a given user profile. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (userName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _secret = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_secret)) + { + _queryParameters.Add(_secret); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get secret. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// Specify the $expand query. Example: 'properties($select=value)' + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string userName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (userName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing secret. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// A secret. + /// + /// + /// 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 System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string userName, string name, Secret secret, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (secret == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "secret"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (userName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + + tracingParameters.Add("secret", secret); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(secret != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(secret, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete secret. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// 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 System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string userName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (userName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "userName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("userName", userName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{userName}", System.Uri.EscapeDataString(userName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List secrets in a given user profile. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperationsExtensions.cs new file mode 100644 index 000000000000..9f852b82932d --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/SecretsOperationsExtensions.cs @@ -0,0 +1,232 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for SecretsOperations + /// + public static partial class SecretsOperationsExtensions + { + /// + /// List secrets in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + public static Microsoft.Rest.Azure.IPage List(this ISecretsOperations operations, string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((ISecretsOperations)operations).ListAsync(labName, userName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List secrets in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this ISecretsOperations operations, string labName, string userName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, userName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// Specify the $expand query. Example: 'properties($select=value)' + /// + public static Secret Get(this ISecretsOperations operations, string labName, string userName, string name, string expand = default(string)) + { + return ((ISecretsOperations)operations).GetAsync(labName, userName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// Specify the $expand query. Example: 'properties($select=value)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this ISecretsOperations operations, string labName, string userName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, userName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + public static Secret CreateOrUpdate(this ISecretsOperations operations, string labName, string userName, string name, Secret secret) + { + return ((ISecretsOperations)operations).CreateOrUpdateAsync(labName, userName, name, secret).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this ISecretsOperations operations, string labName, string userName, string name, Secret secret, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, userName, name, secret, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + public static void Delete(this ISecretsOperations operations, string labName, string userName, string name) + { + ((ISecretsOperations)operations).DeleteAsync(labName, userName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The name of the secret. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this ISecretsOperations operations, string labName, string userName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, userName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List secrets in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this ISecretsOperations operations, string nextPageLink) + { + return ((ISecretsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List secrets in a given user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this ISecretsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperations.cs new file mode 100644 index 000000000000..5ddcbdf568d6 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperations.cs @@ -0,0 +1,1115 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// ServiceRunnersOperations operations. + /// + internal partial class ServiceRunnersOperations : Microsoft.Rest.IServiceOperations, IServiceRunnersOperations + { + /// + /// Initializes a new instance of the ServiceRunnersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ServiceRunnersOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List service runners in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("labName", labName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _serviceRunner = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_serviceRunner)) + { + _queryParameters.Add(_serviceRunner); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get service runner. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing Service runner. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// A container for a managed identity to execute DevTest lab services. + /// + /// + /// 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 System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, ServiceRunner serviceRunner, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (serviceRunner == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "serviceRunner"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("serviceRunner", serviceRunner); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(serviceRunner != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(serviceRunner, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete service runner. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// 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 System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List service runners in a given lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperationsExtensions.cs new file mode 100644 index 000000000000..547f4aa3fac8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/ServiceRunnersOperationsExtensions.cs @@ -0,0 +1,202 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for ServiceRunnersOperations + /// + public static partial class ServiceRunnersOperationsExtensions + { + /// + /// List service runners in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this IServiceRunnersOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IServiceRunnersOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List service runners in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IServiceRunnersOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get service runner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + public static ServiceRunner Get(this IServiceRunnersOperations operations, string labName, string name) + { + return ((IServiceRunnersOperations)operations).GetAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Get service runner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IServiceRunnersOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing Service runner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + public static ServiceRunner CreateOrUpdate(this IServiceRunnersOperations operations, string labName, string name, ServiceRunner serviceRunner) + { + return ((IServiceRunnersOperations)operations).CreateOrUpdateAsync(labName, name, serviceRunner).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing Service runner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IServiceRunnersOperations operations, string labName, string name, ServiceRunner serviceRunner, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, serviceRunner, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete service runner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + public static void Delete(this IServiceRunnersOperations operations, string labName, string name) + { + ((IServiceRunnersOperations)operations).DeleteAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete service runner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the service runner. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IServiceRunnersOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List service runners in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IServiceRunnersOperations operations, string nextPageLink) + { + return ((IServiceRunnersOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List service runners 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 System.Threading.Tasks.Task> ListNextAsync(this IServiceRunnersOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperations.cs new file mode 100644 index 000000000000..4f397d4ccc84 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperations.cs @@ -0,0 +1,1379 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// UsersOperations operations. + /// + internal partial class UsersOperations : Microsoft.Rest.IServiceOperations, IUsersOperations + { + /// + /// Initializes a new instance of the UsersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal UsersOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List user profiles in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("labName", labName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _user = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_user)) + { + _queryParameters.Add(_user); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get user profile. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Specify the $expand query. Example: 'properties($select=identity)' + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing user profile. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Profile of a lab 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 System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, User user, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (user == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "user"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("user", user); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(user != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(user, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Modify properties of user profiles. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Profile of a lab 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 System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, UserFragment user, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (user == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "user"); + } + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("user", user); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(user != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(user, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// 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 System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List user profiles in a given lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperationsExtensions.cs new file mode 100644 index 000000000000..50413a9f69b1 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/UsersOperationsExtensions.cs @@ -0,0 +1,283 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for UsersOperations + /// + public static partial class UsersOperationsExtensions + { + /// + /// List user profiles in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this IUsersOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IUsersOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List user profiles in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IUsersOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Specify the $expand query. Example: 'properties($select=identity)' + /// + public static User Get(this IUsersOperations operations, string labName, string name, string expand = default(string)) + { + return ((IUsersOperations)operations).GetAsync(labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// Specify the $expand query. Example: 'properties($select=identity)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IUsersOperations operations, string labName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + public static User CreateOrUpdate(this IUsersOperations operations, string labName, string name, User user) + { + return ((IUsersOperations)operations).CreateOrUpdateAsync(labName, name, user).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing user profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IUsersOperations operations, string labName, string name, User user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, user, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + public static void Delete(this IUsersOperations operations, string labName, string name) + { + ((IUsersOperations)operations).DeleteAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IUsersOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of user profiles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + public static User Update(this IUsersOperations operations, string labName, string name, UserFragment user) + { + return ((IUsersOperations)operations).UpdateAsync(labName, name, user).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of user profiles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IUsersOperations operations, string labName, string name, UserFragment user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, user, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + public static void BeginDelete(this IUsersOperations operations, string labName, string name) + { + ((IUsersOperations)operations).BeginDeleteAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete user profile. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the user profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IUsersOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List user profiles in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IUsersOperations operations, string nextPageLink) + { + return ((IUsersOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List user profiles 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 System.Threading.Tasks.Task> ListNextAsync(this IUsersOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperations.cs new file mode 100644 index 000000000000..ed07f41c89df --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperations.cs @@ -0,0 +1,1640 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// VirtualMachineSchedulesOperations operations. + /// + internal partial class VirtualMachineSchedulesOperations : Microsoft.Rest.IServiceOperations, IVirtualMachineSchedulesOperations + { + /// + /// Initializes a new instance of the VirtualMachineSchedulesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineSchedulesOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List schedules in a given virtual machine. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, string virtualMachineName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (virtualMachineName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "virtualMachineName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("labName", labName); + tracingParameters.Add("virtualMachineName", virtualMachineName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _schedule = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_schedule)) + { + _queryParameters.Add(_schedule); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get schedule. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string virtualMachineName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (virtualMachineName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "virtualMachineName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("virtualMachineName", virtualMachineName); + tracingParameters.Add("name", name); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing schedule. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// 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 System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string virtualMachineName, string name, Schedule schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (schedule == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "schedule"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (virtualMachineName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "virtualMachineName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("virtualMachineName", virtualMachineName); + tracingParameters.Add("name", name); + + tracingParameters.Add("schedule", schedule); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(schedule != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete schedule. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (virtualMachineName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "virtualMachineName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("virtualMachineName", virtualMachineName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Modify properties of schedules. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// A schedule. + /// + /// + /// 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 System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string virtualMachineName, string name, ScheduleFragment schedule, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (schedule == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "schedule"); + } + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (virtualMachineName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "virtualMachineName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("virtualMachineName", virtualMachineName); + tracingParameters.Add("name", name); + + tracingParameters.Add("schedule", schedule); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(schedule != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(schedule, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task ExecuteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginExecuteWithHttpMessagesAsync(labName, virtualMachineName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// 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 System.Threading.Tasks.Task BeginExecuteWithHttpMessagesAsync(string labName, string virtualMachineName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (virtualMachineName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "virtualMachineName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("virtualMachineName", virtualMachineName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginExecute", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{virtualMachineName}", System.Uri.EscapeDataString(virtualMachineName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List schedules in a given virtual machine. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperationsExtensions.cs new file mode 100644 index 000000000000..caa120928e50 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachineSchedulesOperationsExtensions.cs @@ -0,0 +1,361 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for VirtualMachineSchedulesOperations + /// + public static partial class VirtualMachineSchedulesOperationsExtensions + { + /// + /// List schedules in a given virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static Microsoft.Rest.Azure.IPage List(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IVirtualMachineSchedulesOperations)operations).ListAsync(labName, virtualMachineName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List schedules in a given virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, virtualMachineName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + public static Schedule Get(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, string expand = default(string)) + { + return ((IVirtualMachineSchedulesOperations)operations).GetAsync(labName, virtualMachineName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, virtualMachineName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + public static Schedule CreateOrUpdate(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, Schedule schedule) + { + return ((IVirtualMachineSchedulesOperations)operations).CreateOrUpdateAsync(labName, virtualMachineName, name, schedule).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, Schedule schedule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, virtualMachineName, name, schedule, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + public static void Delete(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name) + { + ((IVirtualMachineSchedulesOperations)operations).DeleteAsync(labName, virtualMachineName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, virtualMachineName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + public static Schedule Update(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, ScheduleFragment schedule) + { + return ((IVirtualMachineSchedulesOperations)operations).UpdateAsync(labName, virtualMachineName, name, schedule).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of schedules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, ScheduleFragment schedule, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, virtualMachineName, name, schedule, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + public static void Execute(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name) + { + ((IVirtualMachineSchedulesOperations)operations).ExecuteAsync(labName, virtualMachineName, name).GetAwaiter().GetResult(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ExecuteAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.ExecuteWithHttpMessagesAsync(labName, virtualMachineName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + public static void BeginExecute(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name) + { + ((IVirtualMachineSchedulesOperations)operations).BeginExecuteAsync(labName, virtualMachineName, name).GetAwaiter().GetResult(); + } + + /// + /// Execute a schedule. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The name of the schedule. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginExecuteAsync(this IVirtualMachineSchedulesOperations operations, string labName, string virtualMachineName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginExecuteWithHttpMessagesAsync(labName, virtualMachineName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List schedules in a given virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IVirtualMachineSchedulesOperations operations, string nextPageLink) + { + return ((IVirtualMachineSchedulesOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List schedules in a given virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IVirtualMachineSchedulesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperations.cs new file mode 100644 index 000000000000..b40892710b4a --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperations.cs @@ -0,0 +1,3008 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// VirtualMachinesOperations operations. + /// + internal partial class VirtualMachinesOperations : Microsoft.Rest.IServiceOperations, IVirtualMachinesOperations + { + /// + /// Initializes a new instance of the VirtualMachinesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachinesOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List virtual machines in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("labName", labName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _labVirtualMachine = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_labVirtualMachine)) + { + _queryParameters.Add(_labVirtualMachine); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get virtual machine. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachine labVirtualMachine, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, labVirtualMachine, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Modify properties of virtual machines. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A virtual machine. + /// + /// + /// 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 System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachineFragment labVirtualMachine, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (labVirtualMachine == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labVirtualMachine"); + } + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("labVirtualMachine", labVirtualMachine); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(labVirtualMachine != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(labVirtualMachine, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for adding a new or existing data disk to a virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task AddDataDiskWithHttpMessagesAsync(string labName, string name, DataDiskProperties dataDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginAddDataDiskWithHttpMessagesAsync(labName, name, dataDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for applying artifacts to a virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task ApplyArtifactsWithHttpMessagesAsync(string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginApplyArtifactsWithHttpMessagesAsync(labName, name, applyArtifactsRequest, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task ClaimWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginClaimWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for detaching data disk from a virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task DetachDataDiskWithHttpMessagesAsync(string labName, string name, DetachDataDiskProperties detachDataDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDetachDataDiskWithHttpMessagesAsync(labName, name, detachDataDiskProperties, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all applicable schedules + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 System.Threading.Tasks.Task> ListApplicableSchedulesWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListApplicableSchedules", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task StartWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task StopWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// A virtual machine. + /// + /// + /// 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 System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, LabVirtualMachine labVirtualMachine, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (labVirtualMachine == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labVirtualMachine"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("labVirtualMachine", labVirtualMachine); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(labVirtualMachine != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(labVirtualMachine, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for adding a new or existing data disk to a virtual machine. + /// + /// + /// 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 System.Threading.Tasks.Task BeginAddDataDiskWithHttpMessagesAsync(string labName, string name, DataDiskProperties dataDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (dataDiskProperties == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "dataDiskProperties"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("dataDiskProperties", dataDiskProperties); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginAddDataDisk", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(dataDiskProperties != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(dataDiskProperties, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for applying artifacts to a virtual machine. + /// + /// + /// 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 System.Threading.Tasks.Task BeginApplyArtifactsWithHttpMessagesAsync(string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (applyArtifactsRequest == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "applyArtifactsRequest"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("applyArtifactsRequest", applyArtifactsRequest); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginApplyArtifacts", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(applyArtifactsRequest != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(applyArtifactsRequest, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 System.Threading.Tasks.Task BeginClaimWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginClaim", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Request body for detaching data disk from a virtual machine. + /// + /// + /// 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 System.Threading.Tasks.Task BeginDetachDataDiskWithHttpMessagesAsync(string labName, string name, DetachDataDiskProperties detachDataDiskProperties, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (detachDataDiskProperties == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "detachDataDiskProperties"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("detachDataDiskProperties", detachDataDiskProperties); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDetachDataDisk", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(detachDataDiskProperties != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(detachDataDiskProperties, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 System.Threading.Tasks.Task BeginStartWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginStart", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 System.Threading.Tasks.Task BeginStopWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginStop", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List virtual machines in a given lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs new file mode 100644 index 000000000000..ad4d9df44901 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs @@ -0,0 +1,815 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for VirtualMachinesOperations + /// + public static partial class VirtualMachinesOperationsExtensions + { + /// + /// List virtual machines in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this IVirtualMachinesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IVirtualMachinesOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List virtual machines in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IVirtualMachinesOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + /// + public static LabVirtualMachine Get(this IVirtualMachinesOperations operations, string labName, string name, string expand = default(string)) + { + return ((IVirtualMachinesOperations)operations).GetAsync(labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Specify the $expand query. Example: + /// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IVirtualMachinesOperations operations, string labName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static LabVirtualMachine CreateOrUpdate(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachine labVirtualMachine) + { + return ((IVirtualMachinesOperations)operations).CreateOrUpdateAsync(labName, name, labVirtualMachine).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachine labVirtualMachine, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, labVirtualMachine, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void Delete(this IVirtualMachinesOperations operations, string labName, string name) + { + ((IVirtualMachinesOperations)operations).DeleteAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IVirtualMachinesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static LabVirtualMachine Update(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachineFragment labVirtualMachine) + { + return ((IVirtualMachinesOperations)operations).UpdateAsync(labName, name, labVirtualMachine).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachineFragment labVirtualMachine, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, labVirtualMachine, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void AddDataDisk(this IVirtualMachinesOperations operations, string labName, string name, DataDiskProperties dataDiskProperties) + { + ((IVirtualMachinesOperations)operations).AddDataDiskAsync(labName, name, dataDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task AddDataDiskAsync(this IVirtualMachinesOperations operations, string labName, string name, DataDiskProperties dataDiskProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.AddDataDiskWithHttpMessagesAsync(labName, name, dataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void ApplyArtifacts(this IVirtualMachinesOperations operations, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest) + { + ((IVirtualMachinesOperations)operations).ApplyArtifactsAsync(labName, name, applyArtifactsRequest).GetAwaiter().GetResult(); + } + + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ApplyArtifactsAsync(this IVirtualMachinesOperations operations, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.ApplyArtifactsWithHttpMessagesAsync(labName, name, applyArtifactsRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void Claim(this IVirtualMachinesOperations operations, string labName, string name) + { + ((IVirtualMachinesOperations)operations).ClaimAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ClaimAsync(this IVirtualMachinesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.ClaimWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void DetachDataDisk(this IVirtualMachinesOperations operations, string labName, string name, DetachDataDiskProperties detachDataDiskProperties) + { + ((IVirtualMachinesOperations)operations).DetachDataDiskAsync(labName, name, detachDataDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DetachDataDiskAsync(this IVirtualMachinesOperations operations, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DetachDataDiskWithHttpMessagesAsync(labName, name, detachDataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Lists all applicable schedules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static ApplicableSchedule ListApplicableSchedules(this IVirtualMachinesOperations operations, string labName, string name) + { + return ((IVirtualMachinesOperations)operations).ListApplicableSchedulesAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Lists all applicable schedules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ListApplicableSchedulesAsync(this IVirtualMachinesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListApplicableSchedulesWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void Start(this IVirtualMachinesOperations operations, string labName, string name) + { + ((IVirtualMachinesOperations)operations).StartAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task StartAsync(this IVirtualMachinesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.StartWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void Stop(this IVirtualMachinesOperations operations, string labName, string name) + { + ((IVirtualMachinesOperations)operations).StopAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task StopAsync(this IVirtualMachinesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.StopWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static LabVirtualMachine BeginCreateOrUpdate(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachine labVirtualMachine) + { + return ((IVirtualMachinesOperations)operations).BeginCreateOrUpdateAsync(labName, name, labVirtualMachine).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing Virtual machine. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IVirtualMachinesOperations operations, string labName, string name, LabVirtualMachine labVirtualMachine, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, labVirtualMachine, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginDelete(this IVirtualMachinesOperations operations, string labName, string name) + { + ((IVirtualMachinesOperations)operations).BeginDeleteAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IVirtualMachinesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginAddDataDisk(this IVirtualMachinesOperations operations, string labName, string name, DataDiskProperties dataDiskProperties) + { + ((IVirtualMachinesOperations)operations).BeginAddDataDiskAsync(labName, name, dataDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Attach a new or existing data disk to virtual machine. This operation can + /// take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginAddDataDiskAsync(this IVirtualMachinesOperations operations, string labName, string name, DataDiskProperties dataDiskProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginAddDataDiskWithHttpMessagesAsync(labName, name, dataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginApplyArtifacts(this IVirtualMachinesOperations operations, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest) + { + ((IVirtualMachinesOperations)operations).BeginApplyArtifactsAsync(labName, name, applyArtifactsRequest).GetAwaiter().GetResult(); + } + + /// + /// Apply artifacts to virtual machine. This operation can take a while to + /// complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginApplyArtifactsAsync(this IVirtualMachinesOperations operations, string labName, string name, ApplyArtifactsRequest applyArtifactsRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginApplyArtifactsWithHttpMessagesAsync(labName, name, applyArtifactsRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginClaim(this IVirtualMachinesOperations operations, string labName, string name) + { + ((IVirtualMachinesOperations)operations).BeginClaimAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Take ownership of an existing virtual machine This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginClaimAsync(this IVirtualMachinesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginClaimWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginDetachDataDisk(this IVirtualMachinesOperations operations, string labName, string name, DetachDataDiskProperties detachDataDiskProperties) + { + ((IVirtualMachinesOperations)operations).BeginDetachDataDiskAsync(labName, name, detachDataDiskProperties).GetAwaiter().GetResult(); + } + + /// + /// Detach the specified disk from the virtual machine. This operation can take + /// a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDetachDataDiskAsync(this IVirtualMachinesOperations operations, string labName, string name, DetachDataDiskProperties detachDataDiskProperties, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDetachDataDiskWithHttpMessagesAsync(labName, name, detachDataDiskProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginStart(this IVirtualMachinesOperations operations, string labName, string name) + { + ((IVirtualMachinesOperations)operations).BeginStartAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Start a virtual machine. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginStartAsync(this IVirtualMachinesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginStartWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginStop(this IVirtualMachinesOperations operations, string labName, string name) + { + ((IVirtualMachinesOperations)operations).BeginStopAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Stop a virtual machine This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginStopAsync(this IVirtualMachinesOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginStopWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List virtual machines in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IVirtualMachinesOperations operations, string nextPageLink) + { + return ((IVirtualMachinesOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List virtual machines 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 System.Threading.Tasks.Task> ListNextAsync(this IVirtualMachinesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperations.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperations.cs new file mode 100644 index 000000000000..30c2f8b89da2 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperations.cs @@ -0,0 +1,1406 @@ +// 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.DevTestLabs +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// VirtualNetworksOperations operations. + /// + internal partial class VirtualNetworksOperations : Microsoft.Rest.IServiceOperations, IVirtualNetworksOperations + { + /// + /// Initializes a new instance of the VirtualNetworksOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualNetworksOperations (DevTestLabsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DevTestLabsClient + /// + public DevTestLabsClient Client { get; private set; } + + /// + /// List virtual networks in a given lab. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("labName", labName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _virtualNetwork = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_virtualNetwork)) + { + _queryParameters.Add(_virtualNetwork); + } + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get virtual network. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// Specify the $expand query. Example: 'properties($expand=externalSubnets)' + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string labName, string name, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// A virtual network. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string labName, string name, VirtualNetwork virtualNetwork, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, virtualNetwork, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(labName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Modify properties of virtual networks. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// A virtual network. + /// + /// + /// 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 System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string labName, string name, VirtualNetworkFragment virtualNetwork, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (virtualNetwork == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "virtualNetwork"); + } + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("virtualNetwork", virtualNetwork); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(virtualNetwork != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(virtualNetwork, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// A virtual network. + /// + /// + /// 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 System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string labName, string name, VirtualNetwork virtualNetwork, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (virtualNetwork == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "virtualNetwork"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + tracingParameters.Add("virtualNetwork", virtualNetwork); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(virtualNetwork != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(virtualNetwork, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// 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 System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string labName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ResourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + + if (labName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "labName"); + } + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("labName", labName); + tracingParameters.Add("name", name); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(this.Client.ResourceGroupName)); + _url = _url.Replace("{labName}", System.Uri.EscapeDataString(labName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List virtual networks in a given lab. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperationsExtensions.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperationsExtensions.cs new file mode 100644 index 000000000000..43ee23e8258b --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Generated/VirtualNetworksOperationsExtensions.cs @@ -0,0 +1,326 @@ +// 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.DevTestLabs +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for VirtualNetworksOperations + /// + public static partial class VirtualNetworksOperationsExtensions + { + /// + /// List virtual networks in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + public static Microsoft.Rest.Azure.IPage List(this IVirtualNetworksOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IVirtualNetworksOperations)operations).ListAsync(labName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List virtual networks in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the lab. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IVirtualNetworksOperations operations, string labName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(labName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get virtual network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// Specify the $expand query. Example: 'properties($expand=externalSubnets)' + /// + public static VirtualNetwork Get(this IVirtualNetworksOperations operations, string labName, string name, string expand = default(string)) + { + return ((IVirtualNetworksOperations)operations).GetAsync(labName, name, expand).GetAwaiter().GetResult(); + } + + /// + /// Get virtual network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// Specify the $expand query. Example: 'properties($expand=externalSubnets)' + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IVirtualNetworksOperations operations, string labName, string name, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(labName, name, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + public static VirtualNetwork CreateOrUpdate(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetwork virtualNetwork) + { + return ((IVirtualNetworksOperations)operations).CreateOrUpdateAsync(labName, name, virtualNetwork).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetwork virtualNetwork, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(labName, name, virtualNetwork, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + public static void Delete(this IVirtualNetworksOperations operations, string labName, string name) + { + ((IVirtualNetworksOperations)operations).DeleteAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IVirtualNetworksOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Modify properties of virtual networks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + public static VirtualNetwork Update(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetworkFragment virtualNetwork) + { + return ((IVirtualNetworksOperations)operations).UpdateAsync(labName, name, virtualNetwork).GetAwaiter().GetResult(); + } + + /// + /// Modify properties of virtual networks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetworkFragment virtualNetwork, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(labName, name, virtualNetwork, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + public static VirtualNetwork BeginCreateOrUpdate(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetwork virtualNetwork) + { + return ((IVirtualNetworksOperations)operations).BeginCreateOrUpdateAsync(labName, name, virtualNetwork).GetAwaiter().GetResult(); + } + + /// + /// Create or replace an existing virtual network. This operation can take a + /// while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IVirtualNetworksOperations operations, string labName, string name, VirtualNetwork virtualNetwork, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(labName, name, virtualNetwork, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + public static void BeginDelete(this IVirtualNetworksOperations operations, string labName, string name) + { + ((IVirtualNetworksOperations)operations).BeginDeleteAsync(labName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete virtual network. This operation can take a while to complete. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the lab. + /// + /// + /// The name of the virtual network. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IVirtualNetworksOperations operations, string labName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(labName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List virtual networks in a given lab. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IVirtualNetworksOperations operations, string nextPageLink) + { + return ((IVirtualNetworksOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List virtual networks 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 System.Threading.Tasks.Task> ListNextAsync(this IVirtualNetworksOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/Properties/AssemblyInfo.cs b/src/DevTestLabs/DevTestLabs.Management.Sdk/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..a035489e49b9 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Microsoft Azure Powershell - DevTest Labs Management SDK")] +[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] +[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] + +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] + +[assembly: AssemblyVersion("2.0.0.0")] +[assembly: AssemblyFileVersion("2.0.2.0")] \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Management.Sdk/README.md b/src/DevTestLabs/DevTestLabs.Management.Sdk/README.md new file mode 100644 index 000000000000..e0dde363d5ca --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Management.Sdk/README.md @@ -0,0 +1,46 @@ +# Overall +This directory contains management plane service clients of Az.Storage module. + +## Run Generation +In this directory, run AutoRest: +``` +autorest --reset +autorest --use:@autorest/powershell@4.x +``` + +### AutoRest Configuration +> see https://aka.ms/autorest +``` yaml +isSdkGenerator: true +powershell: true +clear-output-folder: true +reflect-api-versions: true +openapi-type: arm +azure-arm: true +license-header: MICROSOFT_MIT_NO_VERSION +``` + + + +### +``` yaml +commit: d8a796d42bbe9456e3de85c37d3e1a38f4026d01 +input-file: + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2016-05-15/DTL.json + +output-folder: Generated + +namespace: Microsoft.Azure.Management.DevTestLabs + +directive: + - from: swagger-document + where: $.parameters.resourceGroupName + transform: >- + return { + "name": "resourceGroupName", + "in": "path", + "description": "The name of the resource group.", + "required": true, + "type": "string" + } +``` \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Test/DevTestLabs.Test.csproj b/src/DevTestLabs/DevTestLabs.Test/DevTestLabs.Test.csproj index 901f61db6774..0b3f317c0b9d 100644 --- a/src/DevTestLabs/DevTestLabs.Test/DevTestLabs.Test.csproj +++ b/src/DevTestLabs/DevTestLabs.Test/DevTestLabs.Test.csproj @@ -11,7 +11,7 @@ - + \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.cs b/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.cs index 7aacca793325..440c996a629d 100644 --- a/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.cs +++ b/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.cs @@ -59,5 +59,40 @@ public void TestAzureRmDtlAutoStartPolicy() { TestRunner.RunTestScript("Test-AzureRmDtlAutoStartPolicy"); } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestAzDtlAutoStartPolicy() + { + TestRunner.RunTestScript("Test-AzDtlAutoStartPolicy"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestAzDtlAutoShutdownPolicy() + { + TestRunner.RunTestScript("Test-AzDtlAutoShutdownPolicy"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestAzDtlAllowedVMSizesPolicy() + { + TestRunner.RunTestScript("Test-AzDtlAllowedVMSizesPolicy"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestAzDtlVMsPerUserPolicy() + { + TestRunner.RunTestScript("Test-AzDtlVMsPerUserPolicy"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestAzDtlVMsPerLabPolicy() + { + TestRunner.RunTestScript("Test-AzDtlVMsPerLabPolicy"); + } } } diff --git a/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.ps1 b/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.ps1 index 7e74ca86a404..ac3080bbfcb0 100644 --- a/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.ps1 +++ b/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.ps1 @@ -16,7 +16,7 @@ .SYNOPSIS Tests AzureRmDtlVMsPerLabPolicy #> -function Test-AzDtlVMsPerLabPolicy +function Test-AzureRmDtlVMsPerLabPolicy { $rgName = Get-ResourceGroupName $labName = Get-ResourceName "onesdk" @@ -44,7 +44,7 @@ function Test-AzDtlVMsPerLabPolicy .SYNOPSIS Tests AzureRmDtlVMsPerUserPolicy #> -function Test-AzDtlVMsPerUserPolicy +function Test-Test-AzureRmDtlVMsPerUserPolicy { $rgName = Get-ResourceGroupName $labName = Get-ResourceName "onesdk" @@ -70,7 +70,7 @@ function Test-AzDtlVMsPerUserPolicy .SYNOPSIS Tests AzureRmDtlAllowedVMSizesPolicy #> -function Test-AzDtlAllowedVMSizesPolicy +function Test-AzureRmDtlAllowedVMSizesPolicy { $rgName = Get-ResourceGroupName $labName = Get-ResourceName "onesdk" @@ -96,14 +96,14 @@ function Test-AzDtlAllowedVMSizesPolicy .SYNOPSIS Tests AzureRmDtlAllowedVMSizesPolicy #> -function Test-AzDtlAutoShutdownPolicy +function Test-AzureRmDtlAutoShutdownPolicy { $rgName = Get-ResourceGroupName $labName = Get-ResourceName "onesdk" try { - $policy = Set-AzDtlAutoShutdownPolicy -Time "13:30:00" -LabName $labName -ResourceGroupName $rgName + $policy = Set-AzDtlAutoShutdownPolicy -Time "13:30:00" -LabName $labName -ResourceGroupName $rgName -Enable $readBack = Get-AzDtlAutoShutdownPolicy -LabName $labName -ResourceGroupName $rgName Assert-AreEqual "Enabled" $policy.Status @@ -122,7 +122,7 @@ function Test-AzDtlAutoShutdownPolicy .SYNOPSIS Tests AzureRmDtlAutoStartPolicy #> -function Test-AzDtlAutoStartPolicy +function Test-AzureRmDtlAutoStartPolicy { $rgName = Get-ResourceGroupName $labName = Get-ResourceName "onesdk" @@ -154,3 +154,115 @@ function Test-AzDtlAutoStartPolicy Clean-ResourceGroup $rgName } } + +<# +.SYNOPSIS +Tests AzDtlAutoStartPolicy +Setup: Create lab "onesdklab0111" in group 'DTL-TestGroup' +#> +function Test-AzDtlAutoStartPolicy +{ + $rgName = 'DTL-TestGroup' + $labName = "onesdklab0111" + + $policy = Set-AzDtlAutoStartPolicy -Time "13:30:00" -LabName $labName -ResourceGroupName $rgName -Enable + $readBack = Get-AzDtlAutoStartPolicy -LabName $labName -ResourceGroupName $rgName + + Assert-AreEqual "Enabled" $policy.Status + Assert-AreEqual "1330" $policy.WeeklyRecurrence.Time + + Assert-AreEqual "Enabled" $readBack.Status + Assert-AreEqual "1330" $readBack.WeeklyRecurrence.Time + + $policy = Set-AzDtlAutoStartPolicy -Time "13:30:00" -LabName $labName -ResourceGroupName $rgName -Days Monday, Tuesday + $readBack = Get-AzDtlAutoStartPolicy -LabName $labName -ResourceGroupName $rgName + + Assert-AreEqual "Enabled" $policy.Status + Assert-AreEqual "1330" $policy.WeeklyRecurrence.Time + Assert-AreEqualArray ([System.DayOfWeek]::Monday, [System.DayOfWeek]::Tuesday) $policy.WeeklyRecurrence.Weekdays + + Assert-AreEqual "Enabled" $readBack.Status + Assert-AreEqual "1330" $readBack.WeeklyRecurrence.Time + Assert-AreEqualArray ([System.DayOfWeek]::Monday, [System.DayOfWeek]::Tuesday) $readBack.WeeklyRecurrence.Weekdays +} + +<# +.SYNOPSIS +Tests AzDtlAutoShutdownPolicy +Setup: Create lab "onesdklab0111" in group 'DTL-TestGroup' +#> +function Test-AzDtlAutoShutdownPolicy +{ + $rgName = 'DTL-TestGroup' + $labName = "onesdklab0111" + + $policy = Set-AzDtlAutoShutdownPolicy -Time "13:30:00" -LabName $labName -ResourceGroupName $rgName -Enable + $readBack = Get-AzDtlAutoShutdownPolicy -LabName $labName -ResourceGroupName $rgName + + Assert-AreEqual "Enabled" $policy.Status + Assert-AreEqual "1330" $policy.DailyRecurrence.Time + + Assert-AreEqual "Enabled" $readBack.Status + Assert-AreEqual "1330" $readBack.DailyRecurrence.Time +} + +<# +.SYNOPSIS +Tests AzDtlAllowedVMSizesPolicy +Setup: Create lab "onesdklab0111" in group 'DTL-TestGroup' +#> +function Test-AzDtlAllowedVMSizesPolicy +{ + $rgName = 'DTL-TestGroup' + $labName = "onesdklab0111" + + $policy = Set-AzDtlAllowedVMSizesPolicy -Enable -LabName $labName -ResourceGroupName $rgName -VmSizes Standard_A3, Standard_A0 + $readBack = Get-AzDtlAllowedVMSizesPolicy -LabName $labName -ResourceGroupName $rgName + + Assert-AreEqual "Enabled" $policy.Status + Assert-AreEqual '["Standard_A3","Standard_A0"]' $policy.Threshold + + Assert-AreEqual "Enabled" $readBack.Status + Assert-AreEqual '["Standard_A3","Standard_A0"]' $readBack.Threshold +} + +<# +.SYNOPSIS +Tests AzDtlVMsPerUserPolicy +Setup: Create lab "onesdklab0111" in group 'DTL-TestGroup' +#> +function Test-AzDtlVMsPerUserPolicy +{ + $rgName = 'DTL-TestGroup' + $labName = "onesdklab0111" + + $policy = Set-AzDtlVMsPerUserPolicy -MaxVMs 5 -LabName $labName -ResourceGroupName $rgName + $readBack = Get-AzDtlVMsPerUserPolicy -LabName $labName -ResourceGroupName $rgName + + Assert-AreEqual "Enabled" $policy.Status + Assert-AreEqual "5" $policy.Threshold + + Assert-AreEqual "Enabled" $readBack.Status + Assert-AreEqual "5" $readBack.Threshold +} + +<# +.SYNOPSIS +Tests AzDtlVMsPerLabPolicy +Setup: Create lab "onesdklab0111" in group 'DTL-TestGroup' +#> +function Test-AzDtlVMsPerLabPolicy +{ + $rgName = 'DTL-TestGroup' + $labName = "onesdklab0111" + + # Max VMs per lab policy + $policy = Set-AzDtlVMsPerLabPolicy -MaxVMs 5 -LabName $labName -ResourceGroupName $rgName + $readBack = Get-AzDtlVMsPerLabPolicy -LabName $labName -ResourceGroupName $rgName + + Assert-AreEqual "Enabled" $policy.Status + Assert-AreEqual "5" $policy.Threshold + + Assert-AreEqual "Enabled" $readBack.Status + Assert-AreEqual "5" $readBack.Threshold +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAllowedVMSizesPolicy.json b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAllowedVMSizesPolicy.json new file mode 100644 index 000000000000..8777901365e8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAllowedVMSizesPolicy.json @@ -0,0 +1,230 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/AllowedVmSizesInLab?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvQWxsb3dlZFZtU2l6ZXNJbkxhYj9hcGktdmVyc2lvbj0yMDE2LTA1LTE1", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "050f81ad-013b-4133-8f8a-1c02a6022869" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-request-id": [ + "f5cda775-525e-4d10-8ea7-e126e306a22b" + ], + "x-ms-correlation-request-id": [ + "f5cda775-525e-4d10-8ea7-e126e306a22b" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033518Z:f5cda775-525e-4d10-8ea7-e126e306a22b" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 4CB94D8DA8A542468EBF164429D685CC Ref B: MAA201060513037 Ref C: 2024-11-01T03:35:17Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:35:17 GMT" + ], + "Content-Length": [ + "169" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"ResourceInGroupDoesNotExist\",\r\n \"message\": \"The resource 'onesdklab0111/default/AllowedVmSizesInLab' under resource group 'DTL-TestGroup' was not found.\"\r\n }\r\n}", + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/AllowedVmSizesInLab?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvQWxsb3dlZFZtU2l6ZXNJbkxhYj9hcGktdmVyc2lvbj0yMDE2LTA1LTE1", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "220b2aa6-641a-407f-a2df-227076c301c6" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "c62ecc91-6316-4af5-8d57-22bc9f00de66" + ], + "x-ms-correlation-request-id": [ + "c62ecc91-6316-4af5-8d57-22bc9f00de66" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033522Z:c62ecc91-6316-4af5-8d57-22bc9f00de66" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: F9007A24BD274FDAAAC80A51DFF548D6 Ref B: MAA201060516031 Ref C: 2024-11-01T03:35:21Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:35:21 GMT" + ], + "Content-Length": [ + "522" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"LabVmSize\",\r\n \"threshold\": \"[\\\"Standard_A3\\\",\\\"Standard_A0\\\"]\",\r\n \"evaluatorType\": \"AllowedValuesPolicy\",\r\n \"createdDate\": \"2024-11-01T11:35:19.9707846+08:00\",\r\n \"uniqueIdentifier\": \"7f7b005b-6055-4a88-9aa8-5032caa6b191\"\r\n },\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/policysets/default/policies/allowedvmsizesinlab\",\r\n \"name\": \"AllowedVmSizesInLab\",\r\n \"type\": \"Microsoft.DevTestLab/labs/policySets/policies\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/AllowedVmSizesInLab?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvQWxsb3dlZFZtU2l6ZXNJbkxhYj9hcGktdmVyc2lvbj0yMDE2LTA1LTE1", + "RequestMethod": "PUT", + "RequestHeaders": { + "x-ms-client-request-id": [ + "050f81ad-013b-4133-8f8a-1c02a6022869" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "183" + ] + }, + "RequestBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"LabVmSize\",\r\n \"threshold\": \"[\\\"Standard_A3\\\",\\\"Standard_A0\\\"]\",\r\n \"evaluatorType\": \"AllowedValuesPolicy\"\r\n }\r\n}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-writes": [ + "2999" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "199" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "884844a1-1274-49e2-85a0-ab39ea3954f9" + ], + "x-ms-correlation-request-id": [ + "884844a1-1274-49e2-85a0-ab39ea3954f9" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033520Z:884844a1-1274-49e2-85a0-ab39ea3954f9" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 983B9EF7BC444BD9BE572DAAD7432987 Ref B: MAA201060513037 Ref C: 2024-11-01T03:35:18Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:35:19 GMT" + ], + "Content-Length": [ + "522" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"LabVmSize\",\r\n \"threshold\": \"[\\\"Standard_A3\\\",\\\"Standard_A0\\\"]\",\r\n \"evaluatorType\": \"AllowedValuesPolicy\",\r\n \"createdDate\": \"2024-11-01T11:35:19.9707846+08:00\",\r\n \"uniqueIdentifier\": \"7f7b005b-6055-4a88-9aa8-5032caa6b191\"\r\n },\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/policysets/default/policies/allowedvmsizesinlab\",\r\n \"name\": \"AllowedVmSizesInLab\",\r\n \"type\": \"Microsoft.DevTestLab/labs/policySets/policies\"\r\n}", + "StatusCode": 201 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "0b1f6471-1bf0-4dda-aec3-cb9272f09590" + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoShutdownPolicy.json b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoShutdownPolicy.json new file mode 100644 index 000000000000..6e108269a9c6 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoShutdownPolicy.json @@ -0,0 +1,230 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmsShutdown?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1zU2h1dGRvd24/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "6c735816-aa31-4d3a-b531-062324cffdf8" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "34f23254-e8db-48d1-83ec-ce3ac2a9cebe" + ], + "x-ms-correlation-request-id": [ + "34f23254-e8db-48d1-83ec-ce3ac2a9cebe" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T031844Z:34f23254-e8db-48d1-83ec-ce3ac2a9cebe" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: A2D396486B89426E85F831FD2BC50FAB Ref B: MAA201060513017 Ref C: 2024-11-11T03:18:43Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:18:44 GMT" + ], + "Content-Length": [ + "593" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Disabled\",\r\n \"taskType\": \"LabVmsShutdownTask\",\r\n \"dailyRecurrence\": {\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 30\r\n },\r\n \"createdDate\": \"2024-11-01T10:40:40.5258457+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"ded7b75f-8f5d-4612-95a6-58fb694a5065\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmsshutdown\",\r\n \"name\": \"LabVmsShutdown\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmsShutdown?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1zU2h1dGRvd24/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "06a4084f-8a1f-494b-8ef0-8f3d300849bf" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "e5d0007f-7606-46cd-bf21-cf7d3197f6c2" + ], + "x-ms-correlation-request-id": [ + "e5d0007f-7606-46cd-bf21-cf7d3197f6c2" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T031848Z:e5d0007f-7606-46cd-bf21-cf7d3197f6c2" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 61A544C7DA304440B69471987D88068F Ref B: MAA201060513049 Ref C: 2024-11-11T03:18:47Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:18:48 GMT" + ], + "Content-Length": [ + "592" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsShutdownTask\",\r\n \"dailyRecurrence\": {\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 30\r\n },\r\n \"createdDate\": \"2024-11-01T10:40:40.5258457+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"ded7b75f-8f5d-4612-95a6-58fb694a5065\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmsshutdown\",\r\n \"name\": \"LabVmsShutdown\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmsShutdown?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1zU2h1dGRvd24/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "PUT", + "RequestHeaders": { + "x-ms-client-request-id": [ + "6c735816-aa31-4d3a-b531-062324cffdf8" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "414" + ] + }, + "RequestBody": "{\r\n \"properties\": {\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 30\r\n },\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsShutdownTask\",\r\n \"dailyRecurrence\": {\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"ded7b75f-8f5d-4612-95a6-58fb694a5065\"\r\n },\r\n \"location\": \"eastus\"\r\n}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-writes": [ + "2999" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "199" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "c8ad3b9d-33d6-4de6-874c-4c5794097dee" + ], + "x-ms-correlation-request-id": [ + "c8ad3b9d-33d6-4de6-874c-4c5794097dee" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T031847Z:c8ad3b9d-33d6-4de6-874c-4c5794097dee" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 2132F81AE4484EB59509D83550DAB1BD Ref B: MAA201060513017 Ref C: 2024-11-11T03:18:44Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:18:47 GMT" + ], + "Content-Length": [ + "592" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsShutdownTask\",\r\n \"dailyRecurrence\": {\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 30\r\n },\r\n \"createdDate\": \"2024-11-01T10:40:40.5258457+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"ded7b75f-8f5d-4612-95a6-58fb694a5065\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmsshutdown\",\r\n \"name\": \"LabVmsShutdown\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 201 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "0b1f6471-1bf0-4dda-aec3-cb9272f09590" + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoStartPolicy.json b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoStartPolicy.json new file mode 100644 index 000000000000..5709d1cc3ec0 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoStartPolicy.json @@ -0,0 +1,452 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmAutoStart?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1BdXRvU3RhcnQ/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "4ddc8e54-3fa3-4b55-a917-b245475d937a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "aaff6bed-4f4e-4069-bfc1-0516198c74e6" + ], + "x-ms-correlation-request-id": [ + "aaff6bed-4f4e-4069-bfc1-0516198c74e6" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T032158Z:aaff6bed-4f4e-4069-bfc1-0516198c74e6" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 5051C1D4069B4897BAEA710BCFDEF0F8 Ref B: MAA201060514031 Ref C: 2024-11-11T03:21:57Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:21:57 GMT" + ], + "Content-Length": [ + "624" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Disabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"createdDate\": \"2024-11-01T11:11:43.3312844+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmautostart\",\r\n \"name\": \"LabVmAutoStart\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmAutoStart?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1BdXRvU3RhcnQ/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "1e1ea69a-d0c7-439e-bad9-33ec944bb819" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "f0e237b7-882c-427d-b0c9-fb00e2dcaa66" + ], + "x-ms-correlation-request-id": [ + "f0e237b7-882c-427d-b0c9-fb00e2dcaa66" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T032201Z:f0e237b7-882c-427d-b0c9-fb00e2dcaa66" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 00EF6D0B4CDD43DE9A4502C484B1709E Ref B: MAA201060513047 Ref C: 2024-11-11T03:22:00Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:22:01 GMT" + ], + "Content-Length": [ + "623" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"createdDate\": \"2024-11-01T11:11:43.3312844+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmautostart\",\r\n \"name\": \"LabVmAutoStart\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmAutoStart?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1BdXRvU3RhcnQ/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "f25a9c07-dfe5-4e80-9cfb-62f63beed59a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3748" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "248" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "1e49bafa-aa11-4ab8-94be-82183d7d8f30" + ], + "x-ms-correlation-request-id": [ + "1e49bafa-aa11-4ab8-94be-82183d7d8f30" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T032202Z:1e49bafa-aa11-4ab8-94be-82183d7d8f30" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 042F6E04C5A74250A15CCCA94AFD0E30 Ref B: MAA201060515019 Ref C: 2024-11-11T03:22:02Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:22:01 GMT" + ], + "Content-Length": [ + "623" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"createdDate\": \"2024-11-01T11:11:43.3312844+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmautostart\",\r\n \"name\": \"LabVmAutoStart\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmAutoStart?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1BdXRvU3RhcnQ/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "2af5f321-ca44-4c33-8996-4b5699ec97a2" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "d77d84a3-1d17-4114-a5e9-fc7f25ac80cd" + ], + "x-ms-correlation-request-id": [ + "d77d84a3-1d17-4114-a5e9-fc7f25ac80cd" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T032206Z:d77d84a3-1d17-4114-a5e9-fc7f25ac80cd" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 5E7C0A0CDA034800A014B921D1798FB7 Ref B: MAA201060516033 Ref C: 2024-11-11T03:22:05Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:22:06 GMT" + ], + "Content-Length": [ + "623" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"createdDate\": \"2024-11-01T11:11:43.3312844+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmautostart\",\r\n \"name\": \"LabVmAutoStart\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmAutoStart?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1BdXRvU3RhcnQ/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "PUT", + "RequestHeaders": { + "x-ms-client-request-id": [ + "4ddc8e54-3fa3-4b55-a917-b245475d937a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "482" + ] + }, + "RequestBody": "{\r\n \"properties\": {\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\"\r\n}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-writes": [ + "2999" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "199" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "37e0a746-39c3-452c-872c-09cf43464df8" + ], + "x-ms-correlation-request-id": [ + "37e0a746-39c3-452c-872c-09cf43464df8" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T032200Z:37e0a746-39c3-452c-872c-09cf43464df8" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: B5C2BE0859DB440E88440CE6FFB01069 Ref B: MAA201060514031 Ref C: 2024-11-11T03:21:58Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:21:59 GMT" + ], + "Content-Length": [ + "623" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"createdDate\": \"2024-11-01T11:11:43.3312844+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmautostart\",\r\n \"name\": \"LabVmAutoStart\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmAutoStart?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1BdXRvU3RhcnQ/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "PUT", + "RequestHeaders": { + "x-ms-client-request-id": [ + "f25a9c07-dfe5-4e80-9cfb-62f63beed59a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "482" + ] + }, + "RequestBody": "{\r\n \"properties\": {\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\"\r\n}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-writes": [ + "2999" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "199" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "5e86429d-b473-48db-ad18-928543b5bfb4" + ], + "x-ms-correlation-request-id": [ + "5e86429d-b473-48db-ad18-928543b5bfb4" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T032205Z:5e86429d-b473-48db-ad18-928543b5bfb4" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 62B531DA896E4F4695A16178A0051769 Ref B: MAA201060515019 Ref C: 2024-11-11T03:22:02Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:22:04 GMT" + ], + "Content-Length": [ + "623" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"createdDate\": \"2024-11-01T11:11:43.3312844+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmautostart\",\r\n \"name\": \"LabVmAutoStart\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 201 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "0b1f6471-1bf0-4dda-aec3-cb9272f09590" + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerLabPolicy.json b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerLabPolicy.json new file mode 100644 index 000000000000..07b688774498 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerLabPolicy.json @@ -0,0 +1,230 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/MaxVmsAllowedPerLab?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvTWF4Vm1zQWxsb3dlZFBlckxhYj9hcGktdmVyc2lvbj0yMDE2LTA1LTE1", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "3b664c13-5968-41e5-9d72-6cac0e054ebf" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-request-id": [ + "9e3fb57a-970d-4699-bb5e-7f061ef6e648" + ], + "x-ms-correlation-request-id": [ + "9e3fb57a-970d-4699-bb5e-7f061ef6e648" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033701Z:9e3fb57a-970d-4699-bb5e-7f061ef6e648" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: D521C054449A47E591E21E261602C4F9 Ref B: MAA201060514027 Ref C: 2024-11-01T03:37:00Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:37:00 GMT" + ], + "Content-Length": [ + "169" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"ResourceInGroupDoesNotExist\",\r\n \"message\": \"The resource 'onesdklab0111/default/MaxVmsAllowedPerLab' under resource group 'DTL-TestGroup' was not found.\"\r\n }\r\n}", + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/MaxVmsAllowedPerLab?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvTWF4Vm1zQWxsb3dlZFBlckxhYj9hcGktdmVyc2lvbj0yMDE2LTA1LTE1", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "be9832f8-810b-4d9d-81a0-f1046e8b7e20" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "2bb63946-45bc-4a4e-87fa-074ece018435" + ], + "x-ms-correlation-request-id": [ + "2bb63946-45bc-4a4e-87fa-074ece018435" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033704Z:2bb63946-45bc-4a4e-87fa-074ece018435" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: F037C67B80FA42B4BC8E49761D33B9E1 Ref B: MAA201060516023 Ref C: 2024-11-01T03:37:03Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:37:04 GMT" + ], + "Content-Length": [ + "486" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"LabVmCount\",\r\n \"threshold\": \"5\",\r\n \"evaluatorType\": \"MaxValuePolicy\",\r\n \"createdDate\": \"2024-11-01T11:37:02.7060624+08:00\",\r\n \"uniqueIdentifier\": \"cf89b591-e16d-445c-8589-7e2e66484ada\"\r\n },\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/policysets/default/policies/maxvmsallowedperlab\",\r\n \"name\": \"MaxVmsAllowedPerLab\",\r\n \"type\": \"Microsoft.DevTestLab/labs/policySets/policies\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/MaxVmsAllowedPerLab?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvTWF4Vm1zQWxsb3dlZFBlckxhYj9hcGktdmVyc2lvbj0yMDE2LTA1LTE1", + "RequestMethod": "PUT", + "RequestHeaders": { + "x-ms-client-request-id": [ + "3b664c13-5968-41e5-9d72-6cac0e054ebf" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "147" + ] + }, + "RequestBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"LabVmCount\",\r\n \"threshold\": \"5\",\r\n \"evaluatorType\": \"MaxValuePolicy\"\r\n }\r\n}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-writes": [ + "2999" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "199" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "e9a1f223-4bb8-47aa-b452-09ca31a5a033" + ], + "x-ms-correlation-request-id": [ + "e9a1f223-4bb8-47aa-b452-09ca31a5a033" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033703Z:e9a1f223-4bb8-47aa-b452-09ca31a5a033" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: CD8B5BFEC81F4AF2B43002B2C15CBEEA Ref B: MAA201060514027 Ref C: 2024-11-01T03:37:01Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:37:02 GMT" + ], + "Content-Length": [ + "486" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"LabVmCount\",\r\n \"threshold\": \"5\",\r\n \"evaluatorType\": \"MaxValuePolicy\",\r\n \"createdDate\": \"2024-11-01T11:37:02.7060624+08:00\",\r\n \"uniqueIdentifier\": \"cf89b591-e16d-445c-8589-7e2e66484ada\"\r\n },\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/policysets/default/policies/maxvmsallowedperlab\",\r\n \"name\": \"MaxVmsAllowedPerLab\",\r\n \"type\": \"Microsoft.DevTestLab/labs/policySets/policies\"\r\n}", + "StatusCode": 201 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "0b1f6471-1bf0-4dda-aec3-cb9272f09590" + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerUserPolicy.json b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerUserPolicy.json new file mode 100644 index 000000000000..2aaa0da70b0f --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerUserPolicy.json @@ -0,0 +1,230 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/MaxVmsAllowedPerUser?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvTWF4Vm1zQWxsb3dlZFBlclVzZXI/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "1471528a-aa3c-4579-b31f-e2d705dfc543" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-request-id": [ + "de642470-c5c3-498e-940f-f472ddd7248e" + ], + "x-ms-correlation-request-id": [ + "de642470-c5c3-498e-940f-f472ddd7248e" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033650Z:de642470-c5c3-498e-940f-f472ddd7248e" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 3FCC5D72433B416DA6E8EAC05044B6B6 Ref B: MAA201060515035 Ref C: 2024-11-01T03:36:49Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:36:49 GMT" + ], + "Content-Length": [ + "170" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"ResourceInGroupDoesNotExist\",\r\n \"message\": \"The resource 'onesdklab0111/default/MaxVmsAllowedPerUser' under resource group 'DTL-TestGroup' was not found.\"\r\n }\r\n}", + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/MaxVmsAllowedPerUser?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvTWF4Vm1zQWxsb3dlZFBlclVzZXI/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "821f4a5b-43a4-4971-8259-a4d2e4e906e1" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "f35675b0-a7eb-4790-83f8-2c53e7fa6591" + ], + "x-ms-correlation-request-id": [ + "f35675b0-a7eb-4790-83f8-2c53e7fa6591" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033653Z:f35675b0-a7eb-4790-83f8-2c53e7fa6591" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 34F06ACA3ED444D5BEC8C4D117AD9623 Ref B: MAA201060515017 Ref C: 2024-11-01T03:36:53Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:36:53 GMT" + ], + "Content-Length": [ + "497" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"UserOwnedLabVmCount\",\r\n \"threshold\": \"5\",\r\n \"evaluatorType\": \"MaxValuePolicy\",\r\n \"createdDate\": \"2024-11-01T11:36:52.1386267+08:00\",\r\n \"uniqueIdentifier\": \"ad8295e8-e847-45ef-83a2-168ab8c83789\"\r\n },\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/policysets/default/policies/maxvmsallowedperuser\",\r\n \"name\": \"MaxVmsAllowedPerUser\",\r\n \"type\": \"Microsoft.DevTestLab/labs/policySets/policies\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/MaxVmsAllowedPerUser?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvTWF4Vm1zQWxsb3dlZFBlclVzZXI/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "PUT", + "RequestHeaders": { + "x-ms-client-request-id": [ + "1471528a-aa3c-4579-b31f-e2d705dfc543" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "156" + ] + }, + "RequestBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"UserOwnedLabVmCount\",\r\n \"threshold\": \"5\",\r\n \"evaluatorType\": \"MaxValuePolicy\"\r\n }\r\n}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-writes": [ + "2999" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "199" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "307bdfda-0e96-41d6-8cc9-f78eda3d8633" + ], + "x-ms-correlation-request-id": [ + "307bdfda-0e96-41d6-8cc9-f78eda3d8633" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033652Z:307bdfda-0e96-41d6-8cc9-f78eda3d8633" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: C822483FA4E44867B3F993B67FD38CD9 Ref B: MAA201060515035 Ref C: 2024-11-01T03:36:50Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:36:52 GMT" + ], + "Content-Length": [ + "497" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"UserOwnedLabVmCount\",\r\n \"threshold\": \"5\",\r\n \"evaluatorType\": \"MaxValuePolicy\",\r\n \"createdDate\": \"2024-11-01T11:36:52.1386267+08:00\",\r\n \"uniqueIdentifier\": \"ad8295e8-e847-45ef-83a2-168ab8c83789\"\r\n },\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/policysets/default/policies/maxvmsallowedperuser\",\r\n \"name\": \"MaxVmsAllowedPerUser\",\r\n \"type\": \"Microsoft.DevTestLab/labs/policySets/policies\"\r\n}", + "StatusCode": 201 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "0b1f6471-1bf0-4dda-aec3-cb9272f09590" + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.sln b/src/DevTestLabs/DevTestLabs.sln index 6d9b1812a1a9..065bbfc48dd2 100644 --- a/src/DevTestLabs/DevTestLabs.sln +++ b/src/DevTestLabs/DevTestLabs.sln @@ -5,34 +5,33 @@ VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Accounts", "Accounts", "{3F69E5C5-71CF-4683-A9C8-53BA3A1A5DDF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{CEFF4657-4F89-46F5-8E72-F90173138BBA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{CEFF4657-4F89-46F5-8E72-F90173138BBA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{E903475C-3239-4E44-91C0-DBA7B39FB376}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{E903475C-3239-4E44-91C0-DBA7B39FB376}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{A8979AB2-A238-40CC-BEB2-89CEE302F440}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{A8979AB2-A238-40CC-BEB2-89CEE302F440}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{275B3E87-091D-4199-A437-EACC6D78921D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{275B3E87-091D-4199-A437-EACC6D78921D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{F2A68427-CD57-4A36-B602-21E00A01C731}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{F2A68427-CD57-4A36-B602-21E00A01C731}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{AA4EFB70-22FE-41C0-9179-6BF1422E7B0D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{AA4EFB70-22FE-41C0-9179-6BF1422E7B0D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{222F330A-327F-4122-AE98-B948918EF747}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevTestLabs.Test", "DevTestLabs.Test\DevTestLabs.Test.csproj", "{47D9666F-225C-469C-98F1-BF687A115975}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevTestLabs.Test", "DevTestLabs.Test\DevTestLabs.Test.csproj", "{47D9666F-225C-469C-98F1-BF687A115975}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevTestLabs", "DevTestLabs\DevTestLabs.csproj", "{F1CA7D35-9D66-4C8E-82C8-BD2AE52133D6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevTestLabs", "DevTestLabs\DevTestLabs.csproj", "{F1CA7D35-9D66-4C8E-82C8-BD2AE52133D6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{61354667-C9E3-45E3-9515-73060817E727}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{61354667-C9E3-45E3-9515-73060817E727}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevTestLabs.Management.Sdk", "DevTestLabs.Management.Sdk\DevTestLabs.Management.Sdk.csproj", "{DCDCCBEA-A385-4740-AD8A-217FF8C49E9B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {CEFF4657-4F89-46F5-8E72-F90173138BBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CEFF4657-4F89-46F5-8E72-F90173138BBA}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -70,6 +69,13 @@ Global {61354667-C9E3-45E3-9515-73060817E727}.Debug|Any CPU.Build.0 = Debug|Any CPU {61354667-C9E3-45E3-9515-73060817E727}.Release|Any CPU.ActiveCfg = Release|Any CPU {61354667-C9E3-45E3-9515-73060817E727}.Release|Any CPU.Build.0 = Release|Any CPU + {DCDCCBEA-A385-4740-AD8A-217FF8C49E9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DCDCCBEA-A385-4740-AD8A-217FF8C49E9B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DCDCCBEA-A385-4740-AD8A-217FF8C49E9B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DCDCCBEA-A385-4740-AD8A-217FF8C49E9B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {CEFF4657-4F89-46F5-8E72-F90173138BBA} = {3F69E5C5-71CF-4683-A9C8-53BA3A1A5DDF} @@ -79,7 +85,6 @@ Global {F2A68427-CD57-4A36-B602-21E00A01C731} = {3F69E5C5-71CF-4683-A9C8-53BA3A1A5DDF} {AA4EFB70-22FE-41C0-9179-6BF1422E7B0D} = {3F69E5C5-71CF-4683-A9C8-53BA3A1A5DDF} {47D9666F-225C-469C-98F1-BF687A115975} = {222F330A-327F-4122-AE98-B948918EF747} - {F1CA7D35-9D66-4C8E-82C8-BD2AE52133D6} = {222F330A-327F-4122-AE98-B948918EF747} {61354667-C9E3-45E3-9515-73060817E727} = {222F330A-327F-4122-AE98-B948918EF747} EndGlobalSection EndGlobal diff --git a/src/DevTestLabs/DevTestLabs/Az.DevTestLabs.psd1 b/src/DevTestLabs/DevTestLabs/Az.DevTestLabs.psd1 index abe1b3e78784..793b640add83 100644 --- a/src/DevTestLabs/DevTestLabs/Az.DevTestLabs.psd1 +++ b/src/DevTestLabs/DevTestLabs/Az.DevTestLabs.psd1 @@ -56,7 +56,7 @@ DotNetFrameworkVersion = '4.7.2' RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '3.0.0'; }) # Assemblies that must be loaded prior to importing this module -RequiredAssemblies = 'Microsoft.Azure.Management.DevTestLabs.dll' +RequiredAssemblies = 'Microsoft.Azure.PowerShell.DevTestLabs.Management.Sdk.dll' # Script files (.ps1) that are run in the caller's environment prior to importing this module. # ScriptsToProcess = @() diff --git a/src/DevTestLabs/DevTestLabs/ChangeLog.md b/src/DevTestLabs/DevTestLabs/ChangeLog.md index 278b331d3332..028f061a352c 100644 --- a/src/DevTestLabs/DevTestLabs/ChangeLog.md +++ b/src/DevTestLabs/DevTestLabs/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release +* Removed "Microsoft.Azure.Management.DevTestLabs" Version "1.0.0" PackageReference ## Version 1.0.3 * Removed the outdated deps.json file. diff --git a/src/DevTestLabs/DevTestLabs/DevTestLabs.csproj b/src/DevTestLabs/DevTestLabs/DevTestLabs.csproj index bfc412a1bd48..5fdd2648ae84 100644 --- a/src/DevTestLabs/DevTestLabs/DevTestLabs.csproj +++ b/src/DevTestLabs/DevTestLabs/DevTestLabs.csproj @@ -10,10 +10,10 @@ $(LegacyAssemblyPrefix)$(PsModuleName) + + - + - -