Skip to content

Commit 9abbd3e

Browse files
Gallery 2021-10-01 release (Azure#26658)
* generated with new version reference for gallery * re-geenerate with communityGallery and sharedGallery removed from new version * re-record tests * Gallery 10-01 sdk (Azure#25941) * save * add test for community gallery publishing * update * save (Azure#25940) * updated * add customization * fix, record tests * update version * re gen * update * Update GalleryApplicationVersion_CRUD_Tests.json Co-authored-by: kangsun-ctrl <[email protected]>
1 parent f17a8e0 commit 9abbd3e

File tree

47 files changed

+6260
-3377
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+6260
-3377
lines changed

eng/mgmt/mgmtmetadata/compute_resource-manager.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Autorest CSharp Version: 2.3.82
99
Azure-rest-api-specs repository information
1010
GitHub fork: Azure
1111
Branch: master
12-
Commit: c4a86872d4f2297597260c5968d2f50a0298db01
12+
Commit: 9673e2239f4f8257b2e916df2d15e1ef41c5bfd1
1313
AutoRest information
1414
Requested version: v2
1515
Bootstrapper version: [email protected]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<!--This file and it's contents are updated at build time moving or editing might result in build failure. Take due deligence while editing this file-->
33
<PropertyGroup>
4-
<AzureApiTag>Compute_2021-11-01;Compute_2021-08-01;Compute_2021-07-01;Compute_2021-04-01;Compute_2021-03-01;Compute_2020-12-01;Compute_2020-06-30;Compute_2020-05-01;Compute_2019-12-01;Compute_2019-11-01;Compute_2019-04-01;</AzureApiTag>
4+
<AzureApiTag>Compute_2021-11-01;Compute_2021-10-01;Compute_2021-08-01;Compute_2021-07-01;Compute_2021-04-01;Compute_2021-03-01;Compute_2020-12-01;Compute_2020-06-30;Compute_2020-05-01;Compute_2019-12-01;Compute_2019-11-01;Compute_2019-04-01;</AzureApiTag>
55
<PackageTags>$(PackageTags);$(CommonTags);$(AzureApiTag);</PackageTags>
66
</PropertyGroup>
77
</Project>

sdk/compute/Microsoft.Azure.Management.Compute/src/Customizations/GalleriesOperations.cs

Lines changed: 169 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,174 @@
1717
/// </summary>
1818
internal partial class GalleriesOperations : IServiceOperations<ComputeManagementClient>, IGalleriesOperations
1919
{
20+
public async Task<AzureOperationResponse<Gallery>> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, string select, Dictionary<string, List<string>> customHeaders, CancellationToken cancellationToken = default(CancellationToken))
21+
{
22+
if (Client.SubscriptionId == null)
23+
{
24+
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
25+
}
26+
if (resourceGroupName == null)
27+
{
28+
throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
29+
}
30+
if (galleryName == null)
31+
{
32+
throw new ValidationException(ValidationRules.CannotBeNull, "galleryName");
33+
}
34+
string apiVersion = "2021-10-01";
35+
// Tracing
36+
bool _shouldTrace = ServiceClientTracing.IsEnabled;
37+
string _invocationId = null;
38+
if (_shouldTrace)
39+
{
40+
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
41+
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
42+
tracingParameters.Add("resourceGroupName", resourceGroupName);
43+
tracingParameters.Add("galleryName", galleryName);
44+
tracingParameters.Add("apiVersion", apiVersion);
45+
tracingParameters.Add("select", select);
46+
tracingParameters.Add("cancellationToken", cancellationToken);
47+
ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
48+
}
49+
// Construct URL
50+
var _baseUrl = Client.BaseUri.AbsoluteUri;
51+
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}").ToString();
52+
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
53+
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
54+
_url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName));
55+
List<string> _queryParameters = new List<string>();
56+
if (apiVersion != null)
57+
{
58+
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
59+
}
60+
if (select != null)
61+
{
62+
_queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(select)));
63+
}
64+
if (_queryParameters.Count > 0)
65+
{
66+
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
67+
}
68+
// Create HTTP transport objects
69+
var _httpRequest = new HttpRequestMessage();
70+
HttpResponseMessage _httpResponse = null;
71+
_httpRequest.Method = new HttpMethod("GET");
72+
_httpRequest.RequestUri = new System.Uri(_url);
73+
// Set Headers
74+
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
75+
{
76+
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
77+
}
78+
if (Client.AcceptLanguage != null)
79+
{
80+
if (_httpRequest.Headers.Contains("accept-language"))
81+
{
82+
_httpRequest.Headers.Remove("accept-language");
83+
}
84+
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
85+
}
86+
87+
88+
if (customHeaders != null)
89+
{
90+
foreach (var _header in customHeaders)
91+
{
92+
if (_httpRequest.Headers.Contains(_header.Key))
93+
{
94+
_httpRequest.Headers.Remove(_header.Key);
95+
}
96+
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
97+
}
98+
}
99+
100+
// Serialize Request
101+
string _requestContent = null;
102+
// Set Credentials
103+
if (Client.Credentials != null)
104+
{
105+
cancellationToken.ThrowIfCancellationRequested();
106+
await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
107+
}
108+
// Send Request
109+
if (_shouldTrace)
110+
{
111+
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
112+
}
113+
cancellationToken.ThrowIfCancellationRequested();
114+
_httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
115+
if (_shouldTrace)
116+
{
117+
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
118+
}
119+
HttpStatusCode _statusCode = _httpResponse.StatusCode;
120+
cancellationToken.ThrowIfCancellationRequested();
121+
string _responseContent = null;
122+
if ((int)_statusCode != 200)
123+
{
124+
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
125+
try
126+
{
127+
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
128+
CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, Client.DeserializationSettings);
129+
if (_errorBody != null)
130+
{
131+
ex = new CloudException(_errorBody.Message);
132+
ex.Body = _errorBody;
133+
}
134+
}
135+
catch (JsonException)
136+
{
137+
// Ignore the exception
138+
}
139+
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
140+
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
141+
if (_httpResponse.Headers.Contains("x-ms-request-id"))
142+
{
143+
ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
144+
}
145+
if (_shouldTrace)
146+
{
147+
ServiceClientTracing.Error(_invocationId, ex);
148+
}
149+
_httpRequest.Dispose();
150+
if (_httpResponse != null)
151+
{
152+
_httpResponse.Dispose();
153+
}
154+
throw ex;
155+
}
156+
// Create Result
157+
var _result = new AzureOperationResponse<Gallery>();
158+
_result.Request = _httpRequest;
159+
_result.Response = _httpResponse;
160+
if (_httpResponse.Headers.Contains("x-ms-request-id"))
161+
{
162+
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
163+
}
164+
// Deserialize Response
165+
if ((int)_statusCode == 200)
166+
{
167+
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
168+
try
169+
{
170+
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Gallery>(_responseContent, Client.DeserializationSettings);
171+
}
172+
catch (JsonException ex)
173+
{
174+
_httpRequest.Dispose();
175+
if (_httpResponse != null)
176+
{
177+
_httpResponse.Dispose();
178+
}
179+
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
180+
}
181+
}
182+
if (_shouldTrace)
183+
{
184+
ServiceClientTracing.Exit(_invocationId, _result);
185+
}
186+
return _result;
187+
}
20188
/// <summary>
21189
/// Retrieves information about a Shared Image Gallery.
22190
/// </summary>
@@ -113,4 +281,4 @@ public async Task<AzureOperationResponse<Gallery>> GetWithHttpMessagesAsync(stri
113281
return await GetWithHttpMessagesAsync(resourceGroupName, galleryName, default(string), customHeaders, cancellationToken);
114282
}
115283
}
116-
}
284+
}

sdk/compute/Microsoft.Azure.Management.Compute/src/Customizations/GalleriesOperationsExtensions.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
/// </summary>
1212
public static partial class GalleriesOperationsExtensions
1313
{
14+
public static async Task<Gallery> GetAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName, string select, CancellationToken cancellationToken)
15+
{
16+
using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, galleryName, select, null, cancellationToken).ConfigureAwait(false))
17+
{
18+
return _result.Body;
19+
}
20+
}
1421
/// <summary>
1522
/// Retrieves information about a Shared Image Gallery.
1623
/// </summary>
@@ -48,4 +55,4 @@ public static async Task<Gallery> GetAsync(this IGalleriesOperations operations,
4855
return await GetAsync(operations, resourceGroupName, galleryName, default(string), cancellationToken);
4956
}
5057
}
51-
}
58+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
namespace Microsoft.Azure.Management.Compute.Models
2+
{
3+
using Microsoft.Rest;
4+
using Newtonsoft.Json;
5+
using System.Collections;
6+
using System.Collections.Generic;
7+
using System.Linq;
8+
9+
/// <summary>
10+
/// The publishing profile of a gallery image version.
11+
/// </summary>
12+
public partial class GalleryApplicationVersionPublishingProfile : GalleryArtifactPublishingProfileBase
13+
{
14+
public GalleryApplicationVersionPublishingProfile(UserArtifactSource source, IList<TargetRegion> targetRegions, int? replicaCount, bool? excludeFromLatest, System.DateTime? publishedDate, System.DateTime? endOfLifeDate, string storageAccountType, string replicationMode, UserArtifactManage manageActions, bool? enableHealthCheck = default(bool?))
15+
: base(targetRegions, replicaCount, excludeFromLatest, publishedDate, endOfLifeDate, storageAccountType, replicationMode)
16+
{
17+
Source = source;
18+
ManageActions = manageActions;
19+
EnableHealthCheck = enableHealthCheck;
20+
CustomInit();
21+
}
22+
}
23+
}

sdk/compute/Microsoft.Azure.Management.Compute/src/Customizations/IGalleriesOperations.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
/// </summary>
1414
public partial interface IGalleriesOperations
1515
{
16+
Task<AzureOperationResponse<Gallery>> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, string select, Dictionary<string, List<string>> customHeaders, CancellationToken cancellationToken = default(CancellationToken));
1617
/// <summary>
1718
/// Retrieves information about a Shared Image Gallery.
1819
/// </summary>

sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleriesOperations.cs

Lines changed: 16 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/GalleriesOperationsExtensions.cs

Lines changed: 12 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)