| | 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 ProvidersRestOperations |
| | 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 ProvidersRestOperations. </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 |
| 284 | 32 | | public ProvidersRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId |
| | 33 | | { |
| 284 | 34 | | if (subscriptionId == null) |
| | 35 | | { |
| 0 | 36 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 37 | | } |
| 284 | 38 | | endpoint ??= new Uri("https://management.azure.com"); |
| | 39 | |
|
| 284 | 40 | | this.subscriptionId = subscriptionId; |
| 284 | 41 | | this.endpoint = endpoint; |
| 284 | 42 | | _clientDiagnostics = clientDiagnostics; |
| 284 | 43 | | _pipeline = pipeline; |
| 284 | 44 | | } |
| | 45 | |
|
| | 46 | | internal Core.HttpMessage CreateUnregisterRequest(string resourceProviderNamespace) |
| | 47 | | { |
| 8 | 48 | | var message = _pipeline.CreateMessage(); |
| 8 | 49 | | var request = message.Request; |
| 8 | 50 | | request.Method = RequestMethod.Post; |
| 8 | 51 | | var uri = new RawRequestUriBuilder(); |
| 8 | 52 | | uri.Reset(endpoint); |
| 8 | 53 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 54 | | uri.AppendPath(subscriptionId, true); |
| 8 | 55 | | uri.AppendPath("/providers/", false); |
| 8 | 56 | | uri.AppendPath(resourceProviderNamespace, true); |
| 8 | 57 | | uri.AppendPath("/unregister", false); |
| 8 | 58 | | uri.AppendQuery("api-version", "2019-10-01", true); |
| 8 | 59 | | request.Uri = uri; |
| 8 | 60 | | return message; |
| | 61 | | } |
| | 62 | |
|
| | 63 | | /// <summary> Unregisters a subscription from a resource provider. </summary> |
| | 64 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider to unregister. </param> |
| | 65 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 66 | | public async Task<Response<Provider>> UnregisterAsync(string resourceProviderNamespace, CancellationToken cancel |
| | 67 | | { |
| 6 | 68 | | if (resourceProviderNamespace == null) |
| | 69 | | { |
| 2 | 70 | | throw new ArgumentNullException(nameof(resourceProviderNamespace)); |
| | 71 | | } |
| | 72 | |
|
| 4 | 73 | | using var message = CreateUnregisterRequest(resourceProviderNamespace); |
| 4 | 74 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 4 | 75 | | switch (message.Response.Status) |
| | 76 | | { |
| | 77 | | case 200: |
| | 78 | | { |
| 4 | 79 | | Provider value = default; |
| 4 | 80 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 4 | 81 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 82 | | { |
| 0 | 83 | | value = null; |
| | 84 | | } |
| | 85 | | else |
| | 86 | | { |
| 4 | 87 | | value = Provider.DeserializeProvider(document.RootElement); |
| | 88 | | } |
| 4 | 89 | | return Response.FromValue(value, message.Response); |
| | 90 | | } |
| | 91 | | default: |
| 0 | 92 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 93 | | } |
| 4 | 94 | | } |
| | 95 | |
|
| | 96 | | /// <summary> Unregisters a subscription from a resource provider. </summary> |
| | 97 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider to unregister. </param> |
| | 98 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 99 | | public Response<Provider> Unregister(string resourceProviderNamespace, CancellationToken cancellationToken = def |
| | 100 | | { |
| 6 | 101 | | if (resourceProviderNamespace == null) |
| | 102 | | { |
| 2 | 103 | | throw new ArgumentNullException(nameof(resourceProviderNamespace)); |
| | 104 | | } |
| | 105 | |
|
| 4 | 106 | | using var message = CreateUnregisterRequest(resourceProviderNamespace); |
| 4 | 107 | | _pipeline.Send(message, cancellationToken); |
| 4 | 108 | | switch (message.Response.Status) |
| | 109 | | { |
| | 110 | | case 200: |
| | 111 | | { |
| 4 | 112 | | Provider value = default; |
| 4 | 113 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 4 | 114 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 115 | | { |
| 0 | 116 | | value = null; |
| | 117 | | } |
| | 118 | | else |
| | 119 | | { |
| 4 | 120 | | value = Provider.DeserializeProvider(document.RootElement); |
| | 121 | | } |
| 4 | 122 | | return Response.FromValue(value, message.Response); |
| | 123 | | } |
| | 124 | | default: |
| 0 | 125 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 126 | | } |
| 4 | 127 | | } |
| | 128 | |
|
| | 129 | | internal Core.HttpMessage CreateRegisterRequest(string resourceProviderNamespace) |
| | 130 | | { |
| 24 | 131 | | var message = _pipeline.CreateMessage(); |
| 24 | 132 | | var request = message.Request; |
| 24 | 133 | | request.Method = RequestMethod.Post; |
| 24 | 134 | | var uri = new RawRequestUriBuilder(); |
| 24 | 135 | | uri.Reset(endpoint); |
| 24 | 136 | | uri.AppendPath("/subscriptions/", false); |
| 24 | 137 | | uri.AppendPath(subscriptionId, true); |
| 24 | 138 | | uri.AppendPath("/providers/", false); |
| 24 | 139 | | uri.AppendPath(resourceProviderNamespace, true); |
| 24 | 140 | | uri.AppendPath("/register", false); |
| 24 | 141 | | uri.AppendQuery("api-version", "2019-10-01", true); |
| 24 | 142 | | request.Uri = uri; |
| 24 | 143 | | return message; |
| | 144 | | } |
| | 145 | |
|
| | 146 | | /// <summary> Registers a subscription with a resource provider. </summary> |
| | 147 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider to register. </param> |
| | 148 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 149 | | public async Task<Response<Provider>> RegisterAsync(string resourceProviderNamespace, CancellationToken cancella |
| | 150 | | { |
| 14 | 151 | | if (resourceProviderNamespace == null) |
| | 152 | | { |
| 2 | 153 | | throw new ArgumentNullException(nameof(resourceProviderNamespace)); |
| | 154 | | } |
| | 155 | |
|
| 12 | 156 | | using var message = CreateRegisterRequest(resourceProviderNamespace); |
| 12 | 157 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 12 | 158 | | switch (message.Response.Status) |
| | 159 | | { |
| | 160 | | case 200: |
| | 161 | | { |
| 12 | 162 | | Provider value = default; |
| 12 | 163 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 12 | 164 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 165 | | { |
| 0 | 166 | | value = null; |
| | 167 | | } |
| | 168 | | else |
| | 169 | | { |
| 12 | 170 | | value = Provider.DeserializeProvider(document.RootElement); |
| | 171 | | } |
| 12 | 172 | | return Response.FromValue(value, message.Response); |
| | 173 | | } |
| | 174 | | default: |
| 0 | 175 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 176 | | } |
| 12 | 177 | | } |
| | 178 | |
|
| | 179 | | /// <summary> Registers a subscription with a resource provider. </summary> |
| | 180 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider to register. </param> |
| | 181 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 182 | | public Response<Provider> Register(string resourceProviderNamespace, CancellationToken cancellationToken = defau |
| | 183 | | { |
| 14 | 184 | | if (resourceProviderNamespace == null) |
| | 185 | | { |
| 2 | 186 | | throw new ArgumentNullException(nameof(resourceProviderNamespace)); |
| | 187 | | } |
| | 188 | |
|
| 12 | 189 | | using var message = CreateRegisterRequest(resourceProviderNamespace); |
| 12 | 190 | | _pipeline.Send(message, cancellationToken); |
| 12 | 191 | | switch (message.Response.Status) |
| | 192 | | { |
| | 193 | | case 200: |
| | 194 | | { |
| 12 | 195 | | Provider value = default; |
| 12 | 196 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 12 | 197 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 198 | | { |
| 0 | 199 | | value = null; |
| | 200 | | } |
| | 201 | | else |
| | 202 | | { |
| 12 | 203 | | value = Provider.DeserializeProvider(document.RootElement); |
| | 204 | | } |
| 12 | 205 | | return Response.FromValue(value, message.Response); |
| | 206 | | } |
| | 207 | | default: |
| 0 | 208 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 209 | | } |
| 12 | 210 | | } |
| | 211 | |
|
| | 212 | | internal Core.HttpMessage CreateListRequest(int? top, string expand) |
| | 213 | | { |
| 12 | 214 | | var message = _pipeline.CreateMessage(); |
| 12 | 215 | | var request = message.Request; |
| 12 | 216 | | request.Method = RequestMethod.Get; |
| 12 | 217 | | var uri = new RawRequestUriBuilder(); |
| 12 | 218 | | uri.Reset(endpoint); |
| 12 | 219 | | uri.AppendPath("/subscriptions/", false); |
| 12 | 220 | | uri.AppendPath(subscriptionId, true); |
| 12 | 221 | | uri.AppendPath("/providers", false); |
| 12 | 222 | | if (top != null) |
| | 223 | | { |
| 0 | 224 | | uri.AppendQuery("$top", top.Value, true); |
| | 225 | | } |
| 12 | 226 | | if (expand != null) |
| | 227 | | { |
| 4 | 228 | | uri.AppendQuery("$expand", expand, true); |
| | 229 | | } |
| 12 | 230 | | uri.AppendQuery("api-version", "2019-10-01", true); |
| 12 | 231 | | request.Uri = uri; |
| 12 | 232 | | return message; |
| | 233 | | } |
| | 234 | |
|
| | 235 | | /// <summary> Gets all resource providers for a subscription. </summary> |
| | 236 | | /// <param name="top"> The number of results to return. If null is passed returns all deployments. </param> |
| | 237 | | /// <param name="expand"> The properties to include in the results. For example, use &$expand=metadata in th |
| | 238 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 239 | | public async Task<Response<ProviderListResult>> ListAsync(int? top = null, string expand = null, CancellationTok |
| | 240 | | { |
| 6 | 241 | | using var message = CreateListRequest(top, expand); |
| 6 | 242 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 6 | 243 | | switch (message.Response.Status) |
| | 244 | | { |
| | 245 | | case 200: |
| | 246 | | { |
| 6 | 247 | | ProviderListResult value = default; |
| 6 | 248 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 6 | 249 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 250 | | { |
| 0 | 251 | | value = null; |
| | 252 | | } |
| | 253 | | else |
| | 254 | | { |
| 6 | 255 | | value = ProviderListResult.DeserializeProviderListResult(document.RootElement); |
| | 256 | | } |
| 6 | 257 | | return Response.FromValue(value, message.Response); |
| | 258 | | } |
| | 259 | | default: |
| 0 | 260 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 261 | | } |
| 6 | 262 | | } |
| | 263 | |
|
| | 264 | | /// <summary> Gets all resource providers for a subscription. </summary> |
| | 265 | | /// <param name="top"> The number of results to return. If null is passed returns all deployments. </param> |
| | 266 | | /// <param name="expand"> The properties to include in the results. For example, use &$expand=metadata in th |
| | 267 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 268 | | public Response<ProviderListResult> List(int? top = null, string expand = null, CancellationToken cancellationTo |
| | 269 | | { |
| 6 | 270 | | using var message = CreateListRequest(top, expand); |
| 6 | 271 | | _pipeline.Send(message, cancellationToken); |
| 6 | 272 | | switch (message.Response.Status) |
| | 273 | | { |
| | 274 | | case 200: |
| | 275 | | { |
| 6 | 276 | | ProviderListResult value = default; |
| 6 | 277 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 6 | 278 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 279 | | { |
| 0 | 280 | | value = null; |
| | 281 | | } |
| | 282 | | else |
| | 283 | | { |
| 6 | 284 | | value = ProviderListResult.DeserializeProviderListResult(document.RootElement); |
| | 285 | | } |
| 6 | 286 | | return Response.FromValue(value, message.Response); |
| | 287 | | } |
| | 288 | | default: |
| 0 | 289 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 290 | | } |
| 6 | 291 | | } |
| | 292 | |
|
| | 293 | | internal Core.HttpMessage CreateListAtTenantScopeRequest(int? top, string expand) |
| | 294 | | { |
| 0 | 295 | | var message = _pipeline.CreateMessage(); |
| 0 | 296 | | var request = message.Request; |
| 0 | 297 | | request.Method = RequestMethod.Get; |
| 0 | 298 | | var uri = new RawRequestUriBuilder(); |
| 0 | 299 | | uri.Reset(endpoint); |
| 0 | 300 | | uri.AppendPath("/providers", false); |
| 0 | 301 | | if (top != null) |
| | 302 | | { |
| 0 | 303 | | uri.AppendQuery("$top", top.Value, true); |
| | 304 | | } |
| 0 | 305 | | if (expand != null) |
| | 306 | | { |
| 0 | 307 | | uri.AppendQuery("$expand", expand, true); |
| | 308 | | } |
| 0 | 309 | | uri.AppendQuery("api-version", "2019-10-01", true); |
| 0 | 310 | | request.Uri = uri; |
| 0 | 311 | | return message; |
| | 312 | | } |
| | 313 | |
|
| | 314 | | /// <summary> Gets all resource providers for the tenant. </summary> |
| | 315 | | /// <param name="top"> The number of results to return. If null is passed returns all providers. </param> |
| | 316 | | /// <param name="expand"> The properties to include in the results. For example, use &$expand=metadata in th |
| | 317 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 318 | | public async Task<Response<ProviderListResult>> ListAtTenantScopeAsync(int? top = null, string expand = null, Ca |
| | 319 | | { |
| 0 | 320 | | using var message = CreateListAtTenantScopeRequest(top, expand); |
| 0 | 321 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 322 | | switch (message.Response.Status) |
| | 323 | | { |
| | 324 | | case 200: |
| | 325 | | { |
| 0 | 326 | | ProviderListResult value = default; |
| 0 | 327 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 328 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 329 | | { |
| 0 | 330 | | value = null; |
| | 331 | | } |
| | 332 | | else |
| | 333 | | { |
| 0 | 334 | | value = ProviderListResult.DeserializeProviderListResult(document.RootElement); |
| | 335 | | } |
| 0 | 336 | | return Response.FromValue(value, message.Response); |
| | 337 | | } |
| | 338 | | default: |
| 0 | 339 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 340 | | } |
| 0 | 341 | | } |
| | 342 | |
|
| | 343 | | /// <summary> Gets all resource providers for the tenant. </summary> |
| | 344 | | /// <param name="top"> The number of results to return. If null is passed returns all providers. </param> |
| | 345 | | /// <param name="expand"> The properties to include in the results. For example, use &$expand=metadata in th |
| | 346 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 347 | | public Response<ProviderListResult> ListAtTenantScope(int? top = null, string expand = null, CancellationToken c |
| | 348 | | { |
| 0 | 349 | | using var message = CreateListAtTenantScopeRequest(top, expand); |
| 0 | 350 | | _pipeline.Send(message, cancellationToken); |
| 0 | 351 | | switch (message.Response.Status) |
| | 352 | | { |
| | 353 | | case 200: |
| | 354 | | { |
| 0 | 355 | | ProviderListResult value = default; |
| 0 | 356 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 357 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 358 | | { |
| 0 | 359 | | value = null; |
| | 360 | | } |
| | 361 | | else |
| | 362 | | { |
| 0 | 363 | | value = ProviderListResult.DeserializeProviderListResult(document.RootElement); |
| | 364 | | } |
| 0 | 365 | | return Response.FromValue(value, message.Response); |
| | 366 | | } |
| | 367 | | default: |
| 0 | 368 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 369 | | } |
| 0 | 370 | | } |
| | 371 | |
|
| | 372 | | internal Core.HttpMessage CreateGetRequest(string resourceProviderNamespace, string expand) |
| | 373 | | { |
| 24 | 374 | | var message = _pipeline.CreateMessage(); |
| 24 | 375 | | var request = message.Request; |
| 24 | 376 | | request.Method = RequestMethod.Get; |
| 24 | 377 | | var uri = new RawRequestUriBuilder(); |
| 24 | 378 | | uri.Reset(endpoint); |
| 24 | 379 | | uri.AppendPath("/subscriptions/", false); |
| 24 | 380 | | uri.AppendPath(subscriptionId, true); |
| 24 | 381 | | uri.AppendPath("/providers/", false); |
| 24 | 382 | | uri.AppendPath(resourceProviderNamespace, true); |
| 24 | 383 | | if (expand != null) |
| | 384 | | { |
| 8 | 385 | | uri.AppendQuery("$expand", expand, true); |
| | 386 | | } |
| 24 | 387 | | uri.AppendQuery("api-version", "2019-10-01", true); |
| 24 | 388 | | request.Uri = uri; |
| 24 | 389 | | return message; |
| | 390 | | } |
| | 391 | |
|
| | 392 | | /// <summary> Gets the specified resource provider. </summary> |
| | 393 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param> |
| | 394 | | /// <param name="expand"> The $expand query parameter. For example, to include property aliases in response, use |
| | 395 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 396 | | public async Task<Response<Provider>> GetAsync(string resourceProviderNamespace, string expand = null, Cancellat |
| | 397 | | { |
| 14 | 398 | | if (resourceProviderNamespace == null) |
| | 399 | | { |
| 2 | 400 | | throw new ArgumentNullException(nameof(resourceProviderNamespace)); |
| | 401 | | } |
| | 402 | |
|
| 12 | 403 | | using var message = CreateGetRequest(resourceProviderNamespace, expand); |
| 12 | 404 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 12 | 405 | | switch (message.Response.Status) |
| | 406 | | { |
| | 407 | | case 200: |
| | 408 | | { |
| 12 | 409 | | Provider value = default; |
| 12 | 410 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 12 | 411 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 412 | | { |
| 0 | 413 | | value = null; |
| | 414 | | } |
| | 415 | | else |
| | 416 | | { |
| 12 | 417 | | value = Provider.DeserializeProvider(document.RootElement); |
| | 418 | | } |
| 12 | 419 | | return Response.FromValue(value, message.Response); |
| | 420 | | } |
| | 421 | | default: |
| 0 | 422 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 423 | | } |
| 12 | 424 | | } |
| | 425 | |
|
| | 426 | | /// <summary> Gets the specified resource provider. </summary> |
| | 427 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param> |
| | 428 | | /// <param name="expand"> The $expand query parameter. For example, to include property aliases in response, use |
| | 429 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 430 | | public Response<Provider> Get(string resourceProviderNamespace, string expand = null, CancellationToken cancella |
| | 431 | | { |
| 14 | 432 | | if (resourceProviderNamespace == null) |
| | 433 | | { |
| 2 | 434 | | throw new ArgumentNullException(nameof(resourceProviderNamespace)); |
| | 435 | | } |
| | 436 | |
|
| 12 | 437 | | using var message = CreateGetRequest(resourceProviderNamespace, expand); |
| 12 | 438 | | _pipeline.Send(message, cancellationToken); |
| 12 | 439 | | switch (message.Response.Status) |
| | 440 | | { |
| | 441 | | case 200: |
| | 442 | | { |
| 12 | 443 | | Provider value = default; |
| 12 | 444 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 12 | 445 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 446 | | { |
| 0 | 447 | | value = null; |
| | 448 | | } |
| | 449 | | else |
| | 450 | | { |
| 12 | 451 | | value = Provider.DeserializeProvider(document.RootElement); |
| | 452 | | } |
| 12 | 453 | | return Response.FromValue(value, message.Response); |
| | 454 | | } |
| | 455 | | default: |
| 0 | 456 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 457 | | } |
| 12 | 458 | | } |
| | 459 | |
|
| | 460 | | internal Core.HttpMessage CreateGetAtTenantScopeRequest(string resourceProviderNamespace, string expand) |
| | 461 | | { |
| 0 | 462 | | var message = _pipeline.CreateMessage(); |
| 0 | 463 | | var request = message.Request; |
| 0 | 464 | | request.Method = RequestMethod.Get; |
| 0 | 465 | | var uri = new RawRequestUriBuilder(); |
| 0 | 466 | | uri.Reset(endpoint); |
| 0 | 467 | | uri.AppendPath("/providers/", false); |
| 0 | 468 | | uri.AppendPath(resourceProviderNamespace, true); |
| 0 | 469 | | if (expand != null) |
| | 470 | | { |
| 0 | 471 | | uri.AppendQuery("$expand", expand, true); |
| | 472 | | } |
| 0 | 473 | | uri.AppendQuery("api-version", "2019-10-01", true); |
| 0 | 474 | | request.Uri = uri; |
| 0 | 475 | | return message; |
| | 476 | | } |
| | 477 | |
|
| | 478 | | /// <summary> Gets the specified resource provider at the tenant level. </summary> |
| | 479 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param> |
| | 480 | | /// <param name="expand"> The $expand query parameter. For example, to include property aliases in response, use |
| | 481 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 482 | | public async Task<Response<Provider>> GetAtTenantScopeAsync(string resourceProviderNamespace, string expand = nu |
| | 483 | | { |
| 0 | 484 | | if (resourceProviderNamespace == null) |
| | 485 | | { |
| 0 | 486 | | throw new ArgumentNullException(nameof(resourceProviderNamespace)); |
| | 487 | | } |
| | 488 | |
|
| 0 | 489 | | using var message = CreateGetAtTenantScopeRequest(resourceProviderNamespace, expand); |
| 0 | 490 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 491 | | switch (message.Response.Status) |
| | 492 | | { |
| | 493 | | case 200: |
| | 494 | | { |
| 0 | 495 | | Provider value = default; |
| 0 | 496 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 497 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 498 | | { |
| 0 | 499 | | value = null; |
| | 500 | | } |
| | 501 | | else |
| | 502 | | { |
| 0 | 503 | | value = Provider.DeserializeProvider(document.RootElement); |
| | 504 | | } |
| 0 | 505 | | return Response.FromValue(value, message.Response); |
| | 506 | | } |
| | 507 | | default: |
| 0 | 508 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 509 | | } |
| 0 | 510 | | } |
| | 511 | |
|
| | 512 | | /// <summary> Gets the specified resource provider at the tenant level. </summary> |
| | 513 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param> |
| | 514 | | /// <param name="expand"> The $expand query parameter. For example, to include property aliases in response, use |
| | 515 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 516 | | public Response<Provider> GetAtTenantScope(string resourceProviderNamespace, string expand = null, CancellationT |
| | 517 | | { |
| 0 | 518 | | if (resourceProviderNamespace == null) |
| | 519 | | { |
| 0 | 520 | | throw new ArgumentNullException(nameof(resourceProviderNamespace)); |
| | 521 | | } |
| | 522 | |
|
| 0 | 523 | | using var message = CreateGetAtTenantScopeRequest(resourceProviderNamespace, expand); |
| 0 | 524 | | _pipeline.Send(message, cancellationToken); |
| 0 | 525 | | switch (message.Response.Status) |
| | 526 | | { |
| | 527 | | case 200: |
| | 528 | | { |
| 0 | 529 | | Provider value = default; |
| 0 | 530 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 531 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 532 | | { |
| 0 | 533 | | value = null; |
| | 534 | | } |
| | 535 | | else |
| | 536 | | { |
| 0 | 537 | | value = Provider.DeserializeProvider(document.RootElement); |
| | 538 | | } |
| 0 | 539 | | return Response.FromValue(value, message.Response); |
| | 540 | | } |
| | 541 | | default: |
| 0 | 542 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 543 | | } |
| 0 | 544 | | } |
| | 545 | |
|
| | 546 | | internal Core.HttpMessage CreateListNextPageRequest(string nextLink, int? top, string expand) |
| | 547 | | { |
| 0 | 548 | | var message = _pipeline.CreateMessage(); |
| 0 | 549 | | var request = message.Request; |
| 0 | 550 | | request.Method = RequestMethod.Get; |
| 0 | 551 | | var uri = new RawRequestUriBuilder(); |
| 0 | 552 | | uri.Reset(endpoint); |
| 0 | 553 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 554 | | request.Uri = uri; |
| 0 | 555 | | return message; |
| | 556 | | } |
| | 557 | |
|
| | 558 | | /// <summary> Gets all resource providers for a subscription. </summary> |
| | 559 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 560 | | /// <param name="top"> The number of results to return. If null is passed returns all deployments. </param> |
| | 561 | | /// <param name="expand"> The properties to include in the results. For example, use &$expand=metadata in th |
| | 562 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 563 | | public async Task<Response<ProviderListResult>> ListNextPageAsync(string nextLink, int? top = null, string expan |
| | 564 | | { |
| 0 | 565 | | if (nextLink == null) |
| | 566 | | { |
| 0 | 567 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 568 | | } |
| | 569 | |
|
| 0 | 570 | | using var message = CreateListNextPageRequest(nextLink, top, expand); |
| 0 | 571 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 572 | | switch (message.Response.Status) |
| | 573 | | { |
| | 574 | | case 200: |
| | 575 | | { |
| 0 | 576 | | ProviderListResult value = default; |
| 0 | 577 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 578 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 579 | | { |
| 0 | 580 | | value = null; |
| | 581 | | } |
| | 582 | | else |
| | 583 | | { |
| 0 | 584 | | value = ProviderListResult.DeserializeProviderListResult(document.RootElement); |
| | 585 | | } |
| 0 | 586 | | return Response.FromValue(value, message.Response); |
| | 587 | | } |
| | 588 | | default: |
| 0 | 589 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 590 | | } |
| 0 | 591 | | } |
| | 592 | |
|
| | 593 | | /// <summary> Gets all resource providers for a subscription. </summary> |
| | 594 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 595 | | /// <param name="top"> The number of results to return. If null is passed returns all deployments. </param> |
| | 596 | | /// <param name="expand"> The properties to include in the results. For example, use &$expand=metadata in th |
| | 597 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 598 | | public Response<ProviderListResult> ListNextPage(string nextLink, int? top = null, string expand = null, Cancell |
| | 599 | | { |
| 0 | 600 | | if (nextLink == null) |
| | 601 | | { |
| 0 | 602 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 603 | | } |
| | 604 | |
|
| 0 | 605 | | using var message = CreateListNextPageRequest(nextLink, top, expand); |
| 0 | 606 | | _pipeline.Send(message, cancellationToken); |
| 0 | 607 | | switch (message.Response.Status) |
| | 608 | | { |
| | 609 | | case 200: |
| | 610 | | { |
| 0 | 611 | | ProviderListResult value = default; |
| 0 | 612 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 613 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 614 | | { |
| 0 | 615 | | value = null; |
| | 616 | | } |
| | 617 | | else |
| | 618 | | { |
| 0 | 619 | | value = ProviderListResult.DeserializeProviderListResult(document.RootElement); |
| | 620 | | } |
| 0 | 621 | | return Response.FromValue(value, message.Response); |
| | 622 | | } |
| | 623 | | default: |
| 0 | 624 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 625 | | } |
| 0 | 626 | | } |
| | 627 | |
|
| | 628 | | internal Core.HttpMessage CreateListAtTenantScopeNextPageRequest(string nextLink, int? top, string expand) |
| | 629 | | { |
| 0 | 630 | | var message = _pipeline.CreateMessage(); |
| 0 | 631 | | var request = message.Request; |
| 0 | 632 | | request.Method = RequestMethod.Get; |
| 0 | 633 | | var uri = new RawRequestUriBuilder(); |
| 0 | 634 | | uri.Reset(endpoint); |
| 0 | 635 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 636 | | request.Uri = uri; |
| 0 | 637 | | return message; |
| | 638 | | } |
| | 639 | |
|
| | 640 | | /// <summary> Gets all resource providers for the tenant. </summary> |
| | 641 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 642 | | /// <param name="top"> The number of results to return. If null is passed returns all providers. </param> |
| | 643 | | /// <param name="expand"> The properties to include in the results. For example, use &$expand=metadata in th |
| | 644 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 645 | | public async Task<Response<ProviderListResult>> ListAtTenantScopeNextPageAsync(string nextLink, int? top = null, |
| | 646 | | { |
| 0 | 647 | | if (nextLink == null) |
| | 648 | | { |
| 0 | 649 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 650 | | } |
| | 651 | |
|
| 0 | 652 | | using var message = CreateListAtTenantScopeNextPageRequest(nextLink, top, expand); |
| 0 | 653 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 654 | | switch (message.Response.Status) |
| | 655 | | { |
| | 656 | | case 200: |
| | 657 | | { |
| 0 | 658 | | ProviderListResult value = default; |
| 0 | 659 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 660 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 661 | | { |
| 0 | 662 | | value = null; |
| | 663 | | } |
| | 664 | | else |
| | 665 | | { |
| 0 | 666 | | value = ProviderListResult.DeserializeProviderListResult(document.RootElement); |
| | 667 | | } |
| 0 | 668 | | return Response.FromValue(value, message.Response); |
| | 669 | | } |
| | 670 | | default: |
| 0 | 671 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 672 | | } |
| 0 | 673 | | } |
| | 674 | |
|
| | 675 | | /// <summary> Gets all resource providers for the tenant. </summary> |
| | 676 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 677 | | /// <param name="top"> The number of results to return. If null is passed returns all providers. </param> |
| | 678 | | /// <param name="expand"> The properties to include in the results. For example, use &$expand=metadata in th |
| | 679 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 680 | | public Response<ProviderListResult> ListAtTenantScopeNextPage(string nextLink, int? top = null, string expand = |
| | 681 | | { |
| 0 | 682 | | if (nextLink == null) |
| | 683 | | { |
| 0 | 684 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 685 | | } |
| | 686 | |
|
| 0 | 687 | | using var message = CreateListAtTenantScopeNextPageRequest(nextLink, top, expand); |
| 0 | 688 | | _pipeline.Send(message, cancellationToken); |
| 0 | 689 | | switch (message.Response.Status) |
| | 690 | | { |
| | 691 | | case 200: |
| | 692 | | { |
| 0 | 693 | | ProviderListResult value = default; |
| 0 | 694 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 695 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 696 | | { |
| 0 | 697 | | value = null; |
| | 698 | | } |
| | 699 | | else |
| | 700 | | { |
| 0 | 701 | | value = ProviderListResult.DeserializeProviderListResult(document.RootElement); |
| | 702 | | } |
| 0 | 703 | | return Response.FromValue(value, message.Response); |
| | 704 | | } |
| | 705 | | default: |
| 0 | 706 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 707 | | } |
| 0 | 708 | | } |
| | 709 | | } |
| | 710 | | } |