| | 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 PolicySetDefinitions service client. </summary> |
| | 19 | | public partial class PolicySetDefinitionsOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 452 | 23 | | internal PolicySetDefinitionsRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of PolicySetDefinitionsOperations for mocking. </summary> |
| 256 | 25 | | protected PolicySetDefinitionsOperations() |
| | 26 | | { |
| 256 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of PolicySetDefinitionsOperations. </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 PolicySetDefinitionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subsc |
| | 34 | | { |
| 256 | 35 | | RestClient = new PolicySetDefinitionsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 256 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 256 | 37 | | _pipeline = pipeline; |
| 256 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> This operation creates or updates a policy set definition in the given subscription with the given |
| | 41 | | /// <param name="policySetDefinitionName"> The name of the policy set definition to create. </param> |
| | 42 | | /// <param name="parameters"> The policy set definition properties. </param> |
| | 43 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 44 | | public virtual async Task<Response<PolicySetDefinition>> CreateOrUpdateAsync(string policySetDefinitionName, Pol |
| | 45 | | { |
| 16 | 46 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.CreateOrUpdate"); |
| 16 | 47 | | scope.Start(); |
| | 48 | | try |
| | 49 | | { |
| 16 | 50 | | return await RestClient.CreateOrUpdateAsync(policySetDefinitionName, parameters, cancellationToken).Conf |
| | 51 | | } |
| 8 | 52 | | catch (Exception e) |
| | 53 | | { |
| 8 | 54 | | scope.Failed(e); |
| 8 | 55 | | throw; |
| | 56 | | } |
| 8 | 57 | | } |
| | 58 | |
|
| | 59 | | /// <summary> This operation creates or updates a policy set definition in the given subscription with the given |
| | 60 | | /// <param name="policySetDefinitionName"> The name of the policy set definition to create. </param> |
| | 61 | | /// <param name="parameters"> The policy set definition properties. </param> |
| | 62 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 63 | | public virtual Response<PolicySetDefinition> CreateOrUpdate(string policySetDefinitionName, PolicySetDefinition |
| | 64 | | { |
| 16 | 65 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.CreateOrUpdate"); |
| 16 | 66 | | scope.Start(); |
| | 67 | | try |
| | 68 | | { |
| 16 | 69 | | return RestClient.CreateOrUpdate(policySetDefinitionName, parameters, cancellationToken); |
| | 70 | | } |
| 8 | 71 | | catch (Exception e) |
| | 72 | | { |
| 8 | 73 | | scope.Failed(e); |
| 8 | 74 | | throw; |
| | 75 | | } |
| 8 | 76 | | } |
| | 77 | |
|
| | 78 | | /// <summary> This operation deletes the policy set definition in the given subscription with the given name. </ |
| | 79 | | /// <param name="policySetDefinitionName"> The name of the policy set definition to delete. </param> |
| | 80 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 81 | | public virtual async Task<Response> DeleteAsync(string policySetDefinitionName, CancellationToken cancellationTo |
| | 82 | | { |
| 94 | 83 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.Delete"); |
| 94 | 84 | | scope.Start(); |
| | 85 | | try |
| | 86 | | { |
| 94 | 87 | | return await RestClient.DeleteAsync(policySetDefinitionName, cancellationToken).ConfigureAwait(false); |
| | 88 | | } |
| 0 | 89 | | catch (Exception e) |
| | 90 | | { |
| 0 | 91 | | scope.Failed(e); |
| 0 | 92 | | throw; |
| | 93 | | } |
| 94 | 94 | | } |
| | 95 | |
|
| | 96 | | /// <summary> This operation deletes the policy set definition in the given subscription with the given name. </ |
| | 97 | | /// <param name="policySetDefinitionName"> The name of the policy set definition to delete. </param> |
| | 98 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 99 | | public virtual Response Delete(string policySetDefinitionName, CancellationToken cancellationToken = default) |
| | 100 | | { |
| 94 | 101 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.Delete"); |
| 94 | 102 | | scope.Start(); |
| | 103 | | try |
| | 104 | | { |
| 94 | 105 | | return RestClient.Delete(policySetDefinitionName, cancellationToken); |
| | 106 | | } |
| 0 | 107 | | catch (Exception e) |
| | 108 | | { |
| 0 | 109 | | scope.Failed(e); |
| 0 | 110 | | throw; |
| | 111 | | } |
| 94 | 112 | | } |
| | 113 | |
|
| | 114 | | /// <summary> This operation retrieves the policy set definition in the given subscription with the given name. |
| | 115 | | /// <param name="policySetDefinitionName"> The name of the policy set definition to get. </param> |
| | 116 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 117 | | public virtual async Task<Response<PolicySetDefinition>> GetAsync(string policySetDefinitionName, CancellationTo |
| | 118 | | { |
| 14 | 119 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.Get"); |
| 14 | 120 | | scope.Start(); |
| | 121 | | try |
| | 122 | | { |
| 14 | 123 | | return await RestClient.GetAsync(policySetDefinitionName, cancellationToken).ConfigureAwait(false); |
| | 124 | | } |
| 6 | 125 | | catch (Exception e) |
| | 126 | | { |
| 6 | 127 | | scope.Failed(e); |
| 6 | 128 | | throw; |
| | 129 | | } |
| 8 | 130 | | } |
| | 131 | |
|
| | 132 | | /// <summary> This operation retrieves the policy set definition in the given subscription with the given name. |
| | 133 | | /// <param name="policySetDefinitionName"> The name of the policy set definition to get. </param> |
| | 134 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 135 | | public virtual Response<PolicySetDefinition> Get(string policySetDefinitionName, CancellationToken cancellationT |
| | 136 | | { |
| 14 | 137 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.Get"); |
| 14 | 138 | | scope.Start(); |
| | 139 | | try |
| | 140 | | { |
| 14 | 141 | | return RestClient.Get(policySetDefinitionName, cancellationToken); |
| | 142 | | } |
| 6 | 143 | | catch (Exception e) |
| | 144 | | { |
| 6 | 145 | | scope.Failed(e); |
| 6 | 146 | | throw; |
| | 147 | | } |
| 8 | 148 | | } |
| | 149 | |
|
| | 150 | | /// <summary> This operation retrieves the built-in policy set definition with the given name. </summary> |
| | 151 | | /// <param name="policySetDefinitionName"> The name of the policy set definition to get. </param> |
| | 152 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 153 | | public virtual async Task<Response<PolicySetDefinition>> GetBuiltInAsync(string policySetDefinitionName, Cancell |
| | 154 | | { |
| 88 | 155 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.GetBuiltIn"); |
| 88 | 156 | | scope.Start(); |
| | 157 | | try |
| | 158 | | { |
| 88 | 159 | | return await RestClient.GetBuiltInAsync(policySetDefinitionName, cancellationToken).ConfigureAwait(false |
| | 160 | | } |
| 0 | 161 | | catch (Exception e) |
| | 162 | | { |
| 0 | 163 | | scope.Failed(e); |
| 0 | 164 | | throw; |
| | 165 | | } |
| 88 | 166 | | } |
| | 167 | |
|
| | 168 | | /// <summary> This operation retrieves the built-in policy set definition with the given name. </summary> |
| | 169 | | /// <param name="policySetDefinitionName"> The name of the policy set definition to get. </param> |
| | 170 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 171 | | public virtual Response<PolicySetDefinition> GetBuiltIn(string policySetDefinitionName, CancellationToken cancel |
| | 172 | | { |
| 88 | 173 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.GetBuiltIn"); |
| 88 | 174 | | scope.Start(); |
| | 175 | | try |
| | 176 | | { |
| 88 | 177 | | return RestClient.GetBuiltIn(policySetDefinitionName, cancellationToken); |
| | 178 | | } |
| 0 | 179 | | catch (Exception e) |
| | 180 | | { |
| 0 | 181 | | scope.Failed(e); |
| 0 | 182 | | throw; |
| | 183 | | } |
| 88 | 184 | | } |
| | 185 | |
|
| | 186 | | /// <summary> This operation creates or updates a policy set definition in the given management group with the g |
| | 187 | | /// <param name="policySetDefinitionName"> The name of the policy set definition to create. </param> |
| | 188 | | /// <param name="managementGroupId"> The ID of the management group. </param> |
| | 189 | | /// <param name="parameters"> The policy set definition properties. </param> |
| | 190 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 191 | | public virtual async Task<Response<PolicySetDefinition>> CreateOrUpdateAtManagementGroupAsync(string policySetDe |
| | 192 | | { |
| 0 | 193 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.CreateOrUpdateAtManagementG |
| 0 | 194 | | scope.Start(); |
| | 195 | | try |
| | 196 | | { |
| 0 | 197 | | return await RestClient.CreateOrUpdateAtManagementGroupAsync(policySetDefinitionName, managementGroupId, |
| | 198 | | } |
| 0 | 199 | | catch (Exception e) |
| | 200 | | { |
| 0 | 201 | | scope.Failed(e); |
| 0 | 202 | | throw; |
| | 203 | | } |
| 0 | 204 | | } |
| | 205 | |
|
| | 206 | | /// <summary> This operation creates or updates a policy set definition in the given management group with the g |
| | 207 | | /// <param name="policySetDefinitionName"> The name of the policy set definition to create. </param> |
| | 208 | | /// <param name="managementGroupId"> The ID of the management group. </param> |
| | 209 | | /// <param name="parameters"> The policy set definition properties. </param> |
| | 210 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 211 | | public virtual Response<PolicySetDefinition> CreateOrUpdateAtManagementGroup(string policySetDefinitionName, str |
| | 212 | | { |
| 0 | 213 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.CreateOrUpdateAtManagementG |
| 0 | 214 | | scope.Start(); |
| | 215 | | try |
| | 216 | | { |
| 0 | 217 | | return RestClient.CreateOrUpdateAtManagementGroup(policySetDefinitionName, managementGroupId, parameters |
| | 218 | | } |
| 0 | 219 | | catch (Exception e) |
| | 220 | | { |
| 0 | 221 | | scope.Failed(e); |
| 0 | 222 | | throw; |
| | 223 | | } |
| 0 | 224 | | } |
| | 225 | |
|
| | 226 | | /// <summary> This operation deletes the policy set definition in the given management group with the given name |
| | 227 | | /// <param name="policySetDefinitionName"> The name of the policy set definition to delete. </param> |
| | 228 | | /// <param name="managementGroupId"> The ID of the management group. </param> |
| | 229 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 230 | | public virtual async Task<Response> DeleteAtManagementGroupAsync(string policySetDefinitionName, string manageme |
| | 231 | | { |
| 0 | 232 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.DeleteAtManagementGroup"); |
| 0 | 233 | | scope.Start(); |
| | 234 | | try |
| | 235 | | { |
| 0 | 236 | | return await RestClient.DeleteAtManagementGroupAsync(policySetDefinitionName, managementGroupId, cancell |
| | 237 | | } |
| 0 | 238 | | catch (Exception e) |
| | 239 | | { |
| 0 | 240 | | scope.Failed(e); |
| 0 | 241 | | throw; |
| | 242 | | } |
| 0 | 243 | | } |
| | 244 | |
|
| | 245 | | /// <summary> This operation deletes the policy set definition in the given management group with the given name |
| | 246 | | /// <param name="policySetDefinitionName"> The name of the policy set definition to delete. </param> |
| | 247 | | /// <param name="managementGroupId"> The ID of the management group. </param> |
| | 248 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 249 | | public virtual Response DeleteAtManagementGroup(string policySetDefinitionName, string managementGroupId, Cancel |
| | 250 | | { |
| 0 | 251 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.DeleteAtManagementGroup"); |
| 0 | 252 | | scope.Start(); |
| | 253 | | try |
| | 254 | | { |
| 0 | 255 | | return RestClient.DeleteAtManagementGroup(policySetDefinitionName, managementGroupId, cancellationToken) |
| | 256 | | } |
| 0 | 257 | | catch (Exception e) |
| | 258 | | { |
| 0 | 259 | | scope.Failed(e); |
| 0 | 260 | | throw; |
| | 261 | | } |
| 0 | 262 | | } |
| | 263 | |
|
| | 264 | | /// <summary> This operation retrieves the policy set definition in the given management group with the given na |
| | 265 | | /// <param name="policySetDefinitionName"> The name of the policy set definition to get. </param> |
| | 266 | | /// <param name="managementGroupId"> The ID of the management group. </param> |
| | 267 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 268 | | public virtual async Task<Response<PolicySetDefinition>> GetAtManagementGroupAsync(string policySetDefinitionNam |
| | 269 | | { |
| 0 | 270 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.GetAtManagementGroup"); |
| 0 | 271 | | scope.Start(); |
| | 272 | | try |
| | 273 | | { |
| 0 | 274 | | return await RestClient.GetAtManagementGroupAsync(policySetDefinitionName, managementGroupId, cancellati |
| | 275 | | } |
| 0 | 276 | | catch (Exception e) |
| | 277 | | { |
| 0 | 278 | | scope.Failed(e); |
| 0 | 279 | | throw; |
| | 280 | | } |
| 0 | 281 | | } |
| | 282 | |
|
| | 283 | | /// <summary> This operation retrieves the policy set definition in the given management group with the given na |
| | 284 | | /// <param name="policySetDefinitionName"> The name of the policy set definition to get. </param> |
| | 285 | | /// <param name="managementGroupId"> The ID of the management group. </param> |
| | 286 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 287 | | public virtual Response<PolicySetDefinition> GetAtManagementGroup(string policySetDefinitionName, string managem |
| | 288 | | { |
| 0 | 289 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.GetAtManagementGroup"); |
| 0 | 290 | | scope.Start(); |
| | 291 | | try |
| | 292 | | { |
| 0 | 293 | | return RestClient.GetAtManagementGroup(policySetDefinitionName, managementGroupId, cancellationToken); |
| | 294 | | } |
| 0 | 295 | | catch (Exception e) |
| | 296 | | { |
| 0 | 297 | | scope.Failed(e); |
| 0 | 298 | | throw; |
| | 299 | | } |
| 0 | 300 | | } |
| | 301 | |
|
| | 302 | | /// <summary> This operation retrieves a list of all the policy set definitions in the given subscription. </sum |
| | 303 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 304 | | public virtual AsyncPageable<PolicySetDefinition> ListAsync(CancellationToken cancellationToken = default) |
| | 305 | | { |
| | 306 | | async Task<Page<PolicySetDefinition>> FirstPageFunc(int? pageSizeHint) |
| | 307 | | { |
| 8 | 308 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.List"); |
| 8 | 309 | | scope.Start(); |
| | 310 | | try |
| | 311 | | { |
| 8 | 312 | | var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false); |
| 8 | 313 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 314 | | } |
| 0 | 315 | | catch (Exception e) |
| | 316 | | { |
| 0 | 317 | | scope.Failed(e); |
| 0 | 318 | | throw; |
| | 319 | | } |
| 8 | 320 | | } |
| | 321 | | async Task<Page<PolicySetDefinition>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 322 | | { |
| 0 | 323 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.List"); |
| 0 | 324 | | scope.Start(); |
| | 325 | | try |
| | 326 | | { |
| 0 | 327 | | var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false) |
| 0 | 328 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 329 | | } |
| 0 | 330 | | catch (Exception e) |
| | 331 | | { |
| 0 | 332 | | scope.Failed(e); |
| 0 | 333 | | throw; |
| | 334 | | } |
| 0 | 335 | | } |
| 8 | 336 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 337 | | } |
| | 338 | |
|
| | 339 | | /// <summary> This operation retrieves a list of all the policy set definitions in the given subscription. </sum |
| | 340 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 341 | | public virtual Pageable<PolicySetDefinition> List(CancellationToken cancellationToken = default) |
| | 342 | | { |
| | 343 | | Page<PolicySetDefinition> FirstPageFunc(int? pageSizeHint) |
| | 344 | | { |
| 8 | 345 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.List"); |
| 8 | 346 | | scope.Start(); |
| | 347 | | try |
| | 348 | | { |
| 8 | 349 | | var response = RestClient.List(cancellationToken); |
| 8 | 350 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 351 | | } |
| 0 | 352 | | catch (Exception e) |
| | 353 | | { |
| 0 | 354 | | scope.Failed(e); |
| 0 | 355 | | throw; |
| | 356 | | } |
| 8 | 357 | | } |
| | 358 | | Page<PolicySetDefinition> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 359 | | { |
| 0 | 360 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.List"); |
| 0 | 361 | | scope.Start(); |
| | 362 | | try |
| | 363 | | { |
| 0 | 364 | | var response = RestClient.ListNextPage(nextLink, cancellationToken); |
| 0 | 365 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 366 | | } |
| 0 | 367 | | catch (Exception e) |
| | 368 | | { |
| 0 | 369 | | scope.Failed(e); |
| 0 | 370 | | throw; |
| | 371 | | } |
| 0 | 372 | | } |
| 8 | 373 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 374 | | } |
| | 375 | |
|
| | 376 | | /// <summary> This operation retrieves a list of all the built-in policy set definitions. </summary> |
| | 377 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 378 | | public virtual AsyncPageable<PolicySetDefinition> ListBuiltInAsync(CancellationToken cancellationToken = default |
| | 379 | | { |
| | 380 | | async Task<Page<PolicySetDefinition>> FirstPageFunc(int? pageSizeHint) |
| | 381 | | { |
| 6 | 382 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.ListBuiltIn"); |
| 6 | 383 | | scope.Start(); |
| | 384 | | try |
| | 385 | | { |
| 6 | 386 | | var response = await RestClient.ListBuiltInAsync(cancellationToken).ConfigureAwait(false); |
| 6 | 387 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 388 | | } |
| 0 | 389 | | catch (Exception e) |
| | 390 | | { |
| 0 | 391 | | scope.Failed(e); |
| 0 | 392 | | throw; |
| | 393 | | } |
| 6 | 394 | | } |
| | 395 | | async Task<Page<PolicySetDefinition>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 396 | | { |
| 0 | 397 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.ListBuiltIn"); |
| 0 | 398 | | scope.Start(); |
| | 399 | | try |
| | 400 | | { |
| 0 | 401 | | var response = await RestClient.ListBuiltInNextPageAsync(nextLink, cancellationToken).ConfigureAwait |
| 0 | 402 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 403 | | } |
| 0 | 404 | | catch (Exception e) |
| | 405 | | { |
| 0 | 406 | | scope.Failed(e); |
| 0 | 407 | | throw; |
| | 408 | | } |
| 0 | 409 | | } |
| 6 | 410 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 411 | | } |
| | 412 | |
|
| | 413 | | /// <summary> This operation retrieves a list of all the built-in policy set definitions. </summary> |
| | 414 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 415 | | public virtual Pageable<PolicySetDefinition> ListBuiltIn(CancellationToken cancellationToken = default) |
| | 416 | | { |
| | 417 | | Page<PolicySetDefinition> FirstPageFunc(int? pageSizeHint) |
| | 418 | | { |
| 6 | 419 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.ListBuiltIn"); |
| 6 | 420 | | scope.Start(); |
| | 421 | | try |
| | 422 | | { |
| 6 | 423 | | var response = RestClient.ListBuiltIn(cancellationToken); |
| 6 | 424 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 425 | | } |
| 0 | 426 | | catch (Exception e) |
| | 427 | | { |
| 0 | 428 | | scope.Failed(e); |
| 0 | 429 | | throw; |
| | 430 | | } |
| 6 | 431 | | } |
| | 432 | | Page<PolicySetDefinition> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 433 | | { |
| 0 | 434 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.ListBuiltIn"); |
| 0 | 435 | | scope.Start(); |
| | 436 | | try |
| | 437 | | { |
| 0 | 438 | | var response = RestClient.ListBuiltInNextPage(nextLink, cancellationToken); |
| 0 | 439 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 440 | | } |
| 0 | 441 | | catch (Exception e) |
| | 442 | | { |
| 0 | 443 | | scope.Failed(e); |
| 0 | 444 | | throw; |
| | 445 | | } |
| 0 | 446 | | } |
| 6 | 447 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 448 | | } |
| | 449 | |
|
| | 450 | | /// <summary> This operation retrieves a list of all the a policy set definition in the given management group. |
| | 451 | | /// <param name="managementGroupId"> The ID of the management group. </param> |
| | 452 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 453 | | public virtual AsyncPageable<PolicySetDefinition> ListByManagementGroupAsync(string managementGroupId, Cancellat |
| | 454 | | { |
| 0 | 455 | | if (managementGroupId == null) |
| | 456 | | { |
| 0 | 457 | | throw new ArgumentNullException(nameof(managementGroupId)); |
| | 458 | | } |
| | 459 | |
|
| | 460 | | async Task<Page<PolicySetDefinition>> FirstPageFunc(int? pageSizeHint) |
| | 461 | | { |
| 0 | 462 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.ListByManagementGroup") |
| 0 | 463 | | scope.Start(); |
| | 464 | | try |
| | 465 | | { |
| 0 | 466 | | var response = await RestClient.ListByManagementGroupAsync(managementGroupId, cancellationToken).Con |
| 0 | 467 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 468 | | } |
| 0 | 469 | | catch (Exception e) |
| | 470 | | { |
| 0 | 471 | | scope.Failed(e); |
| 0 | 472 | | throw; |
| | 473 | | } |
| 0 | 474 | | } |
| | 475 | | async Task<Page<PolicySetDefinition>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 476 | | { |
| 0 | 477 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.ListByManagementGroup") |
| 0 | 478 | | scope.Start(); |
| | 479 | | try |
| | 480 | | { |
| 0 | 481 | | var response = await RestClient.ListByManagementGroupNextPageAsync(nextLink, managementGroupId, canc |
| 0 | 482 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 483 | | } |
| 0 | 484 | | catch (Exception e) |
| | 485 | | { |
| 0 | 486 | | scope.Failed(e); |
| 0 | 487 | | throw; |
| | 488 | | } |
| 0 | 489 | | } |
| 0 | 490 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 491 | | } |
| | 492 | |
|
| | 493 | | /// <summary> This operation retrieves a list of all the a policy set definition in the given management group. |
| | 494 | | /// <param name="managementGroupId"> The ID of the management group. </param> |
| | 495 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 496 | | public virtual Pageable<PolicySetDefinition> ListByManagementGroup(string managementGroupId, CancellationToken c |
| | 497 | | { |
| 0 | 498 | | if (managementGroupId == null) |
| | 499 | | { |
| 0 | 500 | | throw new ArgumentNullException(nameof(managementGroupId)); |
| | 501 | | } |
| | 502 | |
|
| | 503 | | Page<PolicySetDefinition> FirstPageFunc(int? pageSizeHint) |
| | 504 | | { |
| 0 | 505 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.ListByManagementGroup") |
| 0 | 506 | | scope.Start(); |
| | 507 | | try |
| | 508 | | { |
| 0 | 509 | | var response = RestClient.ListByManagementGroup(managementGroupId, cancellationToken); |
| 0 | 510 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 511 | | } |
| 0 | 512 | | catch (Exception e) |
| | 513 | | { |
| 0 | 514 | | scope.Failed(e); |
| 0 | 515 | | throw; |
| | 516 | | } |
| 0 | 517 | | } |
| | 518 | | Page<PolicySetDefinition> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 519 | | { |
| 0 | 520 | | using var scope = _clientDiagnostics.CreateScope("PolicySetDefinitionsOperations.ListByManagementGroup") |
| 0 | 521 | | scope.Start(); |
| | 522 | | try |
| | 523 | | { |
| 0 | 524 | | var response = RestClient.ListByManagementGroupNextPage(nextLink, managementGroupId, cancellationTok |
| 0 | 525 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 526 | | } |
| 0 | 527 | | catch (Exception e) |
| | 528 | | { |
| 0 | 529 | | scope.Failed(e); |
| 0 | 530 | | throw; |
| | 531 | | } |
| 0 | 532 | | } |
| 0 | 533 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 534 | | } |
| | 535 | | } |
| | 536 | | } |