| | 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.Resources.Models; |
| | 16 | |
|
| | 17 | | namespace Azure.ResourceManager.Resources |
| | 18 | | { |
| | 19 | | internal partial class ApplicationsRestOperations |
| | 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 ApplicationsRestOperations. </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"> The ID of the target subscription. </param> |
| | 30 | | /// <param name="endpoint"> server parameter. </param> |
| | 31 | | /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception |
| 0 | 32 | | public ApplicationsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptio |
| | 33 | | { |
| 0 | 34 | | if (subscriptionId == null) |
| | 35 | | { |
| 0 | 36 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 37 | | } |
| 0 | 38 | | endpoint ??= new Uri("https://management.azure.com"); |
| | 39 | |
|
| 0 | 40 | | this.subscriptionId = subscriptionId; |
| 0 | 41 | | this.endpoint = endpoint; |
| 0 | 42 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 43 | | _pipeline = pipeline; |
| 0 | 44 | | } |
| | 45 | |
|
| | 46 | | internal Core.HttpMessage CreateGetRequest(string resourceGroupName, string applicationName) |
| | 47 | | { |
| 0 | 48 | | var message = _pipeline.CreateMessage(); |
| 0 | 49 | | var request = message.Request; |
| 0 | 50 | | request.Method = RequestMethod.Get; |
| 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.Solutions/applications/", false); |
| 0 | 58 | | uri.AppendPath(applicationName, true); |
| 0 | 59 | | uri.AppendQuery("api-version", "2018-06-01", true); |
| 0 | 60 | | request.Uri = uri; |
| 0 | 61 | | return message; |
| | 62 | | } |
| | 63 | |
|
| | 64 | | /// <summary> Gets the managed application. </summary> |
| | 65 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 66 | | /// <param name="applicationName"> The name of the managed application. </param> |
| | 67 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 68 | | public async Task<Response<Application>> GetAsync(string resourceGroupName, string applicationName, Cancellation |
| | 69 | | { |
| 0 | 70 | | if (resourceGroupName == null) |
| | 71 | | { |
| 0 | 72 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 73 | | } |
| 0 | 74 | | if (applicationName == null) |
| | 75 | | { |
| 0 | 76 | | throw new ArgumentNullException(nameof(applicationName)); |
| | 77 | | } |
| | 78 | |
|
| 0 | 79 | | using var message = CreateGetRequest(resourceGroupName, applicationName); |
| 0 | 80 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 81 | | switch (message.Response.Status) |
| | 82 | | { |
| | 83 | | case 200: |
| | 84 | | { |
| 0 | 85 | | Application value = default; |
| 0 | 86 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 87 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 88 | | { |
| 0 | 89 | | value = null; |
| | 90 | | } |
| | 91 | | else |
| | 92 | | { |
| 0 | 93 | | value = Application.DeserializeApplication(document.RootElement); |
| | 94 | | } |
| 0 | 95 | | return Response.FromValue(value, message.Response); |
| | 96 | | } |
| | 97 | | case 404: |
| 0 | 98 | | return Response.FromValue<Application>(null, message.Response); |
| | 99 | | default: |
| 0 | 100 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 101 | | } |
| 0 | 102 | | } |
| | 103 | |
|
| | 104 | | /// <summary> Gets the managed application. </summary> |
| | 105 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 106 | | /// <param name="applicationName"> The name of the managed application. </param> |
| | 107 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 108 | | public Response<Application> Get(string resourceGroupName, string applicationName, CancellationToken cancellatio |
| | 109 | | { |
| 0 | 110 | | if (resourceGroupName == null) |
| | 111 | | { |
| 0 | 112 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 113 | | } |
| 0 | 114 | | if (applicationName == null) |
| | 115 | | { |
| 0 | 116 | | throw new ArgumentNullException(nameof(applicationName)); |
| | 117 | | } |
| | 118 | |
|
| 0 | 119 | | using var message = CreateGetRequest(resourceGroupName, applicationName); |
| 0 | 120 | | _pipeline.Send(message, cancellationToken); |
| 0 | 121 | | switch (message.Response.Status) |
| | 122 | | { |
| | 123 | | case 200: |
| | 124 | | { |
| 0 | 125 | | Application value = default; |
| 0 | 126 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 127 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 128 | | { |
| 0 | 129 | | value = null; |
| | 130 | | } |
| | 131 | | else |
| | 132 | | { |
| 0 | 133 | | value = Application.DeserializeApplication(document.RootElement); |
| | 134 | | } |
| 0 | 135 | | return Response.FromValue(value, message.Response); |
| | 136 | | } |
| | 137 | | case 404: |
| 0 | 138 | | return Response.FromValue<Application>(null, message.Response); |
| | 139 | | default: |
| 0 | 140 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 141 | | } |
| 0 | 142 | | } |
| | 143 | |
|
| | 144 | | internal Core.HttpMessage CreateDeleteRequest(string resourceGroupName, string applicationName) |
| | 145 | | { |
| 0 | 146 | | var message = _pipeline.CreateMessage(); |
| 0 | 147 | | var request = message.Request; |
| 0 | 148 | | request.Method = RequestMethod.Delete; |
| 0 | 149 | | var uri = new RawRequestUriBuilder(); |
| 0 | 150 | | uri.Reset(endpoint); |
| 0 | 151 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 152 | | uri.AppendPath(subscriptionId, true); |
| 0 | 153 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 154 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 155 | | uri.AppendPath("/providers/Microsoft.Solutions/applications/", false); |
| 0 | 156 | | uri.AppendPath(applicationName, true); |
| 0 | 157 | | uri.AppendQuery("api-version", "2018-06-01", true); |
| 0 | 158 | | request.Uri = uri; |
| 0 | 159 | | return message; |
| | 160 | | } |
| | 161 | |
|
| | 162 | | /// <summary> Deletes the managed application. </summary> |
| | 163 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 164 | | /// <param name="applicationName"> The name of the managed application. </param> |
| | 165 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 166 | | public async Task<Response> DeleteAsync(string resourceGroupName, string applicationName, CancellationToken canc |
| | 167 | | { |
| 0 | 168 | | if (resourceGroupName == null) |
| | 169 | | { |
| 0 | 170 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 171 | | } |
| 0 | 172 | | if (applicationName == null) |
| | 173 | | { |
| 0 | 174 | | throw new ArgumentNullException(nameof(applicationName)); |
| | 175 | | } |
| | 176 | |
|
| 0 | 177 | | using var message = CreateDeleteRequest(resourceGroupName, applicationName); |
| 0 | 178 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 179 | | switch (message.Response.Status) |
| | 180 | | { |
| | 181 | | case 202: |
| | 182 | | case 204: |
| 0 | 183 | | return message.Response; |
| | 184 | | default: |
| 0 | 185 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 186 | | } |
| 0 | 187 | | } |
| | 188 | |
|
| | 189 | | /// <summary> Deletes the managed application. </summary> |
| | 190 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 191 | | /// <param name="applicationName"> The name of the managed application. </param> |
| | 192 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 193 | | public Response Delete(string resourceGroupName, string applicationName, CancellationToken cancellationToken = d |
| | 194 | | { |
| 0 | 195 | | if (resourceGroupName == null) |
| | 196 | | { |
| 0 | 197 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 198 | | } |
| 0 | 199 | | if (applicationName == null) |
| | 200 | | { |
| 0 | 201 | | throw new ArgumentNullException(nameof(applicationName)); |
| | 202 | | } |
| | 203 | |
|
| 0 | 204 | | using var message = CreateDeleteRequest(resourceGroupName, applicationName); |
| 0 | 205 | | _pipeline.Send(message, cancellationToken); |
| 0 | 206 | | switch (message.Response.Status) |
| | 207 | | { |
| | 208 | | case 202: |
| | 209 | | case 204: |
| 0 | 210 | | return message.Response; |
| | 211 | | default: |
| 0 | 212 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 213 | | } |
| 0 | 214 | | } |
| | 215 | |
|
| | 216 | | internal Core.HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string applicationName, Applicat |
| | 217 | | { |
| 0 | 218 | | var message = _pipeline.CreateMessage(); |
| 0 | 219 | | var request = message.Request; |
| 0 | 220 | | request.Method = RequestMethod.Put; |
| 0 | 221 | | var uri = new RawRequestUriBuilder(); |
| 0 | 222 | | uri.Reset(endpoint); |
| 0 | 223 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 224 | | uri.AppendPath(subscriptionId, true); |
| 0 | 225 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 226 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 227 | | uri.AppendPath("/providers/Microsoft.Solutions/applications/", false); |
| 0 | 228 | | uri.AppendPath(applicationName, true); |
| 0 | 229 | | uri.AppendQuery("api-version", "2018-06-01", true); |
| 0 | 230 | | request.Uri = uri; |
| 0 | 231 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 232 | | var content = new Utf8JsonRequestContent(); |
| 0 | 233 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 234 | | request.Content = content; |
| 0 | 235 | | return message; |
| | 236 | | } |
| | 237 | |
|
| | 238 | | /// <summary> Creates a new managed application. </summary> |
| | 239 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 240 | | /// <param name="applicationName"> The name of the managed application. </param> |
| | 241 | | /// <param name="parameters"> Parameters supplied to the create or update a managed application. </param> |
| | 242 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 243 | | public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string applicationName, Application pa |
| | 244 | | { |
| 0 | 245 | | if (resourceGroupName == null) |
| | 246 | | { |
| 0 | 247 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 248 | | } |
| 0 | 249 | | if (applicationName == null) |
| | 250 | | { |
| 0 | 251 | | throw new ArgumentNullException(nameof(applicationName)); |
| | 252 | | } |
| 0 | 253 | | if (parameters == null) |
| | 254 | | { |
| 0 | 255 | | throw new ArgumentNullException(nameof(parameters)); |
| | 256 | | } |
| | 257 | |
|
| 0 | 258 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, applicationName, parameters); |
| 0 | 259 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 260 | | switch (message.Response.Status) |
| | 261 | | { |
| | 262 | | case 200: |
| | 263 | | case 201: |
| 0 | 264 | | return message.Response; |
| | 265 | | default: |
| 0 | 266 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 267 | | } |
| 0 | 268 | | } |
| | 269 | |
|
| | 270 | | /// <summary> Creates a new managed application. </summary> |
| | 271 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 272 | | /// <param name="applicationName"> The name of the managed application. </param> |
| | 273 | | /// <param name="parameters"> Parameters supplied to the create or update a managed application. </param> |
| | 274 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 275 | | public Response CreateOrUpdate(string resourceGroupName, string applicationName, Application parameters, Cancell |
| | 276 | | { |
| 0 | 277 | | if (resourceGroupName == null) |
| | 278 | | { |
| 0 | 279 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 280 | | } |
| 0 | 281 | | if (applicationName == null) |
| | 282 | | { |
| 0 | 283 | | throw new ArgumentNullException(nameof(applicationName)); |
| | 284 | | } |
| 0 | 285 | | if (parameters == null) |
| | 286 | | { |
| 0 | 287 | | throw new ArgumentNullException(nameof(parameters)); |
| | 288 | | } |
| | 289 | |
|
| 0 | 290 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, applicationName, parameters); |
| 0 | 291 | | _pipeline.Send(message, cancellationToken); |
| 0 | 292 | | switch (message.Response.Status) |
| | 293 | | { |
| | 294 | | case 200: |
| | 295 | | case 201: |
| 0 | 296 | | return message.Response; |
| | 297 | | default: |
| 0 | 298 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 299 | | } |
| 0 | 300 | | } |
| | 301 | |
|
| | 302 | | internal Core.HttpMessage CreateUpdateRequest(string resourceGroupName, string applicationName, Application para |
| | 303 | | { |
| 0 | 304 | | var message = _pipeline.CreateMessage(); |
| 0 | 305 | | var request = message.Request; |
| 0 | 306 | | request.Method = RequestMethod.Patch; |
| 0 | 307 | | var uri = new RawRequestUriBuilder(); |
| 0 | 308 | | uri.Reset(endpoint); |
| 0 | 309 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 310 | | uri.AppendPath(subscriptionId, true); |
| 0 | 311 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 312 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 313 | | uri.AppendPath("/providers/Microsoft.Solutions/applications/", false); |
| 0 | 314 | | uri.AppendPath(applicationName, true); |
| 0 | 315 | | uri.AppendQuery("api-version", "2018-06-01", true); |
| 0 | 316 | | request.Uri = uri; |
| 0 | 317 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 318 | | if (parameters != null) |
| | 319 | | { |
| 0 | 320 | | var content = new Utf8JsonRequestContent(); |
| 0 | 321 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 322 | | request.Content = content; |
| | 323 | | } |
| 0 | 324 | | return message; |
| | 325 | | } |
| | 326 | |
|
| | 327 | | /// <summary> Updates an existing managed application. The only value that can be updated via PATCH currently is |
| | 328 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 329 | | /// <param name="applicationName"> The name of the managed application. </param> |
| | 330 | | /// <param name="parameters"> Parameters supplied to update an existing managed application. </param> |
| | 331 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 332 | | public async Task<Response<Application>> UpdateAsync(string resourceGroupName, string applicationName, Applicati |
| | 333 | | { |
| 0 | 334 | | if (resourceGroupName == null) |
| | 335 | | { |
| 0 | 336 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 337 | | } |
| 0 | 338 | | if (applicationName == null) |
| | 339 | | { |
| 0 | 340 | | throw new ArgumentNullException(nameof(applicationName)); |
| | 341 | | } |
| | 342 | |
|
| 0 | 343 | | using var message = CreateUpdateRequest(resourceGroupName, applicationName, parameters); |
| 0 | 344 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 345 | | switch (message.Response.Status) |
| | 346 | | { |
| | 347 | | case 200: |
| | 348 | | { |
| 0 | 349 | | Application value = default; |
| 0 | 350 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 351 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 352 | | { |
| 0 | 353 | | value = null; |
| | 354 | | } |
| | 355 | | else |
| | 356 | | { |
| 0 | 357 | | value = Application.DeserializeApplication(document.RootElement); |
| | 358 | | } |
| 0 | 359 | | return Response.FromValue(value, message.Response); |
| | 360 | | } |
| | 361 | | default: |
| 0 | 362 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 363 | | } |
| 0 | 364 | | } |
| | 365 | |
|
| | 366 | | /// <summary> Updates an existing managed application. The only value that can be updated via PATCH currently is |
| | 367 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 368 | | /// <param name="applicationName"> The name of the managed application. </param> |
| | 369 | | /// <param name="parameters"> Parameters supplied to update an existing managed application. </param> |
| | 370 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 371 | | public Response<Application> Update(string resourceGroupName, string applicationName, Application parameters = n |
| | 372 | | { |
| 0 | 373 | | if (resourceGroupName == null) |
| | 374 | | { |
| 0 | 375 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 376 | | } |
| 0 | 377 | | if (applicationName == null) |
| | 378 | | { |
| 0 | 379 | | throw new ArgumentNullException(nameof(applicationName)); |
| | 380 | | } |
| | 381 | |
|
| 0 | 382 | | using var message = CreateUpdateRequest(resourceGroupName, applicationName, parameters); |
| 0 | 383 | | _pipeline.Send(message, cancellationToken); |
| 0 | 384 | | switch (message.Response.Status) |
| | 385 | | { |
| | 386 | | case 200: |
| | 387 | | { |
| 0 | 388 | | Application value = default; |
| 0 | 389 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 390 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 391 | | { |
| 0 | 392 | | value = null; |
| | 393 | | } |
| | 394 | | else |
| | 395 | | { |
| 0 | 396 | | value = Application.DeserializeApplication(document.RootElement); |
| | 397 | | } |
| 0 | 398 | | return Response.FromValue(value, message.Response); |
| | 399 | | } |
| | 400 | | default: |
| 0 | 401 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 402 | | } |
| 0 | 403 | | } |
| | 404 | |
|
| | 405 | | internal Core.HttpMessage CreateListByResourceGroupRequest(string resourceGroupName) |
| | 406 | | { |
| 0 | 407 | | var message = _pipeline.CreateMessage(); |
| 0 | 408 | | var request = message.Request; |
| 0 | 409 | | request.Method = RequestMethod.Get; |
| 0 | 410 | | var uri = new RawRequestUriBuilder(); |
| 0 | 411 | | uri.Reset(endpoint); |
| 0 | 412 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 413 | | uri.AppendPath(subscriptionId, true); |
| 0 | 414 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 415 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 416 | | uri.AppendPath("/providers/Microsoft.Solutions/applications", false); |
| 0 | 417 | | uri.AppendQuery("api-version", "2018-06-01", true); |
| 0 | 418 | | request.Uri = uri; |
| 0 | 419 | | return message; |
| | 420 | | } |
| | 421 | |
|
| | 422 | | /// <summary> Gets all the applications within a resource group. </summary> |
| | 423 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 424 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 425 | | public async Task<Response<ApplicationListResult>> ListByResourceGroupAsync(string resourceGroupName, Cancellati |
| | 426 | | { |
| 0 | 427 | | if (resourceGroupName == null) |
| | 428 | | { |
| 0 | 429 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 430 | | } |
| | 431 | |
|
| 0 | 432 | | using var message = CreateListByResourceGroupRequest(resourceGroupName); |
| 0 | 433 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 434 | | switch (message.Response.Status) |
| | 435 | | { |
| | 436 | | case 200: |
| | 437 | | { |
| 0 | 438 | | ApplicationListResult value = default; |
| 0 | 439 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 440 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 441 | | { |
| 0 | 442 | | value = null; |
| | 443 | | } |
| | 444 | | else |
| | 445 | | { |
| 0 | 446 | | value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); |
| | 447 | | } |
| 0 | 448 | | return Response.FromValue(value, message.Response); |
| | 449 | | } |
| | 450 | | default: |
| 0 | 451 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 452 | | } |
| 0 | 453 | | } |
| | 454 | |
|
| | 455 | | /// <summary> Gets all the applications within a resource group. </summary> |
| | 456 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 457 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 458 | | public Response<ApplicationListResult> ListByResourceGroup(string resourceGroupName, CancellationToken cancellat |
| | 459 | | { |
| 0 | 460 | | if (resourceGroupName == null) |
| | 461 | | { |
| 0 | 462 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 463 | | } |
| | 464 | |
|
| 0 | 465 | | using var message = CreateListByResourceGroupRequest(resourceGroupName); |
| 0 | 466 | | _pipeline.Send(message, cancellationToken); |
| 0 | 467 | | switch (message.Response.Status) |
| | 468 | | { |
| | 469 | | case 200: |
| | 470 | | { |
| 0 | 471 | | ApplicationListResult value = default; |
| 0 | 472 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 473 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 474 | | { |
| 0 | 475 | | value = null; |
| | 476 | | } |
| | 477 | | else |
| | 478 | | { |
| 0 | 479 | | value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); |
| | 480 | | } |
| 0 | 481 | | return Response.FromValue(value, message.Response); |
| | 482 | | } |
| | 483 | | default: |
| 0 | 484 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 485 | | } |
| 0 | 486 | | } |
| | 487 | |
|
| | 488 | | internal Core.HttpMessage CreateListBySubscriptionRequest() |
| | 489 | | { |
| 0 | 490 | | var message = _pipeline.CreateMessage(); |
| 0 | 491 | | var request = message.Request; |
| 0 | 492 | | request.Method = RequestMethod.Get; |
| 0 | 493 | | var uri = new RawRequestUriBuilder(); |
| 0 | 494 | | uri.Reset(endpoint); |
| 0 | 495 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 496 | | uri.AppendPath(subscriptionId, true); |
| 0 | 497 | | uri.AppendPath("/providers/Microsoft.Solutions/applications", false); |
| 0 | 498 | | uri.AppendQuery("api-version", "2018-06-01", true); |
| 0 | 499 | | request.Uri = uri; |
| 0 | 500 | | return message; |
| | 501 | | } |
| | 502 | |
|
| | 503 | | /// <summary> Gets all the applications within a subscription. </summary> |
| | 504 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 505 | | public async Task<Response<ApplicationListResult>> ListBySubscriptionAsync(CancellationToken cancellationToken = |
| | 506 | | { |
| 0 | 507 | | using var message = CreateListBySubscriptionRequest(); |
| 0 | 508 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 509 | | switch (message.Response.Status) |
| | 510 | | { |
| | 511 | | case 200: |
| | 512 | | { |
| 0 | 513 | | ApplicationListResult value = default; |
| 0 | 514 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 515 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 516 | | { |
| 0 | 517 | | value = null; |
| | 518 | | } |
| | 519 | | else |
| | 520 | | { |
| 0 | 521 | | value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); |
| | 522 | | } |
| 0 | 523 | | return Response.FromValue(value, message.Response); |
| | 524 | | } |
| | 525 | | default: |
| 0 | 526 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 527 | | } |
| 0 | 528 | | } |
| | 529 | |
|
| | 530 | | /// <summary> Gets all the applications within a subscription. </summary> |
| | 531 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 532 | | public Response<ApplicationListResult> ListBySubscription(CancellationToken cancellationToken = default) |
| | 533 | | { |
| 0 | 534 | | using var message = CreateListBySubscriptionRequest(); |
| 0 | 535 | | _pipeline.Send(message, cancellationToken); |
| 0 | 536 | | switch (message.Response.Status) |
| | 537 | | { |
| | 538 | | case 200: |
| | 539 | | { |
| 0 | 540 | | ApplicationListResult value = default; |
| 0 | 541 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 542 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 543 | | { |
| 0 | 544 | | value = null; |
| | 545 | | } |
| | 546 | | else |
| | 547 | | { |
| 0 | 548 | | value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); |
| | 549 | | } |
| 0 | 550 | | return Response.FromValue(value, message.Response); |
| | 551 | | } |
| | 552 | | default: |
| 0 | 553 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 554 | | } |
| 0 | 555 | | } |
| | 556 | |
|
| | 557 | | internal Core.HttpMessage CreateGetByIdRequest(string applicationId) |
| | 558 | | { |
| 0 | 559 | | var message = _pipeline.CreateMessage(); |
| 0 | 560 | | var request = message.Request; |
| 0 | 561 | | request.Method = RequestMethod.Get; |
| 0 | 562 | | var uri = new RawRequestUriBuilder(); |
| 0 | 563 | | uri.Reset(endpoint); |
| 0 | 564 | | uri.AppendPath("/", false); |
| 0 | 565 | | uri.AppendPath(applicationId, false); |
| 0 | 566 | | uri.AppendQuery("api-version", "2018-06-01", true); |
| 0 | 567 | | request.Uri = uri; |
| 0 | 568 | | return message; |
| | 569 | | } |
| | 570 | |
|
| | 571 | | /// <summary> Gets the managed application. </summary> |
| | 572 | | /// <param name="applicationId"> The fully qualified ID of the managed application, including the managed applic |
| | 573 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 574 | | public async Task<Response<Application>> GetByIdAsync(string applicationId, CancellationToken cancellationToken |
| | 575 | | { |
| 0 | 576 | | if (applicationId == null) |
| | 577 | | { |
| 0 | 578 | | throw new ArgumentNullException(nameof(applicationId)); |
| | 579 | | } |
| | 580 | |
|
| 0 | 581 | | using var message = CreateGetByIdRequest(applicationId); |
| 0 | 582 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 583 | | switch (message.Response.Status) |
| | 584 | | { |
| | 585 | | case 200: |
| | 586 | | { |
| 0 | 587 | | Application value = default; |
| 0 | 588 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 589 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 590 | | { |
| 0 | 591 | | value = null; |
| | 592 | | } |
| | 593 | | else |
| | 594 | | { |
| 0 | 595 | | value = Application.DeserializeApplication(document.RootElement); |
| | 596 | | } |
| 0 | 597 | | return Response.FromValue(value, message.Response); |
| | 598 | | } |
| | 599 | | case 404: |
| 0 | 600 | | return Response.FromValue<Application>(null, message.Response); |
| | 601 | | default: |
| 0 | 602 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 603 | | } |
| 0 | 604 | | } |
| | 605 | |
|
| | 606 | | /// <summary> Gets the managed application. </summary> |
| | 607 | | /// <param name="applicationId"> The fully qualified ID of the managed application, including the managed applic |
| | 608 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 609 | | public Response<Application> GetById(string applicationId, CancellationToken cancellationToken = default) |
| | 610 | | { |
| 0 | 611 | | if (applicationId == null) |
| | 612 | | { |
| 0 | 613 | | throw new ArgumentNullException(nameof(applicationId)); |
| | 614 | | } |
| | 615 | |
|
| 0 | 616 | | using var message = CreateGetByIdRequest(applicationId); |
| 0 | 617 | | _pipeline.Send(message, cancellationToken); |
| 0 | 618 | | switch (message.Response.Status) |
| | 619 | | { |
| | 620 | | case 200: |
| | 621 | | { |
| 0 | 622 | | Application value = default; |
| 0 | 623 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 624 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 625 | | { |
| 0 | 626 | | value = null; |
| | 627 | | } |
| | 628 | | else |
| | 629 | | { |
| 0 | 630 | | value = Application.DeserializeApplication(document.RootElement); |
| | 631 | | } |
| 0 | 632 | | return Response.FromValue(value, message.Response); |
| | 633 | | } |
| | 634 | | case 404: |
| 0 | 635 | | return Response.FromValue<Application>(null, message.Response); |
| | 636 | | default: |
| 0 | 637 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 638 | | } |
| 0 | 639 | | } |
| | 640 | |
|
| | 641 | | internal Core.HttpMessage CreateDeleteByIdRequest(string applicationId) |
| | 642 | | { |
| 0 | 643 | | var message = _pipeline.CreateMessage(); |
| 0 | 644 | | var request = message.Request; |
| 0 | 645 | | request.Method = RequestMethod.Delete; |
| 0 | 646 | | var uri = new RawRequestUriBuilder(); |
| 0 | 647 | | uri.Reset(endpoint); |
| 0 | 648 | | uri.AppendPath("/", false); |
| 0 | 649 | | uri.AppendPath(applicationId, false); |
| 0 | 650 | | uri.AppendQuery("api-version", "2018-06-01", true); |
| 0 | 651 | | request.Uri = uri; |
| 0 | 652 | | return message; |
| | 653 | | } |
| | 654 | |
|
| | 655 | | /// <summary> Deletes the managed application. </summary> |
| | 656 | | /// <param name="applicationId"> The fully qualified ID of the managed application, including the managed applic |
| | 657 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 658 | | public async Task<Response> DeleteByIdAsync(string applicationId, CancellationToken cancellationToken = default) |
| | 659 | | { |
| 0 | 660 | | if (applicationId == null) |
| | 661 | | { |
| 0 | 662 | | throw new ArgumentNullException(nameof(applicationId)); |
| | 663 | | } |
| | 664 | |
|
| 0 | 665 | | using var message = CreateDeleteByIdRequest(applicationId); |
| 0 | 666 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 667 | | switch (message.Response.Status) |
| | 668 | | { |
| | 669 | | case 202: |
| | 670 | | case 204: |
| 0 | 671 | | return message.Response; |
| | 672 | | default: |
| 0 | 673 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 674 | | } |
| 0 | 675 | | } |
| | 676 | |
|
| | 677 | | /// <summary> Deletes the managed application. </summary> |
| | 678 | | /// <param name="applicationId"> The fully qualified ID of the managed application, including the managed applic |
| | 679 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 680 | | public Response DeleteById(string applicationId, CancellationToken cancellationToken = default) |
| | 681 | | { |
| 0 | 682 | | if (applicationId == null) |
| | 683 | | { |
| 0 | 684 | | throw new ArgumentNullException(nameof(applicationId)); |
| | 685 | | } |
| | 686 | |
|
| 0 | 687 | | using var message = CreateDeleteByIdRequest(applicationId); |
| 0 | 688 | | _pipeline.Send(message, cancellationToken); |
| 0 | 689 | | switch (message.Response.Status) |
| | 690 | | { |
| | 691 | | case 202: |
| | 692 | | case 204: |
| 0 | 693 | | return message.Response; |
| | 694 | | default: |
| 0 | 695 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 696 | | } |
| 0 | 697 | | } |
| | 698 | |
|
| | 699 | | internal Core.HttpMessage CreateCreateOrUpdateByIdRequest(string applicationId, Application parameters) |
| | 700 | | { |
| 0 | 701 | | var message = _pipeline.CreateMessage(); |
| 0 | 702 | | var request = message.Request; |
| 0 | 703 | | request.Method = RequestMethod.Put; |
| 0 | 704 | | var uri = new RawRequestUriBuilder(); |
| 0 | 705 | | uri.Reset(endpoint); |
| 0 | 706 | | uri.AppendPath("/", false); |
| 0 | 707 | | uri.AppendPath(applicationId, false); |
| 0 | 708 | | uri.AppendQuery("api-version", "2018-06-01", true); |
| 0 | 709 | | request.Uri = uri; |
| 0 | 710 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 711 | | var content = new Utf8JsonRequestContent(); |
| 0 | 712 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 713 | | request.Content = content; |
| 0 | 714 | | return message; |
| | 715 | | } |
| | 716 | |
|
| | 717 | | /// <summary> Creates a new managed application. </summary> |
| | 718 | | /// <param name="applicationId"> The fully qualified ID of the managed application, including the managed applic |
| | 719 | | /// <param name="parameters"> Parameters supplied to the create or update a managed application. </param> |
| | 720 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 721 | | public async Task<Response> CreateOrUpdateByIdAsync(string applicationId, Application parameters, CancellationTo |
| | 722 | | { |
| 0 | 723 | | if (applicationId == null) |
| | 724 | | { |
| 0 | 725 | | throw new ArgumentNullException(nameof(applicationId)); |
| | 726 | | } |
| 0 | 727 | | if (parameters == null) |
| | 728 | | { |
| 0 | 729 | | throw new ArgumentNullException(nameof(parameters)); |
| | 730 | | } |
| | 731 | |
|
| 0 | 732 | | using var message = CreateCreateOrUpdateByIdRequest(applicationId, parameters); |
| 0 | 733 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 734 | | switch (message.Response.Status) |
| | 735 | | { |
| | 736 | | case 200: |
| | 737 | | case 201: |
| 0 | 738 | | return message.Response; |
| | 739 | | default: |
| 0 | 740 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 741 | | } |
| 0 | 742 | | } |
| | 743 | |
|
| | 744 | | /// <summary> Creates a new managed application. </summary> |
| | 745 | | /// <param name="applicationId"> The fully qualified ID of the managed application, including the managed applic |
| | 746 | | /// <param name="parameters"> Parameters supplied to the create or update a managed application. </param> |
| | 747 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 748 | | public Response CreateOrUpdateById(string applicationId, Application parameters, CancellationToken cancellationT |
| | 749 | | { |
| 0 | 750 | | if (applicationId == null) |
| | 751 | | { |
| 0 | 752 | | throw new ArgumentNullException(nameof(applicationId)); |
| | 753 | | } |
| 0 | 754 | | if (parameters == null) |
| | 755 | | { |
| 0 | 756 | | throw new ArgumentNullException(nameof(parameters)); |
| | 757 | | } |
| | 758 | |
|
| 0 | 759 | | using var message = CreateCreateOrUpdateByIdRequest(applicationId, parameters); |
| 0 | 760 | | _pipeline.Send(message, cancellationToken); |
| 0 | 761 | | switch (message.Response.Status) |
| | 762 | | { |
| | 763 | | case 200: |
| | 764 | | case 201: |
| 0 | 765 | | return message.Response; |
| | 766 | | default: |
| 0 | 767 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 768 | | } |
| 0 | 769 | | } |
| | 770 | |
|
| | 771 | | internal Core.HttpMessage CreateUpdateByIdRequest(string applicationId, Application parameters) |
| | 772 | | { |
| 0 | 773 | | var message = _pipeline.CreateMessage(); |
| 0 | 774 | | var request = message.Request; |
| 0 | 775 | | request.Method = RequestMethod.Patch; |
| 0 | 776 | | var uri = new RawRequestUriBuilder(); |
| 0 | 777 | | uri.Reset(endpoint); |
| 0 | 778 | | uri.AppendPath("/", false); |
| 0 | 779 | | uri.AppendPath(applicationId, false); |
| 0 | 780 | | uri.AppendQuery("api-version", "2018-06-01", true); |
| 0 | 781 | | request.Uri = uri; |
| 0 | 782 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 783 | | if (parameters != null) |
| | 784 | | { |
| 0 | 785 | | var content = new Utf8JsonRequestContent(); |
| 0 | 786 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 787 | | request.Content = content; |
| | 788 | | } |
| 0 | 789 | | return message; |
| | 790 | | } |
| | 791 | |
|
| | 792 | | /// <summary> Updates an existing managed application. The only value that can be updated via PATCH currently is |
| | 793 | | /// <param name="applicationId"> The fully qualified ID of the managed application, including the managed applic |
| | 794 | | /// <param name="parameters"> Parameters supplied to update an existing managed application. </param> |
| | 795 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 796 | | public async Task<Response<Application>> UpdateByIdAsync(string applicationId, Application parameters = null, Ca |
| | 797 | | { |
| 0 | 798 | | if (applicationId == null) |
| | 799 | | { |
| 0 | 800 | | throw new ArgumentNullException(nameof(applicationId)); |
| | 801 | | } |
| | 802 | |
|
| 0 | 803 | | using var message = CreateUpdateByIdRequest(applicationId, parameters); |
| 0 | 804 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 805 | | switch (message.Response.Status) |
| | 806 | | { |
| | 807 | | case 200: |
| | 808 | | { |
| 0 | 809 | | Application value = default; |
| 0 | 810 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 811 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 812 | | { |
| 0 | 813 | | value = null; |
| | 814 | | } |
| | 815 | | else |
| | 816 | | { |
| 0 | 817 | | value = Application.DeserializeApplication(document.RootElement); |
| | 818 | | } |
| 0 | 819 | | return Response.FromValue(value, message.Response); |
| | 820 | | } |
| | 821 | | default: |
| 0 | 822 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 823 | | } |
| 0 | 824 | | } |
| | 825 | |
|
| | 826 | | /// <summary> Updates an existing managed application. The only value that can be updated via PATCH currently is |
| | 827 | | /// <param name="applicationId"> The fully qualified ID of the managed application, including the managed applic |
| | 828 | | /// <param name="parameters"> Parameters supplied to update an existing managed application. </param> |
| | 829 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 830 | | public Response<Application> UpdateById(string applicationId, Application parameters = null, CancellationToken c |
| | 831 | | { |
| 0 | 832 | | if (applicationId == null) |
| | 833 | | { |
| 0 | 834 | | throw new ArgumentNullException(nameof(applicationId)); |
| | 835 | | } |
| | 836 | |
|
| 0 | 837 | | using var message = CreateUpdateByIdRequest(applicationId, parameters); |
| 0 | 838 | | _pipeline.Send(message, cancellationToken); |
| 0 | 839 | | switch (message.Response.Status) |
| | 840 | | { |
| | 841 | | case 200: |
| | 842 | | { |
| 0 | 843 | | Application value = default; |
| 0 | 844 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 845 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 846 | | { |
| 0 | 847 | | value = null; |
| | 848 | | } |
| | 849 | | else |
| | 850 | | { |
| 0 | 851 | | value = Application.DeserializeApplication(document.RootElement); |
| | 852 | | } |
| 0 | 853 | | return Response.FromValue(value, message.Response); |
| | 854 | | } |
| | 855 | | default: |
| 0 | 856 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 857 | | } |
| 0 | 858 | | } |
| | 859 | |
|
| | 860 | | internal Core.HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName) |
| | 861 | | { |
| 0 | 862 | | var message = _pipeline.CreateMessage(); |
| 0 | 863 | | var request = message.Request; |
| 0 | 864 | | request.Method = RequestMethod.Get; |
| 0 | 865 | | var uri = new RawRequestUriBuilder(); |
| 0 | 866 | | uri.Reset(endpoint); |
| 0 | 867 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 868 | | request.Uri = uri; |
| 0 | 869 | | return message; |
| | 870 | | } |
| | 871 | |
|
| | 872 | | /// <summary> Gets all the applications within a resource group. </summary> |
| | 873 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 874 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 875 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 876 | | public async Task<Response<ApplicationListResult>> ListByResourceGroupNextPageAsync(string nextLink, string reso |
| | 877 | | { |
| 0 | 878 | | if (nextLink == null) |
| | 879 | | { |
| 0 | 880 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 881 | | } |
| 0 | 882 | | if (resourceGroupName == null) |
| | 883 | | { |
| 0 | 884 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 885 | | } |
| | 886 | |
|
| 0 | 887 | | using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); |
| 0 | 888 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 889 | | switch (message.Response.Status) |
| | 890 | | { |
| | 891 | | case 200: |
| | 892 | | { |
| 0 | 893 | | ApplicationListResult value = default; |
| 0 | 894 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 895 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 896 | | { |
| 0 | 897 | | value = null; |
| | 898 | | } |
| | 899 | | else |
| | 900 | | { |
| 0 | 901 | | value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); |
| | 902 | | } |
| 0 | 903 | | return Response.FromValue(value, message.Response); |
| | 904 | | } |
| | 905 | | default: |
| 0 | 906 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 907 | | } |
| 0 | 908 | | } |
| | 909 | |
|
| | 910 | | /// <summary> Gets all the applications within a resource group. </summary> |
| | 911 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 912 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 913 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 914 | | public Response<ApplicationListResult> ListByResourceGroupNextPage(string nextLink, string resourceGroupName, Ca |
| | 915 | | { |
| 0 | 916 | | if (nextLink == null) |
| | 917 | | { |
| 0 | 918 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 919 | | } |
| 0 | 920 | | if (resourceGroupName == null) |
| | 921 | | { |
| 0 | 922 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 923 | | } |
| | 924 | |
|
| 0 | 925 | | using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); |
| 0 | 926 | | _pipeline.Send(message, cancellationToken); |
| 0 | 927 | | switch (message.Response.Status) |
| | 928 | | { |
| | 929 | | case 200: |
| | 930 | | { |
| 0 | 931 | | ApplicationListResult value = default; |
| 0 | 932 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 933 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 934 | | { |
| 0 | 935 | | value = null; |
| | 936 | | } |
| | 937 | | else |
| | 938 | | { |
| 0 | 939 | | value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); |
| | 940 | | } |
| 0 | 941 | | return Response.FromValue(value, message.Response); |
| | 942 | | } |
| | 943 | | default: |
| 0 | 944 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 945 | | } |
| 0 | 946 | | } |
| | 947 | |
|
| | 948 | | internal Core.HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink) |
| | 949 | | { |
| 0 | 950 | | var message = _pipeline.CreateMessage(); |
| 0 | 951 | | var request = message.Request; |
| 0 | 952 | | request.Method = RequestMethod.Get; |
| 0 | 953 | | var uri = new RawRequestUriBuilder(); |
| 0 | 954 | | uri.Reset(endpoint); |
| 0 | 955 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 956 | | request.Uri = uri; |
| 0 | 957 | | return message; |
| | 958 | | } |
| | 959 | |
|
| | 960 | | /// <summary> Gets all the applications within a subscription. </summary> |
| | 961 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 962 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 963 | | public async Task<Response<ApplicationListResult>> ListBySubscriptionNextPageAsync(string nextLink, Cancellation |
| | 964 | | { |
| 0 | 965 | | if (nextLink == null) |
| | 966 | | { |
| 0 | 967 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 968 | | } |
| | 969 | |
|
| 0 | 970 | | using var message = CreateListBySubscriptionNextPageRequest(nextLink); |
| 0 | 971 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 972 | | switch (message.Response.Status) |
| | 973 | | { |
| | 974 | | case 200: |
| | 975 | | { |
| 0 | 976 | | ApplicationListResult value = default; |
| 0 | 977 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 978 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 979 | | { |
| 0 | 980 | | value = null; |
| | 981 | | } |
| | 982 | | else |
| | 983 | | { |
| 0 | 984 | | value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); |
| | 985 | | } |
| 0 | 986 | | return Response.FromValue(value, message.Response); |
| | 987 | | } |
| | 988 | | default: |
| 0 | 989 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 990 | | } |
| 0 | 991 | | } |
| | 992 | |
|
| | 993 | | /// <summary> Gets all the applications within a subscription. </summary> |
| | 994 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 995 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 996 | | public Response<ApplicationListResult> ListBySubscriptionNextPage(string nextLink, CancellationToken cancellatio |
| | 997 | | { |
| 0 | 998 | | if (nextLink == null) |
| | 999 | | { |
| 0 | 1000 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1001 | | } |
| | 1002 | |
|
| 0 | 1003 | | using var message = CreateListBySubscriptionNextPageRequest(nextLink); |
| 0 | 1004 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1005 | | switch (message.Response.Status) |
| | 1006 | | { |
| | 1007 | | case 200: |
| | 1008 | | { |
| 0 | 1009 | | ApplicationListResult value = default; |
| 0 | 1010 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 1011 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1012 | | { |
| 0 | 1013 | | value = null; |
| | 1014 | | } |
| | 1015 | | else |
| | 1016 | | { |
| 0 | 1017 | | value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); |
| | 1018 | | } |
| 0 | 1019 | | return Response.FromValue(value, message.Response); |
| | 1020 | | } |
| | 1021 | | default: |
| 0 | 1022 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1023 | | } |
| 0 | 1024 | | } |
| | 1025 | | } |
| | 1026 | | } |