| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System; |
| | 9 | | using System.Text.Json; |
| | 10 | | using System.Threading; |
| | 11 | | using System.Threading.Tasks; |
| | 12 | | using Azure; |
| | 13 | | using Azure.Core; |
| | 14 | | using Azure.Core.Pipeline; |
| | 15 | | using Azure.ResourceManager.Compute.Models; |
| | 16 | |
|
| | 17 | | namespace Azure.ResourceManager.Compute |
| | 18 | | { |
| | 19 | | internal partial class GalleryApplicationsRestOperations |
| | 20 | | { |
| | 21 | | private string subscriptionId; |
| | 22 | | private Uri endpoint; |
| | 23 | | private ClientDiagnostics _clientDiagnostics; |
| | 24 | | private HttpPipeline _pipeline; |
| | 25 | |
|
| | 26 | | /// <summary> Initializes a new instance of GalleryApplicationsRestOperations. </summary> |
| | 27 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 28 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 29 | | /// <param name="subscriptionId"> Subscription credentials which uniquely identify Microsoft Azure subscription. |
| | 30 | | /// <param name="endpoint"> server parameter. </param> |
| | 31 | | /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception |
| 396 | 32 | | public GalleryApplicationsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subs |
| | 33 | | { |
| 396 | 34 | | if (subscriptionId == null) |
| | 35 | | { |
| 0 | 36 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 37 | | } |
| 396 | 38 | | endpoint ??= new Uri("https://management.azure.com"); |
| | 39 | |
|
| 396 | 40 | | this.subscriptionId = subscriptionId; |
| 396 | 41 | | this.endpoint = endpoint; |
| 396 | 42 | | _clientDiagnostics = clientDiagnostics; |
| 396 | 43 | | _pipeline = pipeline; |
| 396 | 44 | | } |
| | 45 | |
|
| | 46 | | internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string galleryName, string galleryApp |
| | 47 | | { |
| 16 | 48 | | var message = _pipeline.CreateMessage(); |
| 16 | 49 | | var request = message.Request; |
| 16 | 50 | | request.Method = RequestMethod.Put; |
| 16 | 51 | | var uri = new RawRequestUriBuilder(); |
| 16 | 52 | | uri.Reset(endpoint); |
| 16 | 53 | | uri.AppendPath("/subscriptions/", false); |
| 16 | 54 | | uri.AppendPath(subscriptionId, true); |
| 16 | 55 | | uri.AppendPath("/resourceGroups/", false); |
| 16 | 56 | | uri.AppendPath(resourceGroupName, true); |
| 16 | 57 | | uri.AppendPath("/providers/Microsoft.Compute/galleries/", false); |
| 16 | 58 | | uri.AppendPath(galleryName, true); |
| 16 | 59 | | uri.AppendPath("/applications/", false); |
| 16 | 60 | | uri.AppendPath(galleryApplicationName, true); |
| 16 | 61 | | uri.AppendQuery("api-version", "2019-12-01", true); |
| 16 | 62 | | request.Uri = uri; |
| 16 | 63 | | request.Headers.Add("Content-Type", "application/json"); |
| 16 | 64 | | var content = new Utf8JsonRequestContent(); |
| 16 | 65 | | content.JsonWriter.WriteObjectValue(galleryApplication); |
| 16 | 66 | | request.Content = content; |
| 16 | 67 | | return message; |
| | 68 | | } |
| | 69 | |
|
| | 70 | | /// <summary> Create or update a gallery Application Definition. </summary> |
| | 71 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 72 | | /// <param name="galleryName"> The name of the Shared Application Gallery in which the Application Definition is |
| | 73 | | /// <param name="galleryApplicationName"> The name of the gallery Application Definition to be created or update |
| | 74 | | /// <param name="galleryApplication"> Parameters supplied to the create or update gallery Application operation. |
| | 75 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 76 | | public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string galleryName, string galleryAppl |
| | 77 | | { |
| 4 | 78 | | if (resourceGroupName == null) |
| | 79 | | { |
| 0 | 80 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 81 | | } |
| 4 | 82 | | if (galleryName == null) |
| | 83 | | { |
| 0 | 84 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 85 | | } |
| 4 | 86 | | if (galleryApplicationName == null) |
| | 87 | | { |
| 0 | 88 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | 89 | | } |
| 4 | 90 | | if (galleryApplication == null) |
| | 91 | | { |
| 0 | 92 | | throw new ArgumentNullException(nameof(galleryApplication)); |
| | 93 | | } |
| | 94 | |
|
| 4 | 95 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, galleryName, galleryApplicationName, gall |
| 4 | 96 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 4 | 97 | | switch (message.Response.Status) |
| | 98 | | { |
| | 99 | | case 200: |
| | 100 | | case 201: |
| | 101 | | case 202: |
| 4 | 102 | | return message.Response; |
| | 103 | | default: |
| 0 | 104 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 105 | | } |
| 4 | 106 | | } |
| | 107 | |
|
| | 108 | | /// <summary> Create or update a gallery Application Definition. </summary> |
| | 109 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 110 | | /// <param name="galleryName"> The name of the Shared Application Gallery in which the Application Definition is |
| | 111 | | /// <param name="galleryApplicationName"> The name of the gallery Application Definition to be created or update |
| | 112 | | /// <param name="galleryApplication"> Parameters supplied to the create or update gallery Application operation. |
| | 113 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 114 | | public Response CreateOrUpdate(string resourceGroupName, string galleryName, string galleryApplicationName, Gall |
| | 115 | | { |
| 4 | 116 | | if (resourceGroupName == null) |
| | 117 | | { |
| 0 | 118 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 119 | | } |
| 4 | 120 | | if (galleryName == null) |
| | 121 | | { |
| 0 | 122 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 123 | | } |
| 4 | 124 | | if (galleryApplicationName == null) |
| | 125 | | { |
| 0 | 126 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | 127 | | } |
| 4 | 128 | | if (galleryApplication == null) |
| | 129 | | { |
| 0 | 130 | | throw new ArgumentNullException(nameof(galleryApplication)); |
| | 131 | | } |
| | 132 | |
|
| 4 | 133 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, galleryName, galleryApplicationName, gall |
| 4 | 134 | | _pipeline.Send(message, cancellationToken); |
| 4 | 135 | | switch (message.Response.Status) |
| | 136 | | { |
| | 137 | | case 200: |
| | 138 | | case 201: |
| | 139 | | case 202: |
| 4 | 140 | | return message.Response; |
| | 141 | | default: |
| 0 | 142 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 143 | | } |
| 4 | 144 | | } |
| | 145 | |
|
| | 146 | | internal HttpMessage CreateUpdateRequest(string resourceGroupName, string galleryName, string galleryApplication |
| | 147 | | { |
| 0 | 148 | | var message = _pipeline.CreateMessage(); |
| 0 | 149 | | var request = message.Request; |
| 0 | 150 | | request.Method = RequestMethod.Patch; |
| 0 | 151 | | var uri = new RawRequestUriBuilder(); |
| 0 | 152 | | uri.Reset(endpoint); |
| 0 | 153 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 154 | | uri.AppendPath(subscriptionId, true); |
| 0 | 155 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 156 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 157 | | uri.AppendPath("/providers/Microsoft.Compute/galleries/", false); |
| 0 | 158 | | uri.AppendPath(galleryName, true); |
| 0 | 159 | | uri.AppendPath("/applications/", false); |
| 0 | 160 | | uri.AppendPath(galleryApplicationName, true); |
| 0 | 161 | | uri.AppendQuery("api-version", "2019-12-01", true); |
| 0 | 162 | | request.Uri = uri; |
| 0 | 163 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 164 | | var content = new Utf8JsonRequestContent(); |
| 0 | 165 | | content.JsonWriter.WriteObjectValue(galleryApplication); |
| 0 | 166 | | request.Content = content; |
| 0 | 167 | | return message; |
| | 168 | | } |
| | 169 | |
|
| | 170 | | /// <summary> Update a gallery Application Definition. </summary> |
| | 171 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 172 | | /// <param name="galleryName"> The name of the Shared Application Gallery in which the Application Definition is |
| | 173 | | /// <param name="galleryApplicationName"> The name of the gallery Application Definition to be updated. The allo |
| | 174 | | /// <param name="galleryApplication"> Parameters supplied to the update gallery Application operation. </param> |
| | 175 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 176 | | public async Task<Response> UpdateAsync(string resourceGroupName, string galleryName, string galleryApplicationN |
| | 177 | | { |
| 0 | 178 | | if (resourceGroupName == null) |
| | 179 | | { |
| 0 | 180 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 181 | | } |
| 0 | 182 | | if (galleryName == null) |
| | 183 | | { |
| 0 | 184 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 185 | | } |
| 0 | 186 | | if (galleryApplicationName == null) |
| | 187 | | { |
| 0 | 188 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | 189 | | } |
| 0 | 190 | | if (galleryApplication == null) |
| | 191 | | { |
| 0 | 192 | | throw new ArgumentNullException(nameof(galleryApplication)); |
| | 193 | | } |
| | 194 | |
|
| 0 | 195 | | using var message = CreateUpdateRequest(resourceGroupName, galleryName, galleryApplicationName, galleryAppli |
| 0 | 196 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 197 | | switch (message.Response.Status) |
| | 198 | | { |
| | 199 | | case 200: |
| 0 | 200 | | return message.Response; |
| | 201 | | default: |
| 0 | 202 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 203 | | } |
| 0 | 204 | | } |
| | 205 | |
|
| | 206 | | /// <summary> Update a gallery Application Definition. </summary> |
| | 207 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 208 | | /// <param name="galleryName"> The name of the Shared Application Gallery in which the Application Definition is |
| | 209 | | /// <param name="galleryApplicationName"> The name of the gallery Application Definition to be updated. The allo |
| | 210 | | /// <param name="galleryApplication"> Parameters supplied to the update gallery Application operation. </param> |
| | 211 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 212 | | public Response Update(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryAppli |
| | 213 | | { |
| 0 | 214 | | if (resourceGroupName == null) |
| | 215 | | { |
| 0 | 216 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 217 | | } |
| 0 | 218 | | if (galleryName == null) |
| | 219 | | { |
| 0 | 220 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 221 | | } |
| 0 | 222 | | if (galleryApplicationName == null) |
| | 223 | | { |
| 0 | 224 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | 225 | | } |
| 0 | 226 | | if (galleryApplication == null) |
| | 227 | | { |
| 0 | 228 | | throw new ArgumentNullException(nameof(galleryApplication)); |
| | 229 | | } |
| | 230 | |
|
| 0 | 231 | | using var message = CreateUpdateRequest(resourceGroupName, galleryName, galleryApplicationName, galleryAppli |
| 0 | 232 | | _pipeline.Send(message, cancellationToken); |
| 0 | 233 | | switch (message.Response.Status) |
| | 234 | | { |
| | 235 | | case 200: |
| 0 | 236 | | return message.Response; |
| | 237 | | default: |
| 0 | 238 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 239 | | } |
| 0 | 240 | | } |
| | 241 | |
|
| | 242 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string galleryName, string galleryApplicationNam |
| | 243 | | { |
| 8 | 244 | | var message = _pipeline.CreateMessage(); |
| 8 | 245 | | var request = message.Request; |
| 8 | 246 | | request.Method = RequestMethod.Get; |
| 8 | 247 | | var uri = new RawRequestUriBuilder(); |
| 8 | 248 | | uri.Reset(endpoint); |
| 8 | 249 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 250 | | uri.AppendPath(subscriptionId, true); |
| 8 | 251 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 252 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 253 | | uri.AppendPath("/providers/Microsoft.Compute/galleries/", false); |
| 8 | 254 | | uri.AppendPath(galleryName, true); |
| 8 | 255 | | uri.AppendPath("/applications/", false); |
| 8 | 256 | | uri.AppendPath(galleryApplicationName, true); |
| 8 | 257 | | uri.AppendQuery("api-version", "2019-12-01", true); |
| 8 | 258 | | request.Uri = uri; |
| 8 | 259 | | return message; |
| | 260 | | } |
| | 261 | |
|
| | 262 | | /// <summary> Retrieves information about a gallery Application Definition. </summary> |
| | 263 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 264 | | /// <param name="galleryName"> The name of the Shared Application Gallery from which the Application Definitions |
| | 265 | | /// <param name="galleryApplicationName"> The name of the gallery Application Definition to be retrieved. </para |
| | 266 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 267 | | public async Task<Response<GalleryApplication>> GetAsync(string resourceGroupName, string galleryName, string ga |
| | 268 | | { |
| 4 | 269 | | if (resourceGroupName == null) |
| | 270 | | { |
| 0 | 271 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 272 | | } |
| 4 | 273 | | if (galleryName == null) |
| | 274 | | { |
| 0 | 275 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 276 | | } |
| 4 | 277 | | if (galleryApplicationName == null) |
| | 278 | | { |
| 0 | 279 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | 280 | | } |
| | 281 | |
|
| 4 | 282 | | using var message = CreateGetRequest(resourceGroupName, galleryName, galleryApplicationName); |
| 4 | 283 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 4 | 284 | | switch (message.Response.Status) |
| | 285 | | { |
| | 286 | | case 200: |
| | 287 | | { |
| 4 | 288 | | GalleryApplication value = default; |
| 4 | 289 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 4 | 290 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 291 | | { |
| 0 | 292 | | value = null; |
| | 293 | | } |
| | 294 | | else |
| | 295 | | { |
| 4 | 296 | | value = GalleryApplication.DeserializeGalleryApplication(document.RootElement); |
| | 297 | | } |
| 4 | 298 | | return Response.FromValue(value, message.Response); |
| | 299 | | } |
| | 300 | | default: |
| 0 | 301 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 302 | | } |
| 4 | 303 | | } |
| | 304 | |
|
| | 305 | | /// <summary> Retrieves information about a gallery Application Definition. </summary> |
| | 306 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 307 | | /// <param name="galleryName"> The name of the Shared Application Gallery from which the Application Definitions |
| | 308 | | /// <param name="galleryApplicationName"> The name of the gallery Application Definition to be retrieved. </para |
| | 309 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 310 | | public Response<GalleryApplication> Get(string resourceGroupName, string galleryName, string galleryApplicationN |
| | 311 | | { |
| 4 | 312 | | if (resourceGroupName == null) |
| | 313 | | { |
| 0 | 314 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 315 | | } |
| 4 | 316 | | if (galleryName == null) |
| | 317 | | { |
| 0 | 318 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 319 | | } |
| 4 | 320 | | if (galleryApplicationName == null) |
| | 321 | | { |
| 0 | 322 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | 323 | | } |
| | 324 | |
|
| 4 | 325 | | using var message = CreateGetRequest(resourceGroupName, galleryName, galleryApplicationName); |
| 4 | 326 | | _pipeline.Send(message, cancellationToken); |
| 4 | 327 | | switch (message.Response.Status) |
| | 328 | | { |
| | 329 | | case 200: |
| | 330 | | { |
| 4 | 331 | | GalleryApplication value = default; |
| 4 | 332 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 4 | 333 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 334 | | { |
| 0 | 335 | | value = null; |
| | 336 | | } |
| | 337 | | else |
| | 338 | | { |
| 4 | 339 | | value = GalleryApplication.DeserializeGalleryApplication(document.RootElement); |
| | 340 | | } |
| 4 | 341 | | return Response.FromValue(value, message.Response); |
| | 342 | | } |
| | 343 | | default: |
| 0 | 344 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 345 | | } |
| 4 | 346 | | } |
| | 347 | |
|
| | 348 | | internal HttpMessage CreateDeleteRequest(string resourceGroupName, string galleryName, string galleryApplication |
| | 349 | | { |
| 8 | 350 | | var message = _pipeline.CreateMessage(); |
| 8 | 351 | | var request = message.Request; |
| 8 | 352 | | request.Method = RequestMethod.Delete; |
| 8 | 353 | | var uri = new RawRequestUriBuilder(); |
| 8 | 354 | | uri.Reset(endpoint); |
| 8 | 355 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 356 | | uri.AppendPath(subscriptionId, true); |
| 8 | 357 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 358 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 359 | | uri.AppendPath("/providers/Microsoft.Compute/galleries/", false); |
| 8 | 360 | | uri.AppendPath(galleryName, true); |
| 8 | 361 | | uri.AppendPath("/applications/", false); |
| 8 | 362 | | uri.AppendPath(galleryApplicationName, true); |
| 8 | 363 | | uri.AppendQuery("api-version", "2019-12-01", true); |
| 8 | 364 | | request.Uri = uri; |
| 8 | 365 | | return message; |
| | 366 | | } |
| | 367 | |
|
| | 368 | | /// <summary> Delete a gallery Application. </summary> |
| | 369 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 370 | | /// <param name="galleryName"> The name of the Shared Application Gallery in which the Application Definition is |
| | 371 | | /// <param name="galleryApplicationName"> The name of the gallery Application Definition to be deleted. </param> |
| | 372 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 373 | | public async Task<Response> DeleteAsync(string resourceGroupName, string galleryName, string galleryApplicationN |
| | 374 | | { |
| 2 | 375 | | if (resourceGroupName == null) |
| | 376 | | { |
| 0 | 377 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 378 | | } |
| 2 | 379 | | if (galleryName == null) |
| | 380 | | { |
| 0 | 381 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 382 | | } |
| 2 | 383 | | if (galleryApplicationName == null) |
| | 384 | | { |
| 0 | 385 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | 386 | | } |
| | 387 | |
|
| 2 | 388 | | using var message = CreateDeleteRequest(resourceGroupName, galleryName, galleryApplicationName); |
| 2 | 389 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 390 | | switch (message.Response.Status) |
| | 391 | | { |
| | 392 | | case 200: |
| | 393 | | case 202: |
| | 394 | | case 204: |
| 2 | 395 | | return message.Response; |
| | 396 | | default: |
| 0 | 397 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 398 | | } |
| 2 | 399 | | } |
| | 400 | |
|
| | 401 | | /// <summary> Delete a gallery Application. </summary> |
| | 402 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 403 | | /// <param name="galleryName"> The name of the Shared Application Gallery in which the Application Definition is |
| | 404 | | /// <param name="galleryApplicationName"> The name of the gallery Application Definition to be deleted. </param> |
| | 405 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 406 | | public Response Delete(string resourceGroupName, string galleryName, string galleryApplicationName, Cancellation |
| | 407 | | { |
| 2 | 408 | | if (resourceGroupName == null) |
| | 409 | | { |
| 0 | 410 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 411 | | } |
| 2 | 412 | | if (galleryName == null) |
| | 413 | | { |
| 0 | 414 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 415 | | } |
| 2 | 416 | | if (galleryApplicationName == null) |
| | 417 | | { |
| 0 | 418 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | 419 | | } |
| | 420 | |
|
| 2 | 421 | | using var message = CreateDeleteRequest(resourceGroupName, galleryName, galleryApplicationName); |
| 2 | 422 | | _pipeline.Send(message, cancellationToken); |
| 2 | 423 | | switch (message.Response.Status) |
| | 424 | | { |
| | 425 | | case 200: |
| | 426 | | case 202: |
| | 427 | | case 204: |
| 2 | 428 | | return message.Response; |
| | 429 | | default: |
| 0 | 430 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 431 | | } |
| 2 | 432 | | } |
| | 433 | |
|
| | 434 | | internal HttpMessage CreateListByGalleryRequest(string resourceGroupName, string galleryName) |
| | 435 | | { |
| 0 | 436 | | var message = _pipeline.CreateMessage(); |
| 0 | 437 | | var request = message.Request; |
| 0 | 438 | | request.Method = RequestMethod.Get; |
| 0 | 439 | | var uri = new RawRequestUriBuilder(); |
| 0 | 440 | | uri.Reset(endpoint); |
| 0 | 441 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 442 | | uri.AppendPath(subscriptionId, true); |
| 0 | 443 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 444 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 445 | | uri.AppendPath("/providers/Microsoft.Compute/galleries/", false); |
| 0 | 446 | | uri.AppendPath(galleryName, true); |
| 0 | 447 | | uri.AppendPath("/applications", false); |
| 0 | 448 | | uri.AppendQuery("api-version", "2019-12-01", true); |
| 0 | 449 | | request.Uri = uri; |
| 0 | 450 | | return message; |
| | 451 | | } |
| | 452 | |
|
| | 453 | | /// <summary> List gallery Application Definitions in a gallery. </summary> |
| | 454 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 455 | | /// <param name="galleryName"> The name of the Shared Application Gallery from which Application Definitions are |
| | 456 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 457 | | public async Task<Response<GalleryApplicationList>> ListByGalleryAsync(string resourceGroupName, string galleryN |
| | 458 | | { |
| 0 | 459 | | if (resourceGroupName == null) |
| | 460 | | { |
| 0 | 461 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 462 | | } |
| 0 | 463 | | if (galleryName == null) |
| | 464 | | { |
| 0 | 465 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 466 | | } |
| | 467 | |
|
| 0 | 468 | | using var message = CreateListByGalleryRequest(resourceGroupName, galleryName); |
| 0 | 469 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 470 | | switch (message.Response.Status) |
| | 471 | | { |
| | 472 | | case 200: |
| | 473 | | { |
| 0 | 474 | | GalleryApplicationList value = default; |
| 0 | 475 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 476 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 477 | | { |
| 0 | 478 | | value = null; |
| | 479 | | } |
| | 480 | | else |
| | 481 | | { |
| 0 | 482 | | value = GalleryApplicationList.DeserializeGalleryApplicationList(document.RootElement); |
| | 483 | | } |
| 0 | 484 | | return Response.FromValue(value, message.Response); |
| | 485 | | } |
| | 486 | | default: |
| 0 | 487 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 488 | | } |
| 0 | 489 | | } |
| | 490 | |
|
| | 491 | | /// <summary> List gallery Application Definitions in a gallery. </summary> |
| | 492 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 493 | | /// <param name="galleryName"> The name of the Shared Application Gallery from which Application Definitions are |
| | 494 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 495 | | public Response<GalleryApplicationList> ListByGallery(string resourceGroupName, string galleryName, Cancellation |
| | 496 | | { |
| 0 | 497 | | if (resourceGroupName == null) |
| | 498 | | { |
| 0 | 499 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 500 | | } |
| 0 | 501 | | if (galleryName == null) |
| | 502 | | { |
| 0 | 503 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 504 | | } |
| | 505 | |
|
| 0 | 506 | | using var message = CreateListByGalleryRequest(resourceGroupName, galleryName); |
| 0 | 507 | | _pipeline.Send(message, cancellationToken); |
| 0 | 508 | | switch (message.Response.Status) |
| | 509 | | { |
| | 510 | | case 200: |
| | 511 | | { |
| 0 | 512 | | GalleryApplicationList value = default; |
| 0 | 513 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 514 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 515 | | { |
| 0 | 516 | | value = null; |
| | 517 | | } |
| | 518 | | else |
| | 519 | | { |
| 0 | 520 | | value = GalleryApplicationList.DeserializeGalleryApplicationList(document.RootElement); |
| | 521 | | } |
| 0 | 522 | | return Response.FromValue(value, message.Response); |
| | 523 | | } |
| | 524 | | default: |
| 0 | 525 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 526 | | } |
| 0 | 527 | | } |
| | 528 | |
|
| | 529 | | internal HttpMessage CreateListByGalleryNextPageRequest(string nextLink, string resourceGroupName, string galler |
| | 530 | | { |
| 0 | 531 | | var message = _pipeline.CreateMessage(); |
| 0 | 532 | | var request = message.Request; |
| 0 | 533 | | request.Method = RequestMethod.Get; |
| 0 | 534 | | var uri = new RawRequestUriBuilder(); |
| 0 | 535 | | uri.Reset(endpoint); |
| 0 | 536 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 537 | | request.Uri = uri; |
| 0 | 538 | | return message; |
| | 539 | | } |
| | 540 | |
|
| | 541 | | /// <summary> List gallery Application Definitions in a gallery. </summary> |
| | 542 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 543 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 544 | | /// <param name="galleryName"> The name of the Shared Application Gallery from which Application Definitions are |
| | 545 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 546 | | public async Task<Response<GalleryApplicationList>> ListByGalleryNextPageAsync(string nextLink, string resourceG |
| | 547 | | { |
| 0 | 548 | | if (nextLink == null) |
| | 549 | | { |
| 0 | 550 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 551 | | } |
| 0 | 552 | | if (resourceGroupName == null) |
| | 553 | | { |
| 0 | 554 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 555 | | } |
| 0 | 556 | | if (galleryName == null) |
| | 557 | | { |
| 0 | 558 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 559 | | } |
| | 560 | |
|
| 0 | 561 | | using var message = CreateListByGalleryNextPageRequest(nextLink, resourceGroupName, galleryName); |
| 0 | 562 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 563 | | switch (message.Response.Status) |
| | 564 | | { |
| | 565 | | case 200: |
| | 566 | | { |
| 0 | 567 | | GalleryApplicationList value = default; |
| 0 | 568 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 569 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 570 | | { |
| 0 | 571 | | value = null; |
| | 572 | | } |
| | 573 | | else |
| | 574 | | { |
| 0 | 575 | | value = GalleryApplicationList.DeserializeGalleryApplicationList(document.RootElement); |
| | 576 | | } |
| 0 | 577 | | return Response.FromValue(value, message.Response); |
| | 578 | | } |
| | 579 | | default: |
| 0 | 580 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 581 | | } |
| 0 | 582 | | } |
| | 583 | |
|
| | 584 | | /// <summary> List gallery Application Definitions in a gallery. </summary> |
| | 585 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 586 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 587 | | /// <param name="galleryName"> The name of the Shared Application Gallery from which Application Definitions are |
| | 588 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 589 | | public Response<GalleryApplicationList> ListByGalleryNextPage(string nextLink, string resourceGroupName, string |
| | 590 | | { |
| 0 | 591 | | if (nextLink == null) |
| | 592 | | { |
| 0 | 593 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 594 | | } |
| 0 | 595 | | if (resourceGroupName == null) |
| | 596 | | { |
| 0 | 597 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 598 | | } |
| 0 | 599 | | if (galleryName == null) |
| | 600 | | { |
| 0 | 601 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 602 | | } |
| | 603 | |
|
| 0 | 604 | | using var message = CreateListByGalleryNextPageRequest(nextLink, resourceGroupName, galleryName); |
| 0 | 605 | | _pipeline.Send(message, cancellationToken); |
| 0 | 606 | | switch (message.Response.Status) |
| | 607 | | { |
| | 608 | | case 200: |
| | 609 | | { |
| 0 | 610 | | GalleryApplicationList value = default; |
| 0 | 611 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 612 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 613 | | { |
| 0 | 614 | | value = null; |
| | 615 | | } |
| | 616 | | else |
| | 617 | | { |
| 0 | 618 | | value = GalleryApplicationList.DeserializeGalleryApplicationList(document.RootElement); |
| | 619 | | } |
| 0 | 620 | | return Response.FromValue(value, message.Response); |
| | 621 | | } |
| | 622 | | default: |
| 0 | 623 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 624 | | } |
| 0 | 625 | | } |
| | 626 | | } |
| | 627 | | } |