| | 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 PolicyAssignments service client. </summary> |
| | 19 | | public partial class PolicyAssignmentsOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 96 | 23 | | internal PolicyAssignmentsRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of PolicyAssignmentsOperations for mocking. </summary> |
| 256 | 25 | | protected PolicyAssignmentsOperations() |
| | 26 | | { |
| 256 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of PolicyAssignmentsOperations. </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> |
| 256 | 33 | | internal PolicyAssignmentsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscrip |
| | 34 | | { |
| 256 | 35 | | RestClient = new PolicyAssignmentsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 256 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 256 | 37 | | _pipeline = pipeline; |
| 256 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> This operation deletes a policy assignment, given its name and the scope it was created in. The sc |
| | 41 | | /// <param name="scope"> The scope of the policy assignment. Valid scopes are: management group (format: '/ |
| | 42 | | /// <param name="policyAssignmentName"> The name of the policy assignment to delete. </param> |
| | 43 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 44 | | public virtual async Task<Response<PolicyAssignment>> DeleteAsync(string scope, string policyAssignmentName, Can |
| | 45 | | { |
| 8 | 46 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.Delete"); |
| 8 | 47 | | scope0.Start(); |
| | 48 | | try |
| | 49 | | { |
| 8 | 50 | | return await RestClient.DeleteAsync(scope, policyAssignmentName, cancellationToken).ConfigureAwait(false |
| | 51 | | } |
| 0 | 52 | | catch (Exception e) |
| | 53 | | { |
| 0 | 54 | | scope0.Failed(e); |
| 0 | 55 | | throw; |
| | 56 | | } |
| 8 | 57 | | } |
| | 58 | |
|
| | 59 | | /// <summary> This operation deletes a policy assignment, given its name and the scope it was created in. The sc |
| | 60 | | /// <param name="scope"> The scope of the policy assignment. Valid scopes are: management group (format: '/ |
| | 61 | | /// <param name="policyAssignmentName"> The name of the policy assignment to delete. </param> |
| | 62 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 63 | | public virtual Response<PolicyAssignment> Delete(string scope, string policyAssignmentName, CancellationToken ca |
| | 64 | | { |
| 8 | 65 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.Delete"); |
| 8 | 66 | | scope0.Start(); |
| | 67 | | try |
| | 68 | | { |
| 8 | 69 | | return RestClient.Delete(scope, policyAssignmentName, cancellationToken); |
| | 70 | | } |
| 0 | 71 | | catch (Exception e) |
| | 72 | | { |
| 0 | 73 | | scope0.Failed(e); |
| 0 | 74 | | throw; |
| | 75 | | } |
| 8 | 76 | | } |
| | 77 | |
|
| | 78 | | /// <summary> This operation creates or updates a policy assignment with the given scope and name. Policy assig |
| | 79 | | /// <param name="scope"> The scope of the policy assignment. Valid scopes are: management group (format: '/ |
| | 80 | | /// <param name="policyAssignmentName"> The name of the policy assignment. </param> |
| | 81 | | /// <param name="parameters"> Parameters for the policy assignment. </param> |
| | 82 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 83 | | public virtual async Task<Response<PolicyAssignment>> CreateAsync(string scope, string policyAssignmentName, Pol |
| | 84 | | { |
| 16 | 85 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.Create"); |
| 16 | 86 | | scope0.Start(); |
| | 87 | | try |
| | 88 | | { |
| 16 | 89 | | return await RestClient.CreateAsync(scope, policyAssignmentName, parameters, cancellationToken).Configur |
| | 90 | | } |
| 6 | 91 | | catch (Exception e) |
| | 92 | | { |
| 6 | 93 | | scope0.Failed(e); |
| 6 | 94 | | throw; |
| | 95 | | } |
| 10 | 96 | | } |
| | 97 | |
|
| | 98 | | /// <summary> This operation creates or updates a policy assignment with the given scope and name. Policy assig |
| | 99 | | /// <param name="scope"> The scope of the policy assignment. Valid scopes are: management group (format: '/ |
| | 100 | | /// <param name="policyAssignmentName"> The name of the policy assignment. </param> |
| | 101 | | /// <param name="parameters"> Parameters for the policy assignment. </param> |
| | 102 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 103 | | public virtual Response<PolicyAssignment> Create(string scope, string policyAssignmentName, PolicyAssignment par |
| | 104 | | { |
| 16 | 105 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.Create"); |
| 16 | 106 | | scope0.Start(); |
| | 107 | | try |
| | 108 | | { |
| 16 | 109 | | return RestClient.Create(scope, policyAssignmentName, parameters, cancellationToken); |
| | 110 | | } |
| 6 | 111 | | catch (Exception e) |
| | 112 | | { |
| 6 | 113 | | scope0.Failed(e); |
| 6 | 114 | | throw; |
| | 115 | | } |
| 10 | 116 | | } |
| | 117 | |
|
| | 118 | | /// <summary> This operation retrieves a single policy assignment, given its name and the scope it was created a |
| | 119 | | /// <param name="scope"> The scope of the policy assignment. Valid scopes are: management group (format: '/ |
| | 120 | | /// <param name="policyAssignmentName"> The name of the policy assignment to get. </param> |
| | 121 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 122 | | public virtual async Task<Response<PolicyAssignment>> GetAsync(string scope, string policyAssignmentName, Cancel |
| | 123 | | { |
| 10 | 124 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.Get"); |
| 10 | 125 | | scope0.Start(); |
| | 126 | | try |
| | 127 | | { |
| 10 | 128 | | return await RestClient.GetAsync(scope, policyAssignmentName, cancellationToken).ConfigureAwait(false); |
| | 129 | | } |
| 4 | 130 | | catch (Exception e) |
| | 131 | | { |
| 4 | 132 | | scope0.Failed(e); |
| 4 | 133 | | throw; |
| | 134 | | } |
| 6 | 135 | | } |
| | 136 | |
|
| | 137 | | /// <summary> This operation retrieves a single policy assignment, given its name and the scope it was created a |
| | 138 | | /// <param name="scope"> The scope of the policy assignment. Valid scopes are: management group (format: '/ |
| | 139 | | /// <param name="policyAssignmentName"> The name of the policy assignment to get. </param> |
| | 140 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 141 | | public virtual Response<PolicyAssignment> Get(string scope, string policyAssignmentName, CancellationToken cance |
| | 142 | | { |
| 10 | 143 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.Get"); |
| 10 | 144 | | scope0.Start(); |
| | 145 | | try |
| | 146 | | { |
| 10 | 147 | | return RestClient.Get(scope, policyAssignmentName, cancellationToken); |
| | 148 | | } |
| 4 | 149 | | catch (Exception e) |
| | 150 | | { |
| 4 | 151 | | scope0.Failed(e); |
| 4 | 152 | | throw; |
| | 153 | | } |
| 6 | 154 | | } |
| | 155 | |
|
| | 156 | | /// <summary> This operation deletes the policy with the given ID. Policy assignment IDs have this format: &apos |
| | 157 | | /// <param name="policyAssignmentId"> The ID of the policy assignment to delete. Use the format '{scope}/pr |
| | 158 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 159 | | public virtual async Task<Response<PolicyAssignment>> DeleteByIdAsync(string policyAssignmentId, CancellationTok |
| | 160 | | { |
| 0 | 161 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.DeleteById"); |
| 0 | 162 | | scope0.Start(); |
| | 163 | | try |
| | 164 | | { |
| 0 | 165 | | return await RestClient.DeleteByIdAsync(policyAssignmentId, cancellationToken).ConfigureAwait(false); |
| | 166 | | } |
| 0 | 167 | | catch (Exception e) |
| | 168 | | { |
| 0 | 169 | | scope0.Failed(e); |
| 0 | 170 | | throw; |
| | 171 | | } |
| 0 | 172 | | } |
| | 173 | |
|
| | 174 | | /// <summary> This operation deletes the policy with the given ID. Policy assignment IDs have this format: &apos |
| | 175 | | /// <param name="policyAssignmentId"> The ID of the policy assignment to delete. Use the format '{scope}/pr |
| | 176 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 177 | | public virtual Response<PolicyAssignment> DeleteById(string policyAssignmentId, CancellationToken cancellationTo |
| | 178 | | { |
| 0 | 179 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.DeleteById"); |
| 0 | 180 | | scope0.Start(); |
| | 181 | | try |
| | 182 | | { |
| 0 | 183 | | return RestClient.DeleteById(policyAssignmentId, cancellationToken); |
| | 184 | | } |
| 0 | 185 | | catch (Exception e) |
| | 186 | | { |
| 0 | 187 | | scope0.Failed(e); |
| 0 | 188 | | throw; |
| | 189 | | } |
| 0 | 190 | | } |
| | 191 | |
|
| | 192 | | /// <summary> This operation creates or updates the policy assignment with the given ID. Policy assignments made |
| | 193 | | /// <param name="policyAssignmentId"> The ID of the policy assignment to create. Use the format '{scope}/pr |
| | 194 | | /// <param name="parameters"> Parameters for policy assignment. </param> |
| | 195 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 196 | | public virtual async Task<Response<PolicyAssignment>> CreateByIdAsync(string policyAssignmentId, PolicyAssignmen |
| | 197 | | { |
| 0 | 198 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.CreateById"); |
| 0 | 199 | | scope0.Start(); |
| | 200 | | try |
| | 201 | | { |
| 0 | 202 | | return await RestClient.CreateByIdAsync(policyAssignmentId, parameters, cancellationToken).ConfigureAwai |
| | 203 | | } |
| 0 | 204 | | catch (Exception e) |
| | 205 | | { |
| 0 | 206 | | scope0.Failed(e); |
| 0 | 207 | | throw; |
| | 208 | | } |
| 0 | 209 | | } |
| | 210 | |
|
| | 211 | | /// <summary> This operation creates or updates the policy assignment with the given ID. Policy assignments made |
| | 212 | | /// <param name="policyAssignmentId"> The ID of the policy assignment to create. Use the format '{scope}/pr |
| | 213 | | /// <param name="parameters"> Parameters for policy assignment. </param> |
| | 214 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 215 | | public virtual Response<PolicyAssignment> CreateById(string policyAssignmentId, PolicyAssignment parameters, Can |
| | 216 | | { |
| 0 | 217 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.CreateById"); |
| 0 | 218 | | scope0.Start(); |
| | 219 | | try |
| | 220 | | { |
| 0 | 221 | | return RestClient.CreateById(policyAssignmentId, parameters, cancellationToken); |
| | 222 | | } |
| 0 | 223 | | catch (Exception e) |
| | 224 | | { |
| 0 | 225 | | scope0.Failed(e); |
| 0 | 226 | | throw; |
| | 227 | | } |
| 0 | 228 | | } |
| | 229 | |
|
| | 230 | | /// <summary> The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this f |
| | 231 | | /// <param name="policyAssignmentId"> The ID of the policy assignment to get. Use the format '{scope}/provi |
| | 232 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 233 | | public virtual async Task<Response<PolicyAssignment>> GetByIdAsync(string policyAssignmentId, CancellationToken |
| | 234 | | { |
| 4 | 235 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.GetById"); |
| 4 | 236 | | scope0.Start(); |
| | 237 | | try |
| | 238 | | { |
| 4 | 239 | | return await RestClient.GetByIdAsync(policyAssignmentId, cancellationToken).ConfigureAwait(false); |
| | 240 | | } |
| 0 | 241 | | catch (Exception e) |
| | 242 | | { |
| 0 | 243 | | scope0.Failed(e); |
| 0 | 244 | | throw; |
| | 245 | | } |
| 4 | 246 | | } |
| | 247 | |
|
| | 248 | | /// <summary> The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this f |
| | 249 | | /// <param name="policyAssignmentId"> The ID of the policy assignment to get. Use the format '{scope}/provi |
| | 250 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 251 | | public virtual Response<PolicyAssignment> GetById(string policyAssignmentId, CancellationToken cancellationToken |
| | 252 | | { |
| 4 | 253 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.GetById"); |
| 4 | 254 | | scope0.Start(); |
| | 255 | | try |
| | 256 | | { |
| 4 | 257 | | return RestClient.GetById(policyAssignmentId, cancellationToken); |
| | 258 | | } |
| 0 | 259 | | catch (Exception e) |
| | 260 | | { |
| 0 | 261 | | scope0.Failed(e); |
| 0 | 262 | | throw; |
| | 263 | | } |
| 4 | 264 | | } |
| | 265 | |
|
| | 266 | | /// <summary> This operation retrieves the list of all policy assignments associated with the given resource gro |
| | 267 | | /// <param name="resourceGroupName"> The name of the resource group that contains policy assignments. </param> |
| | 268 | | /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: 'atScope()&ap |
| | 269 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 270 | | public virtual AsyncPageable<PolicyAssignment> ListForResourceGroupAsync(string resourceGroupName, string filter |
| | 271 | | { |
| 2 | 272 | | if (resourceGroupName == null) |
| | 273 | | { |
| 0 | 274 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 275 | | } |
| | 276 | |
|
| | 277 | | async Task<Page<PolicyAssignment>> FirstPageFunc(int? pageSizeHint) |
| | 278 | | { |
| 2 | 279 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.ListForResourceGroup"); |
| 2 | 280 | | scope0.Start(); |
| | 281 | | try |
| | 282 | | { |
| 2 | 283 | | var response = await RestClient.ListForResourceGroupAsync(resourceGroupName, filter, cancellationTok |
| 2 | 284 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 285 | | } |
| 0 | 286 | | catch (Exception e) |
| | 287 | | { |
| 0 | 288 | | scope0.Failed(e); |
| 0 | 289 | | throw; |
| | 290 | | } |
| 2 | 291 | | } |
| | 292 | | async Task<Page<PolicyAssignment>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 293 | | { |
| 0 | 294 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.ListForResourceGroup"); |
| 0 | 295 | | scope0.Start(); |
| | 296 | | try |
| | 297 | | { |
| 0 | 298 | | var response = await RestClient.ListForResourceGroupNextPageAsync(nextLink, resourceGroupName, filte |
| 0 | 299 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 300 | | } |
| 0 | 301 | | catch (Exception e) |
| | 302 | | { |
| 0 | 303 | | scope0.Failed(e); |
| 0 | 304 | | throw; |
| | 305 | | } |
| 0 | 306 | | } |
| 2 | 307 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 308 | | } |
| | 309 | |
|
| | 310 | | /// <summary> This operation retrieves the list of all policy assignments associated with the given resource gro |
| | 311 | | /// <param name="resourceGroupName"> The name of the resource group that contains policy assignments. </param> |
| | 312 | | /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: 'atScope()&ap |
| | 313 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 314 | | public virtual Pageable<PolicyAssignment> ListForResourceGroup(string resourceGroupName, string filter = null, C |
| | 315 | | { |
| 2 | 316 | | if (resourceGroupName == null) |
| | 317 | | { |
| 0 | 318 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 319 | | } |
| | 320 | |
|
| | 321 | | Page<PolicyAssignment> FirstPageFunc(int? pageSizeHint) |
| | 322 | | { |
| 2 | 323 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.ListForResourceGroup"); |
| 2 | 324 | | scope0.Start(); |
| | 325 | | try |
| | 326 | | { |
| 2 | 327 | | var response = RestClient.ListForResourceGroup(resourceGroupName, filter, cancellationToken); |
| 2 | 328 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 329 | | } |
| 0 | 330 | | catch (Exception e) |
| | 331 | | { |
| 0 | 332 | | scope0.Failed(e); |
| 0 | 333 | | throw; |
| | 334 | | } |
| 2 | 335 | | } |
| | 336 | | Page<PolicyAssignment> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 337 | | { |
| 0 | 338 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.ListForResourceGroup"); |
| 0 | 339 | | scope0.Start(); |
| | 340 | | try |
| | 341 | | { |
| 0 | 342 | | var response = RestClient.ListForResourceGroupNextPage(nextLink, resourceGroupName, filter, cancella |
| 0 | 343 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 344 | | } |
| 0 | 345 | | catch (Exception e) |
| | 346 | | { |
| 0 | 347 | | scope0.Failed(e); |
| 0 | 348 | | throw; |
| | 349 | | } |
| 0 | 350 | | } |
| 2 | 351 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 352 | | } |
| | 353 | |
|
| | 354 | | /// <summary> This operation retrieves the list of all policy assignments associated with the specified resource |
| | 355 | | /// <param name="resourceGroupName"> The name of the resource group containing the resource. </param> |
| | 356 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider. For example, the namespace |
| | 357 | | /// <param name="parentResourcePath"> The parent resource path. Use empty string if there is none. </param> |
| | 358 | | /// <param name="resourceType"> The resource type name. For example the type name of a web app is 'sites&ap |
| | 359 | | /// <param name="resourceName"> The name of the resource. </param> |
| | 360 | | /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: 'atScope()&ap |
| | 361 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 362 | | public virtual AsyncPageable<PolicyAssignment> ListForResourceAsync(string resourceGroupName, string resourcePro |
| | 363 | | { |
| 2 | 364 | | if (resourceGroupName == null) |
| | 365 | | { |
| 0 | 366 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 367 | | } |
| 2 | 368 | | if (resourceProviderNamespace == null) |
| | 369 | | { |
| 0 | 370 | | throw new ArgumentNullException(nameof(resourceProviderNamespace)); |
| | 371 | | } |
| 2 | 372 | | if (parentResourcePath == null) |
| | 373 | | { |
| 0 | 374 | | throw new ArgumentNullException(nameof(parentResourcePath)); |
| | 375 | | } |
| 2 | 376 | | if (resourceType == null) |
| | 377 | | { |
| 0 | 378 | | throw new ArgumentNullException(nameof(resourceType)); |
| | 379 | | } |
| 2 | 380 | | if (resourceName == null) |
| | 381 | | { |
| 0 | 382 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 383 | | } |
| | 384 | |
|
| | 385 | | async Task<Page<PolicyAssignment>> FirstPageFunc(int? pageSizeHint) |
| | 386 | | { |
| 2 | 387 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.ListForResource"); |
| 2 | 388 | | scope0.Start(); |
| | 389 | | try |
| | 390 | | { |
| 2 | 391 | | var response = await RestClient.ListForResourceAsync(resourceGroupName, resourceProviderNamespace, p |
| 2 | 392 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 393 | | } |
| 0 | 394 | | catch (Exception e) |
| | 395 | | { |
| 0 | 396 | | scope0.Failed(e); |
| 0 | 397 | | throw; |
| | 398 | | } |
| 2 | 399 | | } |
| | 400 | | async Task<Page<PolicyAssignment>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 401 | | { |
| 0 | 402 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.ListForResource"); |
| 0 | 403 | | scope0.Start(); |
| | 404 | | try |
| | 405 | | { |
| 0 | 406 | | var response = await RestClient.ListForResourceNextPageAsync(nextLink, resourceGroupName, resourcePr |
| 0 | 407 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 408 | | } |
| 0 | 409 | | catch (Exception e) |
| | 410 | | { |
| 0 | 411 | | scope0.Failed(e); |
| 0 | 412 | | throw; |
| | 413 | | } |
| 0 | 414 | | } |
| 2 | 415 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 416 | | } |
| | 417 | |
|
| | 418 | | /// <summary> This operation retrieves the list of all policy assignments associated with the specified resource |
| | 419 | | /// <param name="resourceGroupName"> The name of the resource group containing the resource. </param> |
| | 420 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider. For example, the namespace |
| | 421 | | /// <param name="parentResourcePath"> The parent resource path. Use empty string if there is none. </param> |
| | 422 | | /// <param name="resourceType"> The resource type name. For example the type name of a web app is 'sites&ap |
| | 423 | | /// <param name="resourceName"> The name of the resource. </param> |
| | 424 | | /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: 'atScope()&ap |
| | 425 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 426 | | public virtual Pageable<PolicyAssignment> ListForResource(string resourceGroupName, string resourceProviderNames |
| | 427 | | { |
| 2 | 428 | | if (resourceGroupName == null) |
| | 429 | | { |
| 0 | 430 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 431 | | } |
| 2 | 432 | | if (resourceProviderNamespace == null) |
| | 433 | | { |
| 0 | 434 | | throw new ArgumentNullException(nameof(resourceProviderNamespace)); |
| | 435 | | } |
| 2 | 436 | | if (parentResourcePath == null) |
| | 437 | | { |
| 0 | 438 | | throw new ArgumentNullException(nameof(parentResourcePath)); |
| | 439 | | } |
| 2 | 440 | | if (resourceType == null) |
| | 441 | | { |
| 0 | 442 | | throw new ArgumentNullException(nameof(resourceType)); |
| | 443 | | } |
| 2 | 444 | | if (resourceName == null) |
| | 445 | | { |
| 0 | 446 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 447 | | } |
| | 448 | |
|
| | 449 | | Page<PolicyAssignment> FirstPageFunc(int? pageSizeHint) |
| | 450 | | { |
| 2 | 451 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.ListForResource"); |
| 2 | 452 | | scope0.Start(); |
| | 453 | | try |
| | 454 | | { |
| 2 | 455 | | var response = RestClient.ListForResource(resourceGroupName, resourceProviderNamespace, parentResour |
| 2 | 456 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 457 | | } |
| 0 | 458 | | catch (Exception e) |
| | 459 | | { |
| 0 | 460 | | scope0.Failed(e); |
| 0 | 461 | | throw; |
| | 462 | | } |
| 2 | 463 | | } |
| | 464 | | Page<PolicyAssignment> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 465 | | { |
| 0 | 466 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.ListForResource"); |
| 0 | 467 | | scope0.Start(); |
| | 468 | | try |
| | 469 | | { |
| 0 | 470 | | var response = RestClient.ListForResourceNextPage(nextLink, resourceGroupName, resourceProviderNames |
| 0 | 471 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 472 | | } |
| 0 | 473 | | catch (Exception e) |
| | 474 | | { |
| 0 | 475 | | scope0.Failed(e); |
| 0 | 476 | | throw; |
| | 477 | | } |
| 0 | 478 | | } |
| 2 | 479 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 480 | | } |
| | 481 | |
|
| | 482 | | /// <summary> This operation retrieves the list of all policy assignments applicable to the management group tha |
| | 483 | | /// <param name="managementGroupId"> The ID of the management group. </param> |
| | 484 | | /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: 'atScope()&ap |
| | 485 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 486 | | public virtual AsyncPageable<PolicyAssignment> ListForManagementGroupAsync(string managementGroupId, string filt |
| | 487 | | { |
| 0 | 488 | | if (managementGroupId == null) |
| | 489 | | { |
| 0 | 490 | | throw new ArgumentNullException(nameof(managementGroupId)); |
| | 491 | | } |
| 0 | 492 | | if (filter == null) |
| | 493 | | { |
| 0 | 494 | | throw new ArgumentNullException(nameof(filter)); |
| | 495 | | } |
| | 496 | |
|
| | 497 | | async Task<Page<PolicyAssignment>> FirstPageFunc(int? pageSizeHint) |
| | 498 | | { |
| 0 | 499 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.ListForManagementGroup"); |
| 0 | 500 | | scope0.Start(); |
| | 501 | | try |
| | 502 | | { |
| 0 | 503 | | var response = await RestClient.ListForManagementGroupAsync(managementGroupId, filter, cancellationT |
| 0 | 504 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 505 | | } |
| 0 | 506 | | catch (Exception e) |
| | 507 | | { |
| 0 | 508 | | scope0.Failed(e); |
| 0 | 509 | | throw; |
| | 510 | | } |
| 0 | 511 | | } |
| | 512 | | async Task<Page<PolicyAssignment>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 513 | | { |
| 0 | 514 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.ListForManagementGroup"); |
| 0 | 515 | | scope0.Start(); |
| | 516 | | try |
| | 517 | | { |
| 0 | 518 | | var response = await RestClient.ListForManagementGroupNextPageAsync(nextLink, managementGroupId, fil |
| 0 | 519 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 520 | | } |
| 0 | 521 | | catch (Exception e) |
| | 522 | | { |
| 0 | 523 | | scope0.Failed(e); |
| 0 | 524 | | throw; |
| | 525 | | } |
| 0 | 526 | | } |
| 0 | 527 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 528 | | } |
| | 529 | |
|
| | 530 | | /// <summary> This operation retrieves the list of all policy assignments applicable to the management group tha |
| | 531 | | /// <param name="managementGroupId"> The ID of the management group. </param> |
| | 532 | | /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: 'atScope()&ap |
| | 533 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 534 | | public virtual Pageable<PolicyAssignment> ListForManagementGroup(string managementGroupId, string filter, Cancel |
| | 535 | | { |
| 0 | 536 | | if (managementGroupId == null) |
| | 537 | | { |
| 0 | 538 | | throw new ArgumentNullException(nameof(managementGroupId)); |
| | 539 | | } |
| 0 | 540 | | if (filter == null) |
| | 541 | | { |
| 0 | 542 | | throw new ArgumentNullException(nameof(filter)); |
| | 543 | | } |
| | 544 | |
|
| | 545 | | Page<PolicyAssignment> FirstPageFunc(int? pageSizeHint) |
| | 546 | | { |
| 0 | 547 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.ListForManagementGroup"); |
| 0 | 548 | | scope0.Start(); |
| | 549 | | try |
| | 550 | | { |
| 0 | 551 | | var response = RestClient.ListForManagementGroup(managementGroupId, filter, cancellationToken); |
| 0 | 552 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 553 | | } |
| 0 | 554 | | catch (Exception e) |
| | 555 | | { |
| 0 | 556 | | scope0.Failed(e); |
| 0 | 557 | | throw; |
| | 558 | | } |
| 0 | 559 | | } |
| | 560 | | Page<PolicyAssignment> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 561 | | { |
| 0 | 562 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.ListForManagementGroup"); |
| 0 | 563 | | scope0.Start(); |
| | 564 | | try |
| | 565 | | { |
| 0 | 566 | | var response = RestClient.ListForManagementGroupNextPage(nextLink, managementGroupId, filter, cancel |
| 0 | 567 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 568 | | } |
| 0 | 569 | | catch (Exception e) |
| | 570 | | { |
| 0 | 571 | | scope0.Failed(e); |
| 0 | 572 | | throw; |
| | 573 | | } |
| 0 | 574 | | } |
| 0 | 575 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 576 | | } |
| | 577 | |
|
| | 578 | | /// <summary> This operation retrieves the list of all policy assignments associated with the given subscription |
| | 579 | | /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: 'atScope()&ap |
| | 580 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 581 | | public virtual AsyncPageable<PolicyAssignment> ListAsync(string filter = null, CancellationToken cancellationTok |
| | 582 | | { |
| | 583 | | async Task<Page<PolicyAssignment>> FirstPageFunc(int? pageSizeHint) |
| | 584 | | { |
| 6 | 585 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.List"); |
| 6 | 586 | | scope0.Start(); |
| | 587 | | try |
| | 588 | | { |
| 6 | 589 | | var response = await RestClient.ListAsync(filter, cancellationToken).ConfigureAwait(false); |
| 6 | 590 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 591 | | } |
| 0 | 592 | | catch (Exception e) |
| | 593 | | { |
| 0 | 594 | | scope0.Failed(e); |
| 0 | 595 | | throw; |
| | 596 | | } |
| 6 | 597 | | } |
| | 598 | | async Task<Page<PolicyAssignment>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 599 | | { |
| 0 | 600 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.List"); |
| 0 | 601 | | scope0.Start(); |
| | 602 | | try |
| | 603 | | { |
| 0 | 604 | | var response = await RestClient.ListNextPageAsync(nextLink, filter, cancellationToken).ConfigureAwai |
| 0 | 605 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 606 | | } |
| 0 | 607 | | catch (Exception e) |
| | 608 | | { |
| 0 | 609 | | scope0.Failed(e); |
| 0 | 610 | | throw; |
| | 611 | | } |
| 0 | 612 | | } |
| 6 | 613 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 614 | | } |
| | 615 | |
|
| | 616 | | /// <summary> This operation retrieves the list of all policy assignments associated with the given subscription |
| | 617 | | /// <param name="filter"> The filter to apply on the operation. Valid values for $filter are: 'atScope()&ap |
| | 618 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 619 | | public virtual Pageable<PolicyAssignment> List(string filter = null, CancellationToken cancellationToken = defau |
| | 620 | | { |
| | 621 | | Page<PolicyAssignment> FirstPageFunc(int? pageSizeHint) |
| | 622 | | { |
| 6 | 623 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.List"); |
| 6 | 624 | | scope0.Start(); |
| | 625 | | try |
| | 626 | | { |
| 6 | 627 | | var response = RestClient.List(filter, cancellationToken); |
| 6 | 628 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 629 | | } |
| 0 | 630 | | catch (Exception e) |
| | 631 | | { |
| 0 | 632 | | scope0.Failed(e); |
| 0 | 633 | | throw; |
| | 634 | | } |
| 6 | 635 | | } |
| | 636 | | Page<PolicyAssignment> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 637 | | { |
| 0 | 638 | | using var scope0 = _clientDiagnostics.CreateScope("PolicyAssignmentsOperations.List"); |
| 0 | 639 | | scope0.Start(); |
| | 640 | | try |
| | 641 | | { |
| 0 | 642 | | var response = RestClient.ListNextPage(nextLink, filter, cancellationToken); |
| 0 | 643 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 644 | | } |
| 0 | 645 | | catch (Exception e) |
| | 646 | | { |
| 0 | 647 | | scope0.Failed(e); |
| 0 | 648 | | throw; |
| | 649 | | } |
| 0 | 650 | | } |
| 6 | 651 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 652 | | } |
| | 653 | | } |
| | 654 | | } |