diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CommunityGalleriesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CommunityGalleriesOperations.cs new file mode 100644 index 000000000000..ac43187831e3 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CommunityGalleriesOperations.cs @@ -0,0 +1,248 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CommunityGalleriesOperations operations. + /// + internal partial class CommunityGalleriesOperations : IServiceOperations, ICommunityGalleriesOperations + { + /// + /// Initializes a new instance of the CommunityGalleriesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CommunityGalleriesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Get a community gallery by gallery public name. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string location, string publicGalleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publicGalleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publicGalleryName"); + } + string apiVersion = "2021-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("publicGalleryName", publicGalleryName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publicGalleryName}", System.Uri.EscapeDataString(publicGalleryName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CommunityGalleriesOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CommunityGalleriesOperationsExtensions.cs new file mode 100644 index 000000000000..c36d2a2c4d75 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CommunityGalleriesOperationsExtensions.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CommunityGalleriesOperations. + /// + public static partial class CommunityGalleriesOperationsExtensions + { + /// + /// Get a community gallery by gallery public name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + public static CommunityGallery Get(this ICommunityGalleriesOperations operations, string location, string publicGalleryName) + { + return operations.GetAsync(location, publicGalleryName).GetAwaiter().GetResult(); + } + + /// + /// Get a community gallery by gallery public name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICommunityGalleriesOperations operations, string location, string publicGalleryName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, publicGalleryName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CommunityGalleryImageVersionsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CommunityGalleryImageVersionsOperations.cs new file mode 100644 index 000000000000..7bd7b869fe9d --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CommunityGalleryImageVersionsOperations.cs @@ -0,0 +1,269 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CommunityGalleryImageVersionsOperations operations. + /// + internal partial class CommunityGalleryImageVersionsOperations : IServiceOperations, ICommunityGalleryImageVersionsOperations + { + /// + /// Initializes a new instance of the CommunityGalleryImageVersionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CommunityGalleryImageVersionsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Get a community gallery image version. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + /// + /// The name of the community gallery image version. Needs to follow semantic + /// version name pattern: The allowed characters are digit and period. Digits + /// must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string location, string publicGalleryName, string galleryImageName, string galleryImageVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publicGalleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publicGalleryName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + if (galleryImageVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageVersionName"); + } + string apiVersion = "2021-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("publicGalleryName", publicGalleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("galleryImageVersionName", galleryImageVersionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publicGalleryName}", System.Uri.EscapeDataString(publicGalleryName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + _url = _url.Replace("{galleryImageVersionName}", System.Uri.EscapeDataString(galleryImageVersionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CommunityGalleryImageVersionsOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CommunityGalleryImageVersionsOperationsExtensions.cs new file mode 100644 index 000000000000..4cea2f7d90c2 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CommunityGalleryImageVersionsOperationsExtensions.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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CommunityGalleryImageVersionsOperations. + /// + public static partial class CommunityGalleryImageVersionsOperationsExtensions + { + /// + /// Get a community gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + /// + /// The name of the community gallery image version. Needs to follow semantic + /// version name pattern: The allowed characters are digit and period. Digits + /// must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + public static CommunityGalleryImageVersion Get(this ICommunityGalleryImageVersionsOperations operations, string location, string publicGalleryName, string galleryImageName, string galleryImageVersionName) + { + return operations.GetAsync(location, publicGalleryName, galleryImageName, galleryImageVersionName).GetAwaiter().GetResult(); + } + + /// + /// Get a community gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + /// + /// The name of the community gallery image version. Needs to follow semantic + /// version name pattern: The allowed characters are digit and period. Digits + /// must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICommunityGalleryImageVersionsOperations operations, string location, string publicGalleryName, string galleryImageName, string galleryImageVersionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, publicGalleryName, galleryImageName, galleryImageVersionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CommunityGalleryImagesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CommunityGalleryImagesOperations.cs new file mode 100644 index 000000000000..92b4975e26bb --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CommunityGalleryImagesOperations.cs @@ -0,0 +1,257 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CommunityGalleryImagesOperations operations. + /// + internal partial class CommunityGalleryImagesOperations : IServiceOperations, ICommunityGalleryImagesOperations + { + /// + /// Initializes a new instance of the CommunityGalleryImagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CommunityGalleryImagesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Get a community gallery image. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string location, string publicGalleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publicGalleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publicGalleryName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + string apiVersion = "2021-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("publicGalleryName", publicGalleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publicGalleryName}", System.Uri.EscapeDataString(publicGalleryName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CommunityGalleryImagesOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CommunityGalleryImagesOperationsExtensions.cs new file mode 100644 index 000000000000..a70d9b2410b0 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/CommunityGalleryImagesOperationsExtensions.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CommunityGalleryImagesOperations. + /// + public static partial class CommunityGalleryImagesOperationsExtensions + { + /// + /// Get a community gallery image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + public static CommunityGalleryImage Get(this ICommunityGalleryImagesOperations operations, string location, string publicGalleryName, string galleryImageName) + { + return operations.GetAsync(location, publicGalleryName, galleryImageName).GetAwaiter().GetResult(); + } + + /// + /// Get a community gallery image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICommunityGalleryImagesOperations operations, string location, string publicGalleryName, string galleryImageName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, publicGalleryName, galleryImageName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs index 548d1c3624f4..4fe5ed4724a9 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs @@ -276,6 +276,21 @@ public partial class ComputeManagementClient : ServiceClient public virtual ISharedGalleryImageVersionsOperations SharedGalleryImageVersions { get; private set; } + /// + /// Gets the ICommunityGalleriesOperations. + /// + public virtual ICommunityGalleriesOperations CommunityGalleries { get; private set; } + + /// + /// Gets the ICommunityGalleryImagesOperations. + /// + public virtual ICommunityGalleryImagesOperations CommunityGalleryImages { get; private set; } + + /// + /// Gets the ICommunityGalleryImageVersionsOperations. + /// + public virtual ICommunityGalleryImageVersionsOperations CommunityGalleryImageVersions { get; private set; } + /// /// Gets the ICloudServiceRoleInstancesOperations. /// @@ -583,6 +598,9 @@ private void Initialize() SharedGalleries = new SharedGalleriesOperations(this); SharedGalleryImages = new SharedGalleryImagesOperations(this); SharedGalleryImageVersions = new SharedGalleryImageVersionsOperations(this); + CommunityGalleries = new CommunityGalleriesOperations(this); + CommunityGalleryImages = new CommunityGalleryImagesOperations(this); + CommunityGalleryImageVersions = new CommunityGalleryImageVersionsOperations(this); CloudServiceRoleInstances = new CloudServiceRoleInstancesOperations(this); CloudServiceRoles = new CloudServiceRolesOperations(this); CloudServices = new CloudServicesOperations(this); diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICommunityGalleriesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICommunityGalleriesOperations.cs new file mode 100644 index 000000000000..39f3cbf24f5a --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICommunityGalleriesOperations.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CommunityGalleriesOperations operations. + /// + public partial interface ICommunityGalleriesOperations + { + /// + /// Get a community gallery by gallery public name. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string location, string publicGalleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICommunityGalleryImageVersionsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICommunityGalleryImageVersionsOperations.cs new file mode 100644 index 000000000000..99c4df517559 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICommunityGalleryImageVersionsOperations.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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CommunityGalleryImageVersionsOperations operations. + /// + public partial interface ICommunityGalleryImageVersionsOperations + { + /// + /// Get a community gallery image version. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + /// + /// The name of the community gallery image version. Needs to follow + /// semantic version name pattern: The allowed characters are digit and + /// period. Digits must be within the range of a 32-bit integer. + /// Format: <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string location, string publicGalleryName, string galleryImageName, string galleryImageVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICommunityGalleryImagesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICommunityGalleryImagesOperations.cs new file mode 100644 index 000000000000..993e9e375d07 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ICommunityGalleryImagesOperations.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.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CommunityGalleryImagesOperations operations. + /// + public partial interface ICommunityGalleryImagesOperations + { + /// + /// Get a community gallery image. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string location, string publicGalleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs index a842414c19b4..f1535dd14c3b 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs @@ -271,6 +271,21 @@ public partial interface IComputeManagementClient : System.IDisposable /// ISharedGalleryImageVersionsOperations SharedGalleryImageVersions { get; } + /// + /// Gets the ICommunityGalleriesOperations. + /// + ICommunityGalleriesOperations CommunityGalleries { get; } + + /// + /// Gets the ICommunityGalleryImagesOperations. + /// + ICommunityGalleryImagesOperations CommunityGalleryImages { get; } + + /// + /// Gets the ICommunityGalleryImageVersionsOperations. + /// + ICommunityGalleryImageVersionsOperations CommunityGalleryImageVersions { get; } + /// /// Gets the ICloudServiceRoleInstancesOperations. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CommunityGallery.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CommunityGallery.cs new file mode 100644 index 000000000000..a3825c10e60c --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CommunityGallery.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.Compute.Models +{ + using System.Linq; + + /// + /// Specifies information about the Community Gallery that you want to + /// create or update. + /// + public partial class CommunityGallery : PirCommunityGalleryResource + { + /// + /// Initializes a new instance of the CommunityGallery class. + /// + public CommunityGallery() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CommunityGallery class. + /// + /// Resource name + /// Resource location + /// Resource type + /// The unique id of this community + /// gallery. + public CommunityGallery(string name = default(string), string location = default(string), string type = default(string), string uniqueId = default(string)) + : base(name, location, type, uniqueId) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CommunityGalleryImage.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CommunityGalleryImage.cs new file mode 100644 index 000000000000..b49166210b46 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CommunityGalleryImage.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.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the gallery image definition that you want + /// to create or update. + /// + [Rest.Serialization.JsonTransformation] + public partial class CommunityGalleryImage : PirCommunityGalleryResource + { + /// + /// Initializes a new instance of the CommunityGalleryImage class. + /// + public CommunityGalleryImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CommunityGalleryImage class. + /// + /// This property allows you to specify the type + /// of the OS that is included in the disk when creating a VM from a + /// managed image. <br><br> Possible values are: + /// <br><br> **Windows** <br><br> **Linux**. + /// Possible values include: 'Windows', 'Linux' + /// This property allows the user to specify + /// whether the virtual machines created under this image are + /// 'Generalized' or 'Specialized'. Possible values include: + /// 'Generalized', 'Specialized' + /// Resource name + /// Resource location + /// Resource type + /// The unique id of this community + /// gallery. + /// The end of life date of the gallery + /// image definition. This property can be used for decommissioning + /// purposes. This property is updatable. + /// The hypervisor generation of the + /// Virtual Machine. Applicable to OS disks only. Possible values + /// include: 'V1', 'V2' + /// A list of gallery image features. + public CommunityGalleryImage(OperatingSystemTypes osType, OperatingSystemStateTypes osState, GalleryImageIdentifier identifier, string name = default(string), string location = default(string), string type = default(string), string uniqueId = default(string), System.DateTime? endOfLifeDate = default(System.DateTime?), RecommendedMachineConfiguration recommended = default(RecommendedMachineConfiguration), Disallowed disallowed = default(Disallowed), string hyperVGeneration = default(string), IList features = default(IList), ImagePurchasePlan purchasePlan = default(ImagePurchasePlan)) + : base(name, location, type, uniqueId) + { + OsType = osType; + OsState = osState; + EndOfLifeDate = endOfLifeDate; + Identifier = identifier; + Recommended = recommended; + Disallowed = disallowed; + HyperVGeneration = hyperVGeneration; + Features = features; + PurchasePlan = purchasePlan; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this property allows you to specify the type of the OS + /// that is included in the disk when creating a VM from a managed + /// image. &lt;br&gt;&lt;br&gt; Possible values are: + /// &lt;br&gt;&lt;br&gt; **Windows** + /// &lt;br&gt;&lt;br&gt; **Linux**. Possible values + /// include: 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "properties.osType")] + public OperatingSystemTypes OsType { get; set; } + + /// + /// Gets or sets this property allows the user to specify whether the + /// virtual machines created under this image are 'Generalized' or + /// 'Specialized'. Possible values include: 'Generalized', + /// 'Specialized' + /// + [JsonProperty(PropertyName = "properties.osState")] + public OperatingSystemStateTypes OsState { get; set; } + + /// + /// Gets or sets the end of life date of the gallery image definition. + /// This property can be used for decommissioning purposes. This + /// property is updatable. + /// + [JsonProperty(PropertyName = "properties.endOfLifeDate")] + public System.DateTime? EndOfLifeDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.identifier")] + public GalleryImageIdentifier Identifier { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.recommended")] + public RecommendedMachineConfiguration Recommended { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.disallowed")] + public Disallowed Disallowed { get; set; } + + /// + /// Gets or sets the hypervisor generation of the Virtual Machine. + /// Applicable to OS disks only. Possible values include: 'V1', 'V2' + /// + [JsonProperty(PropertyName = "properties.hyperVGeneration")] + public string HyperVGeneration { get; set; } + + /// + /// Gets or sets a list of gallery image features. + /// + [JsonProperty(PropertyName = "properties.features")] + public IList Features { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.purchasePlan")] + public ImagePurchasePlan PurchasePlan { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Identifier == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Identifier"); + } + if (Identifier != null) + { + Identifier.Validate(); + } + } + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CommunityGalleryImageVersion.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CommunityGalleryImageVersion.cs new file mode 100644 index 000000000000..9c14ff8ce3f5 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/CommunityGalleryImageVersion.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.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies information about the gallery image version that you want to + /// create or update. + /// + [Rest.Serialization.JsonTransformation] + public partial class CommunityGalleryImageVersion : PirCommunityGalleryResource + { + /// + /// Initializes a new instance of the CommunityGalleryImageVersion + /// class. + /// + public CommunityGalleryImageVersion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CommunityGalleryImageVersion + /// class. + /// + /// Resource name + /// Resource location + /// Resource type + /// The unique id of this community + /// gallery. + /// The published date of the gallery image + /// version Definition. This property can be used for decommissioning + /// purposes. This property is updatable. + /// The end of life date of the gallery + /// image version Definition. This property can be used for + /// decommissioning purposes. This property is updatable. + public CommunityGalleryImageVersion(string name = default(string), string location = default(string), string type = default(string), string uniqueId = default(string), System.DateTime? publishedDate = default(System.DateTime?), System.DateTime? endOfLifeDate = default(System.DateTime?)) + : base(name, location, type, uniqueId) + { + PublishedDate = publishedDate; + EndOfLifeDate = endOfLifeDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the published date of the gallery image version + /// Definition. This property can be used for decommissioning purposes. + /// This property is updatable. + /// + [JsonProperty(PropertyName = "properties.publishedDate")] + public System.DateTime? PublishedDate { get; set; } + + /// + /// Gets or sets the end of life date of the gallery image version + /// Definition. This property can be used for decommissioning purposes. + /// This property is updatable. + /// + [JsonProperty(PropertyName = "properties.endOfLifeDate")] + public System.DateTime? EndOfLifeDate { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PirCommunityGalleryResource.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PirCommunityGalleryResource.cs new file mode 100644 index 000000000000..cf1467acdc28 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/PirCommunityGalleryResource.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Base information about the community gallery resource in pir. + /// + [Rest.Serialization.JsonTransformation] + public partial class PirCommunityGalleryResource + { + /// + /// Initializes a new instance of the PirCommunityGalleryResource + /// class. + /// + public PirCommunityGalleryResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PirCommunityGalleryResource + /// class. + /// + /// Resource name + /// Resource location + /// Resource type + /// The unique id of this community + /// gallery. + public PirCommunityGalleryResource(string name = default(string), string location = default(string), string type = default(string), string uniqueId = default(string)) + { + Name = name; + Location = location; + Type = type; + UniqueId = uniqueId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource location + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets the unique id of this community gallery. + /// + [JsonProperty(PropertyName = "identifier.uniqueId")] + public string UniqueId { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs index c1379cf7cfbe..648f482474ba 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs @@ -27,6 +27,9 @@ public static IEnumerable> ApiInfo_ComputeManageme new Tuple("Compute", "CloudServiceRoles", "2021-03-01"), new Tuple("Compute", "CloudServices", "2021-03-01"), new Tuple("Compute", "CloudServicesUpdateDomain", "2021-03-01"), + new Tuple("Compute", "CommunityGalleries", "2021-07-01"), + new Tuple("Compute", "CommunityGalleryImageVersions", "2021-07-01"), + new Tuple("Compute", "CommunityGalleryImages", "2021-07-01"), new Tuple("Compute", "DedicatedHostGroups", "2021-07-01"), new Tuple("Compute", "DedicatedHosts", "2021-07-01"), new Tuple("Compute", "DiskAccesses", "2021-04-01"), @@ -68,16 +71,5 @@ public static IEnumerable> ApiInfo_ComputeManageme }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/compute/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\work\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "92b58eb71fd5eb2ce5600e9233541074ecabf851"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -