| | | 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.Threading; |
| | | 10 | | using System.Threading.Tasks; |
| | | 11 | | using Azure; |
| | | 12 | | using Azure.Core; |
| | | 13 | | using Azure.Core.Pipeline; |
| | | 14 | | using Azure.ResourceManager.Resources.Models; |
| | | 15 | | |
| | | 16 | | namespace Azure.ResourceManager.Resources |
| | | 17 | | { |
| | | 18 | | /// <summary> The Providers service client. </summary> |
| | | 19 | | public partial class ProvidersOperations |
| | | 20 | | { |
| | | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | | 22 | | private readonly HttpPipeline _pipeline; |
| | 80 | 23 | | internal ProvidersRestOperations RestClient { get; } |
| | | 24 | | /// <summary> Initializes a new instance of ProvidersOperations for mocking. </summary> |
| | 284 | 25 | | protected ProvidersOperations() |
| | | 26 | | { |
| | 284 | 27 | | } |
| | | 28 | | /// <summary> Initializes a new instance of ProvidersOperations. </summary> |
| | | 29 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | | 30 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | | 31 | | /// <param name="subscriptionId"> The ID of the target subscription. </param> |
| | | 32 | | /// <param name="endpoint"> server parameter. </param> |
| | 284 | 33 | | internal ProvidersOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, |
| | | 34 | | { |
| | 284 | 35 | | RestClient = new ProvidersRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| | 284 | 36 | | _clientDiagnostics = clientDiagnostics; |
| | 284 | 37 | | _pipeline = pipeline; |
| | 284 | 38 | | } |
| | | 39 | | |
| | | 40 | | /// <summary> Unregisters a subscription from a resource provider. </summary> |
| | | 41 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider to unregister. </param> |
| | | 42 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 43 | | public virtual async Task<Response<Provider>> UnregisterAsync(string resourceProviderNamespace, CancellationToke |
| | | 44 | | { |
| | 6 | 45 | | using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.Unregister"); |
| | 6 | 46 | | scope.Start(); |
| | | 47 | | try |
| | | 48 | | { |
| | 6 | 49 | | return await RestClient.UnregisterAsync(resourceProviderNamespace, cancellationToken).ConfigureAwait(fal |
| | | 50 | | } |
| | 2 | 51 | | catch (Exception e) |
| | | 52 | | { |
| | 2 | 53 | | scope.Failed(e); |
| | 2 | 54 | | throw; |
| | | 55 | | } |
| | 4 | 56 | | } |
| | | 57 | | |
| | | 58 | | /// <summary> Unregisters a subscription from a resource provider. </summary> |
| | | 59 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider to unregister. </param> |
| | | 60 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 61 | | public virtual Response<Provider> Unregister(string resourceProviderNamespace, CancellationToken cancellationTok |
| | | 62 | | { |
| | 6 | 63 | | using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.Unregister"); |
| | 6 | 64 | | scope.Start(); |
| | | 65 | | try |
| | | 66 | | { |
| | 6 | 67 | | return RestClient.Unregister(resourceProviderNamespace, cancellationToken); |
| | | 68 | | } |
| | 2 | 69 | | catch (Exception e) |
| | | 70 | | { |
| | 2 | 71 | | scope.Failed(e); |
| | 2 | 72 | | throw; |
| | | 73 | | } |
| | 4 | 74 | | } |
| | | 75 | | |
| | | 76 | | /// <summary> Registers a subscription with a resource provider. </summary> |
| | | 77 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider to register. </param> |
| | | 78 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 79 | | public virtual async Task<Response<Provider>> RegisterAsync(string resourceProviderNamespace, CancellationToken |
| | | 80 | | { |
| | 14 | 81 | | using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.Register"); |
| | 14 | 82 | | scope.Start(); |
| | | 83 | | try |
| | | 84 | | { |
| | 14 | 85 | | return await RestClient.RegisterAsync(resourceProviderNamespace, cancellationToken).ConfigureAwait(false |
| | | 86 | | } |
| | 2 | 87 | | catch (Exception e) |
| | | 88 | | { |
| | 2 | 89 | | scope.Failed(e); |
| | 2 | 90 | | throw; |
| | | 91 | | } |
| | 12 | 92 | | } |
| | | 93 | | |
| | | 94 | | /// <summary> Registers a subscription with a resource provider. </summary> |
| | | 95 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider to register. </param> |
| | | 96 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 97 | | public virtual Response<Provider> Register(string resourceProviderNamespace, CancellationToken cancellationToken |
| | | 98 | | { |
| | 14 | 99 | | using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.Register"); |
| | 14 | 100 | | scope.Start(); |
| | | 101 | | try |
| | | 102 | | { |
| | 14 | 103 | | return RestClient.Register(resourceProviderNamespace, cancellationToken); |
| | | 104 | | } |
| | 2 | 105 | | catch (Exception e) |
| | | 106 | | { |
| | 2 | 107 | | scope.Failed(e); |
| | 2 | 108 | | throw; |
| | | 109 | | } |
| | 12 | 110 | | } |
| | | 111 | | |
| | | 112 | | /// <summary> Gets the specified resource provider. </summary> |
| | | 113 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param> |
| | | 114 | | /// <param name="expand"> The $expand query parameter. For example, to include property aliases in response, use |
| | | 115 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 116 | | public virtual async Task<Response<Provider>> GetAsync(string resourceProviderNamespace, string expand = null, C |
| | | 117 | | { |
| | 14 | 118 | | using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.Get"); |
| | 14 | 119 | | scope.Start(); |
| | | 120 | | try |
| | | 121 | | { |
| | 14 | 122 | | return await RestClient.GetAsync(resourceProviderNamespace, expand, cancellationToken).ConfigureAwait(fa |
| | | 123 | | } |
| | 2 | 124 | | catch (Exception e) |
| | | 125 | | { |
| | 2 | 126 | | scope.Failed(e); |
| | 2 | 127 | | throw; |
| | | 128 | | } |
| | 12 | 129 | | } |
| | | 130 | | |
| | | 131 | | /// <summary> Gets the specified resource provider. </summary> |
| | | 132 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param> |
| | | 133 | | /// <param name="expand"> The $expand query parameter. For example, to include property aliases in response, use |
| | | 134 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 135 | | public virtual Response<Provider> Get(string resourceProviderNamespace, string expand = null, CancellationToken |
| | | 136 | | { |
| | 14 | 137 | | using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.Get"); |
| | 14 | 138 | | scope.Start(); |
| | | 139 | | try |
| | | 140 | | { |
| | 14 | 141 | | return RestClient.Get(resourceProviderNamespace, expand, cancellationToken); |
| | | 142 | | } |
| | 2 | 143 | | catch (Exception e) |
| | | 144 | | { |
| | 2 | 145 | | scope.Failed(e); |
| | 2 | 146 | | throw; |
| | | 147 | | } |
| | 12 | 148 | | } |
| | | 149 | | |
| | | 150 | | /// <summary> Gets the specified resource provider at the tenant level. </summary> |
| | | 151 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param> |
| | | 152 | | /// <param name="expand"> The $expand query parameter. For example, to include property aliases in response, use |
| | | 153 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 154 | | public virtual async Task<Response<Provider>> GetAtTenantScopeAsync(string resourceProviderNamespace, string exp |
| | | 155 | | { |
| | 0 | 156 | | using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.GetAtTenantScope"); |
| | 0 | 157 | | scope.Start(); |
| | | 158 | | try |
| | | 159 | | { |
| | 0 | 160 | | return await RestClient.GetAtTenantScopeAsync(resourceProviderNamespace, expand, cancellationToken).Conf |
| | | 161 | | } |
| | 0 | 162 | | catch (Exception e) |
| | | 163 | | { |
| | 0 | 164 | | scope.Failed(e); |
| | 0 | 165 | | throw; |
| | | 166 | | } |
| | 0 | 167 | | } |
| | | 168 | | |
| | | 169 | | /// <summary> Gets the specified resource provider at the tenant level. </summary> |
| | | 170 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param> |
| | | 171 | | /// <param name="expand"> The $expand query parameter. For example, to include property aliases in response, use |
| | | 172 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 173 | | public virtual Response<Provider> GetAtTenantScope(string resourceProviderNamespace, string expand = null, Cance |
| | | 174 | | { |
| | 0 | 175 | | using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.GetAtTenantScope"); |
| | 0 | 176 | | scope.Start(); |
| | | 177 | | try |
| | | 178 | | { |
| | 0 | 179 | | return RestClient.GetAtTenantScope(resourceProviderNamespace, expand, cancellationToken); |
| | | 180 | | } |
| | 0 | 181 | | catch (Exception e) |
| | | 182 | | { |
| | 0 | 183 | | scope.Failed(e); |
| | 0 | 184 | | throw; |
| | | 185 | | } |
| | 0 | 186 | | } |
| | | 187 | | |
| | | 188 | | /// <summary> Gets all resource providers for a subscription. </summary> |
| | | 189 | | /// <param name="top"> The number of results to return. If null is passed returns all deployments. </param> |
| | | 190 | | /// <param name="expand"> The properties to include in the results. For example, use &$expand=metadata in th |
| | | 191 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 192 | | public virtual AsyncPageable<Provider> ListAsync(int? top = null, string expand = null, CancellationToken cancel |
| | | 193 | | { |
| | | 194 | | async Task<Page<Provider>> FirstPageFunc(int? pageSizeHint) |
| | | 195 | | { |
| | 6 | 196 | | using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.List"); |
| | 6 | 197 | | scope.Start(); |
| | | 198 | | try |
| | | 199 | | { |
| | 6 | 200 | | var response = await RestClient.ListAsync(top, expand, cancellationToken).ConfigureAwait(false); |
| | 6 | 201 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | | 202 | | } |
| | 0 | 203 | | catch (Exception e) |
| | | 204 | | { |
| | 0 | 205 | | scope.Failed(e); |
| | 0 | 206 | | throw; |
| | | 207 | | } |
| | 6 | 208 | | } |
| | | 209 | | async Task<Page<Provider>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | | 210 | | { |
| | 0 | 211 | | using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.List"); |
| | 0 | 212 | | scope.Start(); |
| | | 213 | | try |
| | | 214 | | { |
| | 0 | 215 | | var response = await RestClient.ListNextPageAsync(nextLink, top, expand, cancellationToken).Configur |
| | 0 | 216 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | | 217 | | } |
| | 0 | 218 | | catch (Exception e) |
| | | 219 | | { |
| | 0 | 220 | | scope.Failed(e); |
| | 0 | 221 | | throw; |
| | | 222 | | } |
| | 0 | 223 | | } |
| | 6 | 224 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | | 225 | | } |
| | | 226 | | |
| | | 227 | | /// <summary> Gets all resource providers for a subscription. </summary> |
| | | 228 | | /// <param name="top"> The number of results to return. If null is passed returns all deployments. </param> |
| | | 229 | | /// <param name="expand"> The properties to include in the results. For example, use &$expand=metadata in th |
| | | 230 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 231 | | public virtual Pageable<Provider> List(int? top = null, string expand = null, CancellationToken cancellationToke |
| | | 232 | | { |
| | | 233 | | Page<Provider> FirstPageFunc(int? pageSizeHint) |
| | | 234 | | { |
| | 6 | 235 | | using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.List"); |
| | 6 | 236 | | scope.Start(); |
| | | 237 | | try |
| | | 238 | | { |
| | 6 | 239 | | var response = RestClient.List(top, expand, cancellationToken); |
| | 6 | 240 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | | 241 | | } |
| | 0 | 242 | | catch (Exception e) |
| | | 243 | | { |
| | 0 | 244 | | scope.Failed(e); |
| | 0 | 245 | | throw; |
| | | 246 | | } |
| | 6 | 247 | | } |
| | | 248 | | Page<Provider> NextPageFunc(string nextLink, int? pageSizeHint) |
| | | 249 | | { |
| | 0 | 250 | | using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.List"); |
| | 0 | 251 | | scope.Start(); |
| | | 252 | | try |
| | | 253 | | { |
| | 0 | 254 | | var response = RestClient.ListNextPage(nextLink, top, expand, cancellationToken); |
| | 0 | 255 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | | 256 | | } |
| | 0 | 257 | | catch (Exception e) |
| | | 258 | | { |
| | 0 | 259 | | scope.Failed(e); |
| | 0 | 260 | | throw; |
| | | 261 | | } |
| | 0 | 262 | | } |
| | 6 | 263 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | | 264 | | } |
| | | 265 | | |
| | | 266 | | /// <summary> Gets all resource providers for the tenant. </summary> |
| | | 267 | | /// <param name="top"> The number of results to return. If null is passed returns all providers. </param> |
| | | 268 | | /// <param name="expand"> The properties to include in the results. For example, use &$expand=metadata in th |
| | | 269 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 270 | | public virtual AsyncPageable<Provider> ListAtTenantScopeAsync(int? top = null, string expand = null, Cancellatio |
| | | 271 | | { |
| | | 272 | | async Task<Page<Provider>> FirstPageFunc(int? pageSizeHint) |
| | | 273 | | { |
| | 0 | 274 | | using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.ListAtTenantScope"); |
| | 0 | 275 | | scope.Start(); |
| | | 276 | | try |
| | | 277 | | { |
| | 0 | 278 | | var response = await RestClient.ListAtTenantScopeAsync(top, expand, cancellationToken).ConfigureAwai |
| | 0 | 279 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | | 280 | | } |
| | 0 | 281 | | catch (Exception e) |
| | | 282 | | { |
| | 0 | 283 | | scope.Failed(e); |
| | 0 | 284 | | throw; |
| | | 285 | | } |
| | 0 | 286 | | } |
| | | 287 | | async Task<Page<Provider>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | | 288 | | { |
| | 0 | 289 | | using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.ListAtTenantScope"); |
| | 0 | 290 | | scope.Start(); |
| | | 291 | | try |
| | | 292 | | { |
| | 0 | 293 | | var response = await RestClient.ListAtTenantScopeNextPageAsync(nextLink, top, expand, cancellationTo |
| | 0 | 294 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | | 295 | | } |
| | 0 | 296 | | catch (Exception e) |
| | | 297 | | { |
| | 0 | 298 | | scope.Failed(e); |
| | 0 | 299 | | throw; |
| | | 300 | | } |
| | 0 | 301 | | } |
| | 0 | 302 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | | 303 | | } |
| | | 304 | | |
| | | 305 | | /// <summary> Gets all resource providers for the tenant. </summary> |
| | | 306 | | /// <param name="top"> The number of results to return. If null is passed returns all providers. </param> |
| | | 307 | | /// <param name="expand"> The properties to include in the results. For example, use &$expand=metadata in th |
| | | 308 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 309 | | public virtual Pageable<Provider> ListAtTenantScope(int? top = null, string expand = null, CancellationToken can |
| | | 310 | | { |
| | | 311 | | Page<Provider> FirstPageFunc(int? pageSizeHint) |
| | | 312 | | { |
| | 0 | 313 | | using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.ListAtTenantScope"); |
| | 0 | 314 | | scope.Start(); |
| | | 315 | | try |
| | | 316 | | { |
| | 0 | 317 | | var response = RestClient.ListAtTenantScope(top, expand, cancellationToken); |
| | 0 | 318 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | | 319 | | } |
| | 0 | 320 | | catch (Exception e) |
| | | 321 | | { |
| | 0 | 322 | | scope.Failed(e); |
| | 0 | 323 | | throw; |
| | | 324 | | } |
| | 0 | 325 | | } |
| | | 326 | | Page<Provider> NextPageFunc(string nextLink, int? pageSizeHint) |
| | | 327 | | { |
| | 0 | 328 | | using var scope = _clientDiagnostics.CreateScope("ProvidersOperations.ListAtTenantScope"); |
| | 0 | 329 | | scope.Start(); |
| | | 330 | | try |
| | | 331 | | { |
| | 0 | 332 | | var response = RestClient.ListAtTenantScopeNextPage(nextLink, top, expand, cancellationToken); |
| | 0 | 333 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | | 334 | | } |
| | 0 | 335 | | catch (Exception e) |
| | | 336 | | { |
| | 0 | 337 | | scope.Failed(e); |
| | 0 | 338 | | throw; |
| | | 339 | | } |
| | 0 | 340 | | } |
| | 0 | 341 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | | 342 | | } |
| | | 343 | | } |
| | | 344 | | } |