| | | 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 GalleryApplicationVersionsRestOperations |
| | | 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 GalleryApplicationVersionsRestOperations. </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 GalleryApplicationVersionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, stri |
| | | 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 | | { |
| | 0 | 48 | | var message = _pipeline.CreateMessage(); |
| | 0 | 49 | | var request = message.Request; |
| | 0 | 50 | | request.Method = RequestMethod.Put; |
| | 0 | 51 | | var uri = new RawRequestUriBuilder(); |
| | 0 | 52 | | uri.Reset(endpoint); |
| | 0 | 53 | | uri.AppendPath("/subscriptions/", false); |
| | 0 | 54 | | uri.AppendPath(subscriptionId, true); |
| | 0 | 55 | | uri.AppendPath("/resourceGroups/", false); |
| | 0 | 56 | | uri.AppendPath(resourceGroupName, true); |
| | 0 | 57 | | uri.AppendPath("/providers/Microsoft.Compute/galleries/", false); |
| | 0 | 58 | | uri.AppendPath(galleryName, true); |
| | 0 | 59 | | uri.AppendPath("/applications/", false); |
| | 0 | 60 | | uri.AppendPath(galleryApplicationName, true); |
| | 0 | 61 | | uri.AppendPath("/versions/", false); |
| | 0 | 62 | | uri.AppendPath(galleryApplicationVersionName, true); |
| | 0 | 63 | | uri.AppendQuery("api-version", "2019-12-01", true); |
| | 0 | 64 | | request.Uri = uri; |
| | 0 | 65 | | request.Headers.Add("Content-Type", "application/json"); |
| | 0 | 66 | | var content = new Utf8JsonRequestContent(); |
| | 0 | 67 | | content.JsonWriter.WriteObjectValue(galleryApplicationVersion); |
| | 0 | 68 | | request.Content = content; |
| | 0 | 69 | | return message; |
| | | 70 | | } |
| | | 71 | | |
| | | 72 | | /// <summary> Create or update a gallery Application Version. </summary> |
| | | 73 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 74 | | /// <param name="galleryName"> The name of the Shared Application Gallery in which the Application Definition re |
| | | 75 | | /// <param name="galleryApplicationName"> The name of the gallery Application Definition in which the Applicatio |
| | | 76 | | /// <param name="galleryApplicationVersionName"> The name of the gallery Application Version to be created. Need |
| | | 77 | | /// <param name="galleryApplicationVersion"> Parameters supplied to the create or update gallery Application Ver |
| | | 78 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 79 | | public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string galleryName, string galleryAppl |
| | | 80 | | { |
| | 0 | 81 | | if (resourceGroupName == null) |
| | | 82 | | { |
| | 0 | 83 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 84 | | } |
| | 0 | 85 | | if (galleryName == null) |
| | | 86 | | { |
| | 0 | 87 | | throw new ArgumentNullException(nameof(galleryName)); |
| | | 88 | | } |
| | 0 | 89 | | if (galleryApplicationName == null) |
| | | 90 | | { |
| | 0 | 91 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | | 92 | | } |
| | 0 | 93 | | if (galleryApplicationVersionName == null) |
| | | 94 | | { |
| | 0 | 95 | | throw new ArgumentNullException(nameof(galleryApplicationVersionName)); |
| | | 96 | | } |
| | 0 | 97 | | if (galleryApplicationVersion == null) |
| | | 98 | | { |
| | 0 | 99 | | throw new ArgumentNullException(nameof(galleryApplicationVersion)); |
| | | 100 | | } |
| | | 101 | | |
| | 0 | 102 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, galleryName, galleryApplicationName, gall |
| | 0 | 103 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| | 0 | 104 | | switch (message.Response.Status) |
| | | 105 | | { |
| | | 106 | | case 200: |
| | | 107 | | case 201: |
| | | 108 | | case 202: |
| | 0 | 109 | | return message.Response; |
| | | 110 | | default: |
| | 0 | 111 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | | 112 | | } |
| | 0 | 113 | | } |
| | | 114 | | |
| | | 115 | | /// <summary> Create or update a gallery Application Version. </summary> |
| | | 116 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 117 | | /// <param name="galleryName"> The name of the Shared Application Gallery in which the Application Definition re |
| | | 118 | | /// <param name="galleryApplicationName"> The name of the gallery Application Definition in which the Applicatio |
| | | 119 | | /// <param name="galleryApplicationVersionName"> The name of the gallery Application Version to be created. Need |
| | | 120 | | /// <param name="galleryApplicationVersion"> Parameters supplied to the create or update gallery Application Ver |
| | | 121 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 122 | | public Response CreateOrUpdate(string resourceGroupName, string galleryName, string galleryApplicationName, stri |
| | | 123 | | { |
| | 0 | 124 | | if (resourceGroupName == null) |
| | | 125 | | { |
| | 0 | 126 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 127 | | } |
| | 0 | 128 | | if (galleryName == null) |
| | | 129 | | { |
| | 0 | 130 | | throw new ArgumentNullException(nameof(galleryName)); |
| | | 131 | | } |
| | 0 | 132 | | if (galleryApplicationName == null) |
| | | 133 | | { |
| | 0 | 134 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | | 135 | | } |
| | 0 | 136 | | if (galleryApplicationVersionName == null) |
| | | 137 | | { |
| | 0 | 138 | | throw new ArgumentNullException(nameof(galleryApplicationVersionName)); |
| | | 139 | | } |
| | 0 | 140 | | if (galleryApplicationVersion == null) |
| | | 141 | | { |
| | 0 | 142 | | throw new ArgumentNullException(nameof(galleryApplicationVersion)); |
| | | 143 | | } |
| | | 144 | | |
| | 0 | 145 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, galleryName, galleryApplicationName, gall |
| | 0 | 146 | | _pipeline.Send(message, cancellationToken); |
| | 0 | 147 | | switch (message.Response.Status) |
| | | 148 | | { |
| | | 149 | | case 200: |
| | | 150 | | case 201: |
| | | 151 | | case 202: |
| | 0 | 152 | | return message.Response; |
| | | 153 | | default: |
| | 0 | 154 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | | 155 | | } |
| | 0 | 156 | | } |
| | | 157 | | |
| | | 158 | | internal HttpMessage CreateUpdateRequest(string resourceGroupName, string galleryName, string galleryApplication |
| | | 159 | | { |
| | 0 | 160 | | var message = _pipeline.CreateMessage(); |
| | 0 | 161 | | var request = message.Request; |
| | 0 | 162 | | request.Method = RequestMethod.Patch; |
| | 0 | 163 | | var uri = new RawRequestUriBuilder(); |
| | 0 | 164 | | uri.Reset(endpoint); |
| | 0 | 165 | | uri.AppendPath("/subscriptions/", false); |
| | 0 | 166 | | uri.AppendPath(subscriptionId, true); |
| | 0 | 167 | | uri.AppendPath("/resourceGroups/", false); |
| | 0 | 168 | | uri.AppendPath(resourceGroupName, true); |
| | 0 | 169 | | uri.AppendPath("/providers/Microsoft.Compute/galleries/", false); |
| | 0 | 170 | | uri.AppendPath(galleryName, true); |
| | 0 | 171 | | uri.AppendPath("/applications/", false); |
| | 0 | 172 | | uri.AppendPath(galleryApplicationName, true); |
| | 0 | 173 | | uri.AppendPath("/versions/", false); |
| | 0 | 174 | | uri.AppendPath(galleryApplicationVersionName, true); |
| | 0 | 175 | | uri.AppendQuery("api-version", "2019-12-01", true); |
| | 0 | 176 | | request.Uri = uri; |
| | 0 | 177 | | request.Headers.Add("Content-Type", "application/json"); |
| | 0 | 178 | | var content = new Utf8JsonRequestContent(); |
| | 0 | 179 | | content.JsonWriter.WriteObjectValue(galleryApplicationVersion); |
| | 0 | 180 | | request.Content = content; |
| | 0 | 181 | | return message; |
| | | 182 | | } |
| | | 183 | | |
| | | 184 | | /// <summary> Update a gallery Application Version. </summary> |
| | | 185 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 186 | | /// <param name="galleryName"> The name of the Shared Application Gallery in which the Application Definition re |
| | | 187 | | /// <param name="galleryApplicationName"> The name of the gallery Application Definition in which the Applicatio |
| | | 188 | | /// <param name="galleryApplicationVersionName"> The name of the gallery Application Version to be updated. Need |
| | | 189 | | /// <param name="galleryApplicationVersion"> Parameters supplied to the update gallery Application Version opera |
| | | 190 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 191 | | public async Task<Response> UpdateAsync(string resourceGroupName, string galleryName, string galleryApplicationN |
| | | 192 | | { |
| | 0 | 193 | | if (resourceGroupName == null) |
| | | 194 | | { |
| | 0 | 195 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 196 | | } |
| | 0 | 197 | | if (galleryName == null) |
| | | 198 | | { |
| | 0 | 199 | | throw new ArgumentNullException(nameof(galleryName)); |
| | | 200 | | } |
| | 0 | 201 | | if (galleryApplicationName == null) |
| | | 202 | | { |
| | 0 | 203 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | | 204 | | } |
| | 0 | 205 | | if (galleryApplicationVersionName == null) |
| | | 206 | | { |
| | 0 | 207 | | throw new ArgumentNullException(nameof(galleryApplicationVersionName)); |
| | | 208 | | } |
| | 0 | 209 | | if (galleryApplicationVersion == null) |
| | | 210 | | { |
| | 0 | 211 | | throw new ArgumentNullException(nameof(galleryApplicationVersion)); |
| | | 212 | | } |
| | | 213 | | |
| | 0 | 214 | | using var message = CreateUpdateRequest(resourceGroupName, galleryName, galleryApplicationName, galleryAppli |
| | 0 | 215 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| | 0 | 216 | | switch (message.Response.Status) |
| | | 217 | | { |
| | | 218 | | case 200: |
| | 0 | 219 | | return message.Response; |
| | | 220 | | default: |
| | 0 | 221 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | | 222 | | } |
| | 0 | 223 | | } |
| | | 224 | | |
| | | 225 | | /// <summary> Update a gallery Application Version. </summary> |
| | | 226 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 227 | | /// <param name="galleryName"> The name of the Shared Application Gallery in which the Application Definition re |
| | | 228 | | /// <param name="galleryApplicationName"> The name of the gallery Application Definition in which the Applicatio |
| | | 229 | | /// <param name="galleryApplicationVersionName"> The name of the gallery Application Version to be updated. Need |
| | | 230 | | /// <param name="galleryApplicationVersion"> Parameters supplied to the update gallery Application Version opera |
| | | 231 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 232 | | public Response Update(string resourceGroupName, string galleryName, string galleryApplicationName, string galle |
| | | 233 | | { |
| | 0 | 234 | | if (resourceGroupName == null) |
| | | 235 | | { |
| | 0 | 236 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 237 | | } |
| | 0 | 238 | | if (galleryName == null) |
| | | 239 | | { |
| | 0 | 240 | | throw new ArgumentNullException(nameof(galleryName)); |
| | | 241 | | } |
| | 0 | 242 | | if (galleryApplicationName == null) |
| | | 243 | | { |
| | 0 | 244 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | | 245 | | } |
| | 0 | 246 | | if (galleryApplicationVersionName == null) |
| | | 247 | | { |
| | 0 | 248 | | throw new ArgumentNullException(nameof(galleryApplicationVersionName)); |
| | | 249 | | } |
| | 0 | 250 | | if (galleryApplicationVersion == null) |
| | | 251 | | { |
| | 0 | 252 | | throw new ArgumentNullException(nameof(galleryApplicationVersion)); |
| | | 253 | | } |
| | | 254 | | |
| | 0 | 255 | | using var message = CreateUpdateRequest(resourceGroupName, galleryName, galleryApplicationName, galleryAppli |
| | 0 | 256 | | _pipeline.Send(message, cancellationToken); |
| | 0 | 257 | | switch (message.Response.Status) |
| | | 258 | | { |
| | | 259 | | case 200: |
| | 0 | 260 | | return message.Response; |
| | | 261 | | default: |
| | 0 | 262 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | | 263 | | } |
| | 0 | 264 | | } |
| | | 265 | | |
| | | 266 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string galleryName, string galleryApplicationNam |
| | | 267 | | { |
| | 0 | 268 | | var message = _pipeline.CreateMessage(); |
| | 0 | 269 | | var request = message.Request; |
| | 0 | 270 | | request.Method = RequestMethod.Get; |
| | 0 | 271 | | var uri = new RawRequestUriBuilder(); |
| | 0 | 272 | | uri.Reset(endpoint); |
| | 0 | 273 | | uri.AppendPath("/subscriptions/", false); |
| | 0 | 274 | | uri.AppendPath(subscriptionId, true); |
| | 0 | 275 | | uri.AppendPath("/resourceGroups/", false); |
| | 0 | 276 | | uri.AppendPath(resourceGroupName, true); |
| | 0 | 277 | | uri.AppendPath("/providers/Microsoft.Compute/galleries/", false); |
| | 0 | 278 | | uri.AppendPath(galleryName, true); |
| | 0 | 279 | | uri.AppendPath("/applications/", false); |
| | 0 | 280 | | uri.AppendPath(galleryApplicationName, true); |
| | 0 | 281 | | uri.AppendPath("/versions/", false); |
| | 0 | 282 | | uri.AppendPath(galleryApplicationVersionName, true); |
| | 0 | 283 | | uri.AppendQuery("$expand", "ReplicationStatus", true); |
| | 0 | 284 | | uri.AppendQuery("api-version", "2019-12-01", true); |
| | 0 | 285 | | request.Uri = uri; |
| | 0 | 286 | | return message; |
| | | 287 | | } |
| | | 288 | | |
| | | 289 | | /// <summary> Retrieves information about a gallery Application Version. </summary> |
| | | 290 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 291 | | /// <param name="galleryName"> The name of the Shared Application Gallery in which the Application Definition re |
| | | 292 | | /// <param name="galleryApplicationName"> The name of the gallery Application Definition in which the Applicatio |
| | | 293 | | /// <param name="galleryApplicationVersionName"> The name of the gallery Application Version to be retrieved. </ |
| | | 294 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 295 | | public async Task<Response<GalleryApplicationVersion>> GetAsync(string resourceGroupName, string galleryName, st |
| | | 296 | | { |
| | 0 | 297 | | if (resourceGroupName == null) |
| | | 298 | | { |
| | 0 | 299 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 300 | | } |
| | 0 | 301 | | if (galleryName == null) |
| | | 302 | | { |
| | 0 | 303 | | throw new ArgumentNullException(nameof(galleryName)); |
| | | 304 | | } |
| | 0 | 305 | | if (galleryApplicationName == null) |
| | | 306 | | { |
| | 0 | 307 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | | 308 | | } |
| | 0 | 309 | | if (galleryApplicationVersionName == null) |
| | | 310 | | { |
| | 0 | 311 | | throw new ArgumentNullException(nameof(galleryApplicationVersionName)); |
| | | 312 | | } |
| | | 313 | | |
| | 0 | 314 | | using var message = CreateGetRequest(resourceGroupName, galleryName, galleryApplicationName, galleryApplicat |
| | 0 | 315 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| | 0 | 316 | | switch (message.Response.Status) |
| | | 317 | | { |
| | | 318 | | case 200: |
| | | 319 | | { |
| | 0 | 320 | | GalleryApplicationVersion value = default; |
| | 0 | 321 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| | 0 | 322 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | | 323 | | { |
| | 0 | 324 | | value = null; |
| | | 325 | | } |
| | | 326 | | else |
| | | 327 | | { |
| | 0 | 328 | | value = GalleryApplicationVersion.DeserializeGalleryApplicationVersion(document.RootElement) |
| | | 329 | | } |
| | 0 | 330 | | return Response.FromValue(value, message.Response); |
| | | 331 | | } |
| | | 332 | | default: |
| | 0 | 333 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | | 334 | | } |
| | 0 | 335 | | } |
| | | 336 | | |
| | | 337 | | /// <summary> Retrieves information about a gallery Application Version. </summary> |
| | | 338 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 339 | | /// <param name="galleryName"> The name of the Shared Application Gallery in which the Application Definition re |
| | | 340 | | /// <param name="galleryApplicationName"> The name of the gallery Application Definition in which the Applicatio |
| | | 341 | | /// <param name="galleryApplicationVersionName"> The name of the gallery Application Version to be retrieved. </ |
| | | 342 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 343 | | public Response<GalleryApplicationVersion> Get(string resourceGroupName, string galleryName, string galleryAppli |
| | | 344 | | { |
| | 0 | 345 | | if (resourceGroupName == null) |
| | | 346 | | { |
| | 0 | 347 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 348 | | } |
| | 0 | 349 | | if (galleryName == null) |
| | | 350 | | { |
| | 0 | 351 | | throw new ArgumentNullException(nameof(galleryName)); |
| | | 352 | | } |
| | 0 | 353 | | if (galleryApplicationName == null) |
| | | 354 | | { |
| | 0 | 355 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | | 356 | | } |
| | 0 | 357 | | if (galleryApplicationVersionName == null) |
| | | 358 | | { |
| | 0 | 359 | | throw new ArgumentNullException(nameof(galleryApplicationVersionName)); |
| | | 360 | | } |
| | | 361 | | |
| | 0 | 362 | | using var message = CreateGetRequest(resourceGroupName, galleryName, galleryApplicationName, galleryApplicat |
| | 0 | 363 | | _pipeline.Send(message, cancellationToken); |
| | 0 | 364 | | switch (message.Response.Status) |
| | | 365 | | { |
| | | 366 | | case 200: |
| | | 367 | | { |
| | 0 | 368 | | GalleryApplicationVersion value = default; |
| | 0 | 369 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| | 0 | 370 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | | 371 | | { |
| | 0 | 372 | | value = null; |
| | | 373 | | } |
| | | 374 | | else |
| | | 375 | | { |
| | 0 | 376 | | value = GalleryApplicationVersion.DeserializeGalleryApplicationVersion(document.RootElement) |
| | | 377 | | } |
| | 0 | 378 | | return Response.FromValue(value, message.Response); |
| | | 379 | | } |
| | | 380 | | default: |
| | 0 | 381 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | | 382 | | } |
| | 0 | 383 | | } |
| | | 384 | | |
| | | 385 | | internal HttpMessage CreateDeleteRequest(string resourceGroupName, string galleryName, string galleryApplication |
| | | 386 | | { |
| | 0 | 387 | | var message = _pipeline.CreateMessage(); |
| | 0 | 388 | | var request = message.Request; |
| | 0 | 389 | | request.Method = RequestMethod.Delete; |
| | 0 | 390 | | var uri = new RawRequestUriBuilder(); |
| | 0 | 391 | | uri.Reset(endpoint); |
| | 0 | 392 | | uri.AppendPath("/subscriptions/", false); |
| | 0 | 393 | | uri.AppendPath(subscriptionId, true); |
| | 0 | 394 | | uri.AppendPath("/resourceGroups/", false); |
| | 0 | 395 | | uri.AppendPath(resourceGroupName, true); |
| | 0 | 396 | | uri.AppendPath("/providers/Microsoft.Compute/galleries/", false); |
| | 0 | 397 | | uri.AppendPath(galleryName, true); |
| | 0 | 398 | | uri.AppendPath("/applications/", false); |
| | 0 | 399 | | uri.AppendPath(galleryApplicationName, true); |
| | 0 | 400 | | uri.AppendPath("/versions/", false); |
| | 0 | 401 | | uri.AppendPath(galleryApplicationVersionName, true); |
| | 0 | 402 | | uri.AppendQuery("api-version", "2019-12-01", true); |
| | 0 | 403 | | request.Uri = uri; |
| | 0 | 404 | | return message; |
| | | 405 | | } |
| | | 406 | | |
| | | 407 | | /// <summary> Delete a gallery Application Version. </summary> |
| | | 408 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 409 | | /// <param name="galleryName"> The name of the Shared Application Gallery in which the Application Definition re |
| | | 410 | | /// <param name="galleryApplicationName"> The name of the gallery Application Definition in which the Applicatio |
| | | 411 | | /// <param name="galleryApplicationVersionName"> The name of the gallery Application Version to be deleted. </pa |
| | | 412 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 413 | | public async Task<Response> DeleteAsync(string resourceGroupName, string galleryName, string galleryApplicationN |
| | | 414 | | { |
| | 0 | 415 | | if (resourceGroupName == null) |
| | | 416 | | { |
| | 0 | 417 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 418 | | } |
| | 0 | 419 | | if (galleryName == null) |
| | | 420 | | { |
| | 0 | 421 | | throw new ArgumentNullException(nameof(galleryName)); |
| | | 422 | | } |
| | 0 | 423 | | if (galleryApplicationName == null) |
| | | 424 | | { |
| | 0 | 425 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | | 426 | | } |
| | 0 | 427 | | if (galleryApplicationVersionName == null) |
| | | 428 | | { |
| | 0 | 429 | | throw new ArgumentNullException(nameof(galleryApplicationVersionName)); |
| | | 430 | | } |
| | | 431 | | |
| | 0 | 432 | | using var message = CreateDeleteRequest(resourceGroupName, galleryName, galleryApplicationName, galleryAppli |
| | 0 | 433 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| | 0 | 434 | | switch (message.Response.Status) |
| | | 435 | | { |
| | | 436 | | case 200: |
| | | 437 | | case 202: |
| | | 438 | | case 204: |
| | 0 | 439 | | return message.Response; |
| | | 440 | | default: |
| | 0 | 441 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | | 442 | | } |
| | 0 | 443 | | } |
| | | 444 | | |
| | | 445 | | /// <summary> Delete a gallery Application Version. </summary> |
| | | 446 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 447 | | /// <param name="galleryName"> The name of the Shared Application Gallery in which the Application Definition re |
| | | 448 | | /// <param name="galleryApplicationName"> The name of the gallery Application Definition in which the Applicatio |
| | | 449 | | /// <param name="galleryApplicationVersionName"> The name of the gallery Application Version to be deleted. </pa |
| | | 450 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 451 | | public Response Delete(string resourceGroupName, string galleryName, string galleryApplicationName, string galle |
| | | 452 | | { |
| | 0 | 453 | | if (resourceGroupName == null) |
| | | 454 | | { |
| | 0 | 455 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 456 | | } |
| | 0 | 457 | | if (galleryName == null) |
| | | 458 | | { |
| | 0 | 459 | | throw new ArgumentNullException(nameof(galleryName)); |
| | | 460 | | } |
| | 0 | 461 | | if (galleryApplicationName == null) |
| | | 462 | | { |
| | 0 | 463 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | | 464 | | } |
| | 0 | 465 | | if (galleryApplicationVersionName == null) |
| | | 466 | | { |
| | 0 | 467 | | throw new ArgumentNullException(nameof(galleryApplicationVersionName)); |
| | | 468 | | } |
| | | 469 | | |
| | 0 | 470 | | using var message = CreateDeleteRequest(resourceGroupName, galleryName, galleryApplicationName, galleryAppli |
| | 0 | 471 | | _pipeline.Send(message, cancellationToken); |
| | 0 | 472 | | switch (message.Response.Status) |
| | | 473 | | { |
| | | 474 | | case 200: |
| | | 475 | | case 202: |
| | | 476 | | case 204: |
| | 0 | 477 | | return message.Response; |
| | | 478 | | default: |
| | 0 | 479 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | | 480 | | } |
| | 0 | 481 | | } |
| | | 482 | | |
| | | 483 | | internal HttpMessage CreateListByGalleryApplicationRequest(string resourceGroupName, string galleryName, string |
| | | 484 | | { |
| | 0 | 485 | | var message = _pipeline.CreateMessage(); |
| | 0 | 486 | | var request = message.Request; |
| | 0 | 487 | | request.Method = RequestMethod.Get; |
| | 0 | 488 | | var uri = new RawRequestUriBuilder(); |
| | 0 | 489 | | uri.Reset(endpoint); |
| | 0 | 490 | | uri.AppendPath("/subscriptions/", false); |
| | 0 | 491 | | uri.AppendPath(subscriptionId, true); |
| | 0 | 492 | | uri.AppendPath("/resourceGroups/", false); |
| | 0 | 493 | | uri.AppendPath(resourceGroupName, true); |
| | 0 | 494 | | uri.AppendPath("/providers/Microsoft.Compute/galleries/", false); |
| | 0 | 495 | | uri.AppendPath(galleryName, true); |
| | 0 | 496 | | uri.AppendPath("/applications/", false); |
| | 0 | 497 | | uri.AppendPath(galleryApplicationName, true); |
| | 0 | 498 | | uri.AppendPath("/versions", false); |
| | 0 | 499 | | uri.AppendQuery("api-version", "2019-12-01", true); |
| | 0 | 500 | | request.Uri = uri; |
| | 0 | 501 | | return message; |
| | | 502 | | } |
| | | 503 | | |
| | | 504 | | /// <summary> List gallery Application Versions in a gallery Application Definition. </summary> |
| | | 505 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 506 | | /// <param name="galleryName"> The name of the Shared Application Gallery in which the Application Definition re |
| | | 507 | | /// <param name="galleryApplicationName"> The name of the Shared Application Gallery Application Definition from |
| | | 508 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 509 | | public async Task<Response<GalleryApplicationVersionList>> ListByGalleryApplicationAsync(string resourceGroupNam |
| | | 510 | | { |
| | 0 | 511 | | if (resourceGroupName == null) |
| | | 512 | | { |
| | 0 | 513 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 514 | | } |
| | 0 | 515 | | if (galleryName == null) |
| | | 516 | | { |
| | 0 | 517 | | throw new ArgumentNullException(nameof(galleryName)); |
| | | 518 | | } |
| | 0 | 519 | | if (galleryApplicationName == null) |
| | | 520 | | { |
| | 0 | 521 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | | 522 | | } |
| | | 523 | | |
| | 0 | 524 | | using var message = CreateListByGalleryApplicationRequest(resourceGroupName, galleryName, galleryApplication |
| | 0 | 525 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| | 0 | 526 | | switch (message.Response.Status) |
| | | 527 | | { |
| | | 528 | | case 200: |
| | | 529 | | { |
| | 0 | 530 | | GalleryApplicationVersionList value = default; |
| | 0 | 531 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| | 0 | 532 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | | 533 | | { |
| | 0 | 534 | | value = null; |
| | | 535 | | } |
| | | 536 | | else |
| | | 537 | | { |
| | 0 | 538 | | value = GalleryApplicationVersionList.DeserializeGalleryApplicationVersionList(document.Root |
| | | 539 | | } |
| | 0 | 540 | | return Response.FromValue(value, message.Response); |
| | | 541 | | } |
| | | 542 | | default: |
| | 0 | 543 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | | 544 | | } |
| | 0 | 545 | | } |
| | | 546 | | |
| | | 547 | | /// <summary> List gallery Application Versions in a gallery Application Definition. </summary> |
| | | 548 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 549 | | /// <param name="galleryName"> The name of the Shared Application Gallery in which the Application Definition re |
| | | 550 | | /// <param name="galleryApplicationName"> The name of the Shared Application Gallery Application Definition from |
| | | 551 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 552 | | public Response<GalleryApplicationVersionList> ListByGalleryApplication(string resourceGroupName, string gallery |
| | | 553 | | { |
| | 0 | 554 | | if (resourceGroupName == null) |
| | | 555 | | { |
| | 0 | 556 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 557 | | } |
| | 0 | 558 | | if (galleryName == null) |
| | | 559 | | { |
| | 0 | 560 | | throw new ArgumentNullException(nameof(galleryName)); |
| | | 561 | | } |
| | 0 | 562 | | if (galleryApplicationName == null) |
| | | 563 | | { |
| | 0 | 564 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | | 565 | | } |
| | | 566 | | |
| | 0 | 567 | | using var message = CreateListByGalleryApplicationRequest(resourceGroupName, galleryName, galleryApplication |
| | 0 | 568 | | _pipeline.Send(message, cancellationToken); |
| | 0 | 569 | | switch (message.Response.Status) |
| | | 570 | | { |
| | | 571 | | case 200: |
| | | 572 | | { |
| | 0 | 573 | | GalleryApplicationVersionList value = default; |
| | 0 | 574 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| | 0 | 575 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | | 576 | | { |
| | 0 | 577 | | value = null; |
| | | 578 | | } |
| | | 579 | | else |
| | | 580 | | { |
| | 0 | 581 | | value = GalleryApplicationVersionList.DeserializeGalleryApplicationVersionList(document.Root |
| | | 582 | | } |
| | 0 | 583 | | return Response.FromValue(value, message.Response); |
| | | 584 | | } |
| | | 585 | | default: |
| | 0 | 586 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | | 587 | | } |
| | 0 | 588 | | } |
| | | 589 | | |
| | | 590 | | internal HttpMessage CreateListByGalleryApplicationNextPageRequest(string nextLink, string resourceGroupName, st |
| | | 591 | | { |
| | 0 | 592 | | var message = _pipeline.CreateMessage(); |
| | 0 | 593 | | var request = message.Request; |
| | 0 | 594 | | request.Method = RequestMethod.Get; |
| | 0 | 595 | | var uri = new RawRequestUriBuilder(); |
| | 0 | 596 | | uri.Reset(endpoint); |
| | 0 | 597 | | uri.AppendRawNextLink(nextLink, false); |
| | 0 | 598 | | request.Uri = uri; |
| | 0 | 599 | | return message; |
| | | 600 | | } |
| | | 601 | | |
| | | 602 | | /// <summary> List gallery Application Versions in a gallery Application Definition. </summary> |
| | | 603 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | | 604 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 605 | | /// <param name="galleryName"> The name of the Shared Application Gallery in which the Application Definition re |
| | | 606 | | /// <param name="galleryApplicationName"> The name of the Shared Application Gallery Application Definition from |
| | | 607 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 608 | | public async Task<Response<GalleryApplicationVersionList>> ListByGalleryApplicationNextPageAsync(string nextLink |
| | | 609 | | { |
| | 0 | 610 | | if (nextLink == null) |
| | | 611 | | { |
| | 0 | 612 | | throw new ArgumentNullException(nameof(nextLink)); |
| | | 613 | | } |
| | 0 | 614 | | if (resourceGroupName == null) |
| | | 615 | | { |
| | 0 | 616 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 617 | | } |
| | 0 | 618 | | if (galleryName == null) |
| | | 619 | | { |
| | 0 | 620 | | throw new ArgumentNullException(nameof(galleryName)); |
| | | 621 | | } |
| | 0 | 622 | | if (galleryApplicationName == null) |
| | | 623 | | { |
| | 0 | 624 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | | 625 | | } |
| | | 626 | | |
| | 0 | 627 | | using var message = CreateListByGalleryApplicationNextPageRequest(nextLink, resourceGroupName, galleryName, |
| | 0 | 628 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| | 0 | 629 | | switch (message.Response.Status) |
| | | 630 | | { |
| | | 631 | | case 200: |
| | | 632 | | { |
| | 0 | 633 | | GalleryApplicationVersionList value = default; |
| | 0 | 634 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| | 0 | 635 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | | 636 | | { |
| | 0 | 637 | | value = null; |
| | | 638 | | } |
| | | 639 | | else |
| | | 640 | | { |
| | 0 | 641 | | value = GalleryApplicationVersionList.DeserializeGalleryApplicationVersionList(document.Root |
| | | 642 | | } |
| | 0 | 643 | | return Response.FromValue(value, message.Response); |
| | | 644 | | } |
| | | 645 | | default: |
| | 0 | 646 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | | 647 | | } |
| | 0 | 648 | | } |
| | | 649 | | |
| | | 650 | | /// <summary> List gallery Application Versions in a gallery Application Definition. </summary> |
| | | 651 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | | 652 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 653 | | /// <param name="galleryName"> The name of the Shared Application Gallery in which the Application Definition re |
| | | 654 | | /// <param name="galleryApplicationName"> The name of the Shared Application Gallery Application Definition from |
| | | 655 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 656 | | public Response<GalleryApplicationVersionList> ListByGalleryApplicationNextPage(string nextLink, string resource |
| | | 657 | | { |
| | 0 | 658 | | if (nextLink == null) |
| | | 659 | | { |
| | 0 | 660 | | throw new ArgumentNullException(nameof(nextLink)); |
| | | 661 | | } |
| | 0 | 662 | | if (resourceGroupName == null) |
| | | 663 | | { |
| | 0 | 664 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 665 | | } |
| | 0 | 666 | | if (galleryName == null) |
| | | 667 | | { |
| | 0 | 668 | | throw new ArgumentNullException(nameof(galleryName)); |
| | | 669 | | } |
| | 0 | 670 | | if (galleryApplicationName == null) |
| | | 671 | | { |
| | 0 | 672 | | throw new ArgumentNullException(nameof(galleryApplicationName)); |
| | | 673 | | } |
| | | 674 | | |
| | 0 | 675 | | using var message = CreateListByGalleryApplicationNextPageRequest(nextLink, resourceGroupName, galleryName, |
| | 0 | 676 | | _pipeline.Send(message, cancellationToken); |
| | 0 | 677 | | switch (message.Response.Status) |
| | | 678 | | { |
| | | 679 | | case 200: |
| | | 680 | | { |
| | 0 | 681 | | GalleryApplicationVersionList value = default; |
| | 0 | 682 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| | 0 | 683 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | | 684 | | { |
| | 0 | 685 | | value = null; |
| | | 686 | | } |
| | | 687 | | else |
| | | 688 | | { |
| | 0 | 689 | | value = GalleryApplicationVersionList.DeserializeGalleryApplicationVersionList(document.Root |
| | | 690 | | } |
| | 0 | 691 | | return Response.FromValue(value, message.Response); |
| | | 692 | | } |
| | | 693 | | default: |
| | 0 | 694 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | | 695 | | } |
| | 0 | 696 | | } |
| | | 697 | | } |
| | | 698 | | } |