| | 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 ManagementLocks service client. </summary> |
| | 19 | | public partial class ManagementLocksOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 0 | 23 | | internal ManagementLocksRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of ManagementLocksOperations for mocking. </summary> |
| 0 | 25 | | protected ManagementLocksOperations() |
| | 26 | | { |
| 0 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of ManagementLocksOperations. </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> |
| 0 | 33 | | internal ManagementLocksOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscripti |
| | 34 | | { |
| 0 | 35 | | RestClient = new ManagementLocksRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 0 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 37 | | _pipeline = pipeline; |
| 0 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> When you apply a lock at a parent scope, all child resources inherit the same lock. To create mana |
| | 41 | | /// <param name="resourceGroupName"> The name of the resource group to lock. </param> |
| | 42 | | /// <param name="lockName"> The lock name. The lock name can be a maximum of 260 characters. It cannot contain & |
| | 43 | | /// <param name="parameters"> The management lock parameters. </param> |
| | 44 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 45 | | public virtual async Task<Response<ManagementLockObject>> CreateOrUpdateAtResourceGroupLevelAsync(string resourc |
| | 46 | | { |
| 0 | 47 | | using var scope = _clientDiagnostics.CreateScope("ManagementLocksOperations.CreateOrUpdateAtResourceGroupLev |
| 0 | 48 | | scope.Start(); |
| | 49 | | try |
| | 50 | | { |
| 0 | 51 | | return await RestClient.CreateOrUpdateAtResourceGroupLevelAsync(resourceGroupName, lockName, parameters, |
| | 52 | | } |
| 0 | 53 | | catch (Exception e) |
| | 54 | | { |
| 0 | 55 | | scope.Failed(e); |
| 0 | 56 | | throw; |
| | 57 | | } |
| 0 | 58 | | } |
| | 59 | |
|
| | 60 | | /// <summary> When you apply a lock at a parent scope, all child resources inherit the same lock. To create mana |
| | 61 | | /// <param name="resourceGroupName"> The name of the resource group to lock. </param> |
| | 62 | | /// <param name="lockName"> The lock name. The lock name can be a maximum of 260 characters. It cannot contain & |
| | 63 | | /// <param name="parameters"> The management lock parameters. </param> |
| | 64 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 65 | | public virtual Response<ManagementLockObject> CreateOrUpdateAtResourceGroupLevel(string resourceGroupName, strin |
| | 66 | | { |
| 0 | 67 | | using var scope = _clientDiagnostics.CreateScope("ManagementLocksOperations.CreateOrUpdateAtResourceGroupLev |
| 0 | 68 | | scope.Start(); |
| | 69 | | try |
| | 70 | | { |
| 0 | 71 | | return RestClient.CreateOrUpdateAtResourceGroupLevel(resourceGroupName, lockName, parameters, cancellati |
| | 72 | | } |
| 0 | 73 | | catch (Exception e) |
| | 74 | | { |
| 0 | 75 | | scope.Failed(e); |
| 0 | 76 | | throw; |
| | 77 | | } |
| 0 | 78 | | } |
| | 79 | |
|
| | 80 | | /// <summary> To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authori |
| | 81 | | /// <param name="resourceGroupName"> The name of the resource group containing the lock. </param> |
| | 82 | | /// <param name="lockName"> The name of lock to delete. </param> |
| | 83 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 84 | | public virtual async Task<Response> DeleteAtResourceGroupLevelAsync(string resourceGroupName, string lockName, C |
| | 85 | | { |
| 0 | 86 | | using var scope = _clientDiagnostics.CreateScope("ManagementLocksOperations.DeleteAtResourceGroupLevel"); |
| 0 | 87 | | scope.Start(); |
| | 88 | | try |
| | 89 | | { |
| 0 | 90 | | return await RestClient.DeleteAtResourceGroupLevelAsync(resourceGroupName, lockName, cancellationToken). |
| | 91 | | } |
| 0 | 92 | | catch (Exception e) |
| | 93 | | { |
| 0 | 94 | | scope.Failed(e); |
| 0 | 95 | | throw; |
| | 96 | | } |
| 0 | 97 | | } |
| | 98 | |
|
| | 99 | | /// <summary> To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authori |
| | 100 | | /// <param name="resourceGroupName"> The name of the resource group containing the lock. </param> |
| | 101 | | /// <param name="lockName"> The name of lock to delete. </param> |
| | 102 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 103 | | public virtual Response DeleteAtResourceGroupLevel(string resourceGroupName, string lockName, CancellationToken |
| | 104 | | { |
| 0 | 105 | | using var scope = _clientDiagnostics.CreateScope("ManagementLocksOperations.DeleteAtResourceGroupLevel"); |
| 0 | 106 | | scope.Start(); |
| | 107 | | try |
| | 108 | | { |
| 0 | 109 | | return RestClient.DeleteAtResourceGroupLevel(resourceGroupName, lockName, cancellationToken); |
| | 110 | | } |
| 0 | 111 | | catch (Exception e) |
| | 112 | | { |
| 0 | 113 | | scope.Failed(e); |
| 0 | 114 | | throw; |
| | 115 | | } |
| 0 | 116 | | } |
| | 117 | |
|
| | 118 | | /// <summary> Gets a management lock at the resource group level. </summary> |
| | 119 | | /// <param name="resourceGroupName"> The name of the locked resource group. </param> |
| | 120 | | /// <param name="lockName"> The name of the lock to get. </param> |
| | 121 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 122 | | public virtual async Task<Response<ManagementLockObject>> GetAtResourceGroupLevelAsync(string resourceGroupName, |
| | 123 | | { |
| 0 | 124 | | using var scope = _clientDiagnostics.CreateScope("ManagementLocksOperations.GetAtResourceGroupLevel"); |
| 0 | 125 | | scope.Start(); |
| | 126 | | try |
| | 127 | | { |
| 0 | 128 | | return await RestClient.GetAtResourceGroupLevelAsync(resourceGroupName, lockName, cancellationToken).Con |
| | 129 | | } |
| 0 | 130 | | catch (Exception e) |
| | 131 | | { |
| 0 | 132 | | scope.Failed(e); |
| 0 | 133 | | throw; |
| | 134 | | } |
| 0 | 135 | | } |
| | 136 | |
|
| | 137 | | /// <summary> Gets a management lock at the resource group level. </summary> |
| | 138 | | /// <param name="resourceGroupName"> The name of the locked resource group. </param> |
| | 139 | | /// <param name="lockName"> The name of the lock to get. </param> |
| | 140 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 141 | | public virtual Response<ManagementLockObject> GetAtResourceGroupLevel(string resourceGroupName, string lockName, |
| | 142 | | { |
| 0 | 143 | | using var scope = _clientDiagnostics.CreateScope("ManagementLocksOperations.GetAtResourceGroupLevel"); |
| 0 | 144 | | scope.Start(); |
| | 145 | | try |
| | 146 | | { |
| 0 | 147 | | return RestClient.GetAtResourceGroupLevel(resourceGroupName, lockName, cancellationToken); |
| | 148 | | } |
| 0 | 149 | | catch (Exception e) |
| | 150 | | { |
| 0 | 151 | | scope.Failed(e); |
| 0 | 152 | | throw; |
| | 153 | | } |
| 0 | 154 | | } |
| | 155 | |
|
| | 156 | | /// <summary> Create or update a management lock by scope. </summary> |
| | 157 | | /// <param name="scope"> The scope for the lock. When providing a scope for the assignment, use '/subscript |
| | 158 | | /// <param name="lockName"> The name of lock. </param> |
| | 159 | | /// <param name="parameters"> Create or update management lock parameters. </param> |
| | 160 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 161 | | public virtual async Task<Response<ManagementLockObject>> CreateOrUpdateByScopeAsync(string scope, string lockNa |
| | 162 | | { |
| 0 | 163 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.CreateOrUpdateByScope"); |
| 0 | 164 | | scope0.Start(); |
| | 165 | | try |
| | 166 | | { |
| 0 | 167 | | return await RestClient.CreateOrUpdateByScopeAsync(scope, lockName, parameters, cancellationToken).Confi |
| | 168 | | } |
| 0 | 169 | | catch (Exception e) |
| | 170 | | { |
| 0 | 171 | | scope0.Failed(e); |
| 0 | 172 | | throw; |
| | 173 | | } |
| 0 | 174 | | } |
| | 175 | |
|
| | 176 | | /// <summary> Create or update a management lock by scope. </summary> |
| | 177 | | /// <param name="scope"> The scope for the lock. When providing a scope for the assignment, use '/subscript |
| | 178 | | /// <param name="lockName"> The name of lock. </param> |
| | 179 | | /// <param name="parameters"> Create or update management lock parameters. </param> |
| | 180 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 181 | | public virtual Response<ManagementLockObject> CreateOrUpdateByScope(string scope, string lockName, ManagementLoc |
| | 182 | | { |
| 0 | 183 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.CreateOrUpdateByScope"); |
| 0 | 184 | | scope0.Start(); |
| | 185 | | try |
| | 186 | | { |
| 0 | 187 | | return RestClient.CreateOrUpdateByScope(scope, lockName, parameters, cancellationToken); |
| | 188 | | } |
| 0 | 189 | | catch (Exception e) |
| | 190 | | { |
| 0 | 191 | | scope0.Failed(e); |
| 0 | 192 | | throw; |
| | 193 | | } |
| 0 | 194 | | } |
| | 195 | |
|
| | 196 | | /// <summary> Delete a management lock by scope. </summary> |
| | 197 | | /// <param name="scope"> The scope for the lock. </param> |
| | 198 | | /// <param name="lockName"> The name of lock. </param> |
| | 199 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 200 | | public virtual async Task<Response> DeleteByScopeAsync(string scope, string lockName, CancellationToken cancella |
| | 201 | | { |
| 0 | 202 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.DeleteByScope"); |
| 0 | 203 | | scope0.Start(); |
| | 204 | | try |
| | 205 | | { |
| 0 | 206 | | return await RestClient.DeleteByScopeAsync(scope, lockName, cancellationToken).ConfigureAwait(false); |
| | 207 | | } |
| 0 | 208 | | catch (Exception e) |
| | 209 | | { |
| 0 | 210 | | scope0.Failed(e); |
| 0 | 211 | | throw; |
| | 212 | | } |
| 0 | 213 | | } |
| | 214 | |
|
| | 215 | | /// <summary> Delete a management lock by scope. </summary> |
| | 216 | | /// <param name="scope"> The scope for the lock. </param> |
| | 217 | | /// <param name="lockName"> The name of lock. </param> |
| | 218 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 219 | | public virtual Response DeleteByScope(string scope, string lockName, CancellationToken cancellationToken = defau |
| | 220 | | { |
| 0 | 221 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.DeleteByScope"); |
| 0 | 222 | | scope0.Start(); |
| | 223 | | try |
| | 224 | | { |
| 0 | 225 | | return RestClient.DeleteByScope(scope, lockName, cancellationToken); |
| | 226 | | } |
| 0 | 227 | | catch (Exception e) |
| | 228 | | { |
| 0 | 229 | | scope0.Failed(e); |
| 0 | 230 | | throw; |
| | 231 | | } |
| 0 | 232 | | } |
| | 233 | |
|
| | 234 | | /// <summary> Get a management lock by scope. </summary> |
| | 235 | | /// <param name="scope"> The scope for the lock. </param> |
| | 236 | | /// <param name="lockName"> The name of lock. </param> |
| | 237 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 238 | | public virtual async Task<Response<ManagementLockObject>> GetByScopeAsync(string scope, string lockName, Cancell |
| | 239 | | { |
| 0 | 240 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.GetByScope"); |
| 0 | 241 | | scope0.Start(); |
| | 242 | | try |
| | 243 | | { |
| 0 | 244 | | return await RestClient.GetByScopeAsync(scope, lockName, cancellationToken).ConfigureAwait(false); |
| | 245 | | } |
| 0 | 246 | | catch (Exception e) |
| | 247 | | { |
| 0 | 248 | | scope0.Failed(e); |
| 0 | 249 | | throw; |
| | 250 | | } |
| 0 | 251 | | } |
| | 252 | |
|
| | 253 | | /// <summary> Get a management lock by scope. </summary> |
| | 254 | | /// <param name="scope"> The scope for the lock. </param> |
| | 255 | | /// <param name="lockName"> The name of lock. </param> |
| | 256 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 257 | | public virtual Response<ManagementLockObject> GetByScope(string scope, string lockName, CancellationToken cancel |
| | 258 | | { |
| 0 | 259 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.GetByScope"); |
| 0 | 260 | | scope0.Start(); |
| | 261 | | try |
| | 262 | | { |
| 0 | 263 | | return RestClient.GetByScope(scope, lockName, cancellationToken); |
| | 264 | | } |
| 0 | 265 | | catch (Exception e) |
| | 266 | | { |
| 0 | 267 | | scope0.Failed(e); |
| 0 | 268 | | throw; |
| | 269 | | } |
| 0 | 270 | | } |
| | 271 | |
|
| | 272 | | /// <summary> When you apply a lock at a parent scope, all child resources inherit the same lock. To create mana |
| | 273 | | /// <param name="resourceGroupName"> The name of the resource group containing the resource to lock. </param> |
| | 274 | | /// <param name="resourceProviderNamespace"> The resource provider namespace of the resource to lock. </param> |
| | 275 | | /// <param name="parentResourcePath"> The parent resource identity. </param> |
| | 276 | | /// <param name="resourceType"> The resource type of the resource to lock. </param> |
| | 277 | | /// <param name="resourceName"> The name of the resource to lock. </param> |
| | 278 | | /// <param name="lockName"> The name of lock. The lock name can be a maximum of 260 characters. It cannot contai |
| | 279 | | /// <param name="parameters"> Parameters for creating or updating a management lock. </param> |
| | 280 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 281 | | public virtual async Task<Response<ManagementLockObject>> CreateOrUpdateAtResourceLevelAsync(string resourceGrou |
| | 282 | | { |
| 0 | 283 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.CreateOrUpdateAtResourceLevel") |
| 0 | 284 | | scope0.Start(); |
| | 285 | | try |
| | 286 | | { |
| 0 | 287 | | return await RestClient.CreateOrUpdateAtResourceLevelAsync(resourceGroupName, resourceProviderNamespace, |
| | 288 | | } |
| 0 | 289 | | catch (Exception e) |
| | 290 | | { |
| 0 | 291 | | scope0.Failed(e); |
| 0 | 292 | | throw; |
| | 293 | | } |
| 0 | 294 | | } |
| | 295 | |
|
| | 296 | | /// <summary> When you apply a lock at a parent scope, all child resources inherit the same lock. To create mana |
| | 297 | | /// <param name="resourceGroupName"> The name of the resource group containing the resource to lock. </param> |
| | 298 | | /// <param name="resourceProviderNamespace"> The resource provider namespace of the resource to lock. </param> |
| | 299 | | /// <param name="parentResourcePath"> The parent resource identity. </param> |
| | 300 | | /// <param name="resourceType"> The resource type of the resource to lock. </param> |
| | 301 | | /// <param name="resourceName"> The name of the resource to lock. </param> |
| | 302 | | /// <param name="lockName"> The name of lock. The lock name can be a maximum of 260 characters. It cannot contai |
| | 303 | | /// <param name="parameters"> Parameters for creating or updating a management lock. </param> |
| | 304 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 305 | | public virtual Response<ManagementLockObject> CreateOrUpdateAtResourceLevel(string resourceGroupName, string res |
| | 306 | | { |
| 0 | 307 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.CreateOrUpdateAtResourceLevel") |
| 0 | 308 | | scope0.Start(); |
| | 309 | | try |
| | 310 | | { |
| 0 | 311 | | return RestClient.CreateOrUpdateAtResourceLevel(resourceGroupName, resourceProviderNamespace, parentReso |
| | 312 | | } |
| 0 | 313 | | catch (Exception e) |
| | 314 | | { |
| 0 | 315 | | scope0.Failed(e); |
| 0 | 316 | | throw; |
| | 317 | | } |
| 0 | 318 | | } |
| | 319 | |
|
| | 320 | | /// <summary> To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authori |
| | 321 | | /// <param name="resourceGroupName"> The name of the resource group containing the resource with the lock to del |
| | 322 | | /// <param name="resourceProviderNamespace"> The resource provider namespace of the resource with the lock to de |
| | 323 | | /// <param name="parentResourcePath"> The parent resource identity. </param> |
| | 324 | | /// <param name="resourceType"> The resource type of the resource with the lock to delete. </param> |
| | 325 | | /// <param name="resourceName"> The name of the resource with the lock to delete. </param> |
| | 326 | | /// <param name="lockName"> The name of the lock to delete. </param> |
| | 327 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 328 | | public virtual async Task<Response> DeleteAtResourceLevelAsync(string resourceGroupName, string resourceProvider |
| | 329 | | { |
| 0 | 330 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.DeleteAtResourceLevel"); |
| 0 | 331 | | scope0.Start(); |
| | 332 | | try |
| | 333 | | { |
| 0 | 334 | | return await RestClient.DeleteAtResourceLevelAsync(resourceGroupName, resourceProviderNamespace, parentR |
| | 335 | | } |
| 0 | 336 | | catch (Exception e) |
| | 337 | | { |
| 0 | 338 | | scope0.Failed(e); |
| 0 | 339 | | throw; |
| | 340 | | } |
| 0 | 341 | | } |
| | 342 | |
|
| | 343 | | /// <summary> To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authori |
| | 344 | | /// <param name="resourceGroupName"> The name of the resource group containing the resource with the lock to del |
| | 345 | | /// <param name="resourceProviderNamespace"> The resource provider namespace of the resource with the lock to de |
| | 346 | | /// <param name="parentResourcePath"> The parent resource identity. </param> |
| | 347 | | /// <param name="resourceType"> The resource type of the resource with the lock to delete. </param> |
| | 348 | | /// <param name="resourceName"> The name of the resource with the lock to delete. </param> |
| | 349 | | /// <param name="lockName"> The name of the lock to delete. </param> |
| | 350 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 351 | | public virtual Response DeleteAtResourceLevel(string resourceGroupName, string resourceProviderNamespace, string |
| | 352 | | { |
| 0 | 353 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.DeleteAtResourceLevel"); |
| 0 | 354 | | scope0.Start(); |
| | 355 | | try |
| | 356 | | { |
| 0 | 357 | | return RestClient.DeleteAtResourceLevel(resourceGroupName, resourceProviderNamespace, parentResourcePath |
| | 358 | | } |
| 0 | 359 | | catch (Exception e) |
| | 360 | | { |
| 0 | 361 | | scope0.Failed(e); |
| 0 | 362 | | throw; |
| | 363 | | } |
| 0 | 364 | | } |
| | 365 | |
|
| | 366 | | /// <summary> Get the management lock of a resource or any level below resource. </summary> |
| | 367 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 368 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param> |
| | 369 | | /// <param name="parentResourcePath"> An extra path parameter needed in some services, like SQL Databases. </par |
| | 370 | | /// <param name="resourceType"> The type of the resource. </param> |
| | 371 | | /// <param name="resourceName"> The name of the resource. </param> |
| | 372 | | /// <param name="lockName"> The name of lock. </param> |
| | 373 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 374 | | public virtual async Task<Response<ManagementLockObject>> GetAtResourceLevelAsync(string resourceGroupName, stri |
| | 375 | | { |
| 0 | 376 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.GetAtResourceLevel"); |
| 0 | 377 | | scope0.Start(); |
| | 378 | | try |
| | 379 | | { |
| 0 | 380 | | return await RestClient.GetAtResourceLevelAsync(resourceGroupName, resourceProviderNamespace, parentReso |
| | 381 | | } |
| 0 | 382 | | catch (Exception e) |
| | 383 | | { |
| 0 | 384 | | scope0.Failed(e); |
| 0 | 385 | | throw; |
| | 386 | | } |
| 0 | 387 | | } |
| | 388 | |
|
| | 389 | | /// <summary> Get the management lock of a resource or any level below resource. </summary> |
| | 390 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 391 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param> |
| | 392 | | /// <param name="parentResourcePath"> An extra path parameter needed in some services, like SQL Databases. </par |
| | 393 | | /// <param name="resourceType"> The type of the resource. </param> |
| | 394 | | /// <param name="resourceName"> The name of the resource. </param> |
| | 395 | | /// <param name="lockName"> The name of lock. </param> |
| | 396 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 397 | | public virtual Response<ManagementLockObject> GetAtResourceLevel(string resourceGroupName, string resourceProvid |
| | 398 | | { |
| 0 | 399 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.GetAtResourceLevel"); |
| 0 | 400 | | scope0.Start(); |
| | 401 | | try |
| | 402 | | { |
| 0 | 403 | | return RestClient.GetAtResourceLevel(resourceGroupName, resourceProviderNamespace, parentResourcePath, r |
| | 404 | | } |
| 0 | 405 | | catch (Exception e) |
| | 406 | | { |
| 0 | 407 | | scope0.Failed(e); |
| 0 | 408 | | throw; |
| | 409 | | } |
| 0 | 410 | | } |
| | 411 | |
|
| | 412 | | /// <summary> When you apply a lock at a parent scope, all child resources inherit the same lock. To create mana |
| | 413 | | /// <param name="lockName"> The name of lock. The lock name can be a maximum of 260 characters. It cannot contai |
| | 414 | | /// <param name="parameters"> The management lock parameters. </param> |
| | 415 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 416 | | public virtual async Task<Response<ManagementLockObject>> CreateOrUpdateAtSubscriptionLevelAsync(string lockName |
| | 417 | | { |
| 0 | 418 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.CreateOrUpdateAtSubscriptionLev |
| 0 | 419 | | scope0.Start(); |
| | 420 | | try |
| | 421 | | { |
| 0 | 422 | | return await RestClient.CreateOrUpdateAtSubscriptionLevelAsync(lockName, parameters, cancellationToken). |
| | 423 | | } |
| 0 | 424 | | catch (Exception e) |
| | 425 | | { |
| 0 | 426 | | scope0.Failed(e); |
| 0 | 427 | | throw; |
| | 428 | | } |
| 0 | 429 | | } |
| | 430 | |
|
| | 431 | | /// <summary> When you apply a lock at a parent scope, all child resources inherit the same lock. To create mana |
| | 432 | | /// <param name="lockName"> The name of lock. The lock name can be a maximum of 260 characters. It cannot contai |
| | 433 | | /// <param name="parameters"> The management lock parameters. </param> |
| | 434 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 435 | | public virtual Response<ManagementLockObject> CreateOrUpdateAtSubscriptionLevel(string lockName, ManagementLockO |
| | 436 | | { |
| 0 | 437 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.CreateOrUpdateAtSubscriptionLev |
| 0 | 438 | | scope0.Start(); |
| | 439 | | try |
| | 440 | | { |
| 0 | 441 | | return RestClient.CreateOrUpdateAtSubscriptionLevel(lockName, parameters, cancellationToken); |
| | 442 | | } |
| 0 | 443 | | catch (Exception e) |
| | 444 | | { |
| 0 | 445 | | scope0.Failed(e); |
| 0 | 446 | | throw; |
| | 447 | | } |
| 0 | 448 | | } |
| | 449 | |
|
| | 450 | | /// <summary> To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authori |
| | 451 | | /// <param name="lockName"> The name of lock to delete. </param> |
| | 452 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 453 | | public virtual async Task<Response> DeleteAtSubscriptionLevelAsync(string lockName, CancellationToken cancellati |
| | 454 | | { |
| 0 | 455 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.DeleteAtSubscriptionLevel"); |
| 0 | 456 | | scope0.Start(); |
| | 457 | | try |
| | 458 | | { |
| 0 | 459 | | return await RestClient.DeleteAtSubscriptionLevelAsync(lockName, cancellationToken).ConfigureAwait(false |
| | 460 | | } |
| 0 | 461 | | catch (Exception e) |
| | 462 | | { |
| 0 | 463 | | scope0.Failed(e); |
| 0 | 464 | | throw; |
| | 465 | | } |
| 0 | 466 | | } |
| | 467 | |
|
| | 468 | | /// <summary> To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authori |
| | 469 | | /// <param name="lockName"> The name of lock to delete. </param> |
| | 470 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 471 | | public virtual Response DeleteAtSubscriptionLevel(string lockName, CancellationToken cancellationToken = default |
| | 472 | | { |
| 0 | 473 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.DeleteAtSubscriptionLevel"); |
| 0 | 474 | | scope0.Start(); |
| | 475 | | try |
| | 476 | | { |
| 0 | 477 | | return RestClient.DeleteAtSubscriptionLevel(lockName, cancellationToken); |
| | 478 | | } |
| 0 | 479 | | catch (Exception e) |
| | 480 | | { |
| 0 | 481 | | scope0.Failed(e); |
| 0 | 482 | | throw; |
| | 483 | | } |
| 0 | 484 | | } |
| | 485 | |
|
| | 486 | | /// <summary> Gets a management lock at the subscription level. </summary> |
| | 487 | | /// <param name="lockName"> The name of the lock to get. </param> |
| | 488 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 489 | | public virtual async Task<Response<ManagementLockObject>> GetAtSubscriptionLevelAsync(string lockName, Cancellat |
| | 490 | | { |
| 0 | 491 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.GetAtSubscriptionLevel"); |
| 0 | 492 | | scope0.Start(); |
| | 493 | | try |
| | 494 | | { |
| 0 | 495 | | return await RestClient.GetAtSubscriptionLevelAsync(lockName, cancellationToken).ConfigureAwait(false); |
| | 496 | | } |
| 0 | 497 | | catch (Exception e) |
| | 498 | | { |
| 0 | 499 | | scope0.Failed(e); |
| 0 | 500 | | throw; |
| | 501 | | } |
| 0 | 502 | | } |
| | 503 | |
|
| | 504 | | /// <summary> Gets a management lock at the subscription level. </summary> |
| | 505 | | /// <param name="lockName"> The name of the lock to get. </param> |
| | 506 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 507 | | public virtual Response<ManagementLockObject> GetAtSubscriptionLevel(string lockName, CancellationToken cancella |
| | 508 | | { |
| 0 | 509 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.GetAtSubscriptionLevel"); |
| 0 | 510 | | scope0.Start(); |
| | 511 | | try |
| | 512 | | { |
| 0 | 513 | | return RestClient.GetAtSubscriptionLevel(lockName, cancellationToken); |
| | 514 | | } |
| 0 | 515 | | catch (Exception e) |
| | 516 | | { |
| 0 | 517 | | scope0.Failed(e); |
| 0 | 518 | | throw; |
| | 519 | | } |
| 0 | 520 | | } |
| | 521 | |
|
| | 522 | | /// <summary> Gets all the management locks for a resource group. </summary> |
| | 523 | | /// <param name="resourceGroupName"> The name of the resource group containing the locks to get. </param> |
| | 524 | | /// <param name="filter"> The filter to apply on the operation. </param> |
| | 525 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 526 | | public virtual AsyncPageable<ManagementLockObject> ListAtResourceGroupLevelAsync(string resourceGroupName, strin |
| | 527 | | { |
| 0 | 528 | | if (resourceGroupName == null) |
| | 529 | | { |
| 0 | 530 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 531 | | } |
| | 532 | |
|
| | 533 | | async Task<Page<ManagementLockObject>> FirstPageFunc(int? pageSizeHint) |
| | 534 | | { |
| 0 | 535 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.ListAtResourceGroupLevel"); |
| 0 | 536 | | scope0.Start(); |
| | 537 | | try |
| | 538 | | { |
| 0 | 539 | | var response = await RestClient.ListAtResourceGroupLevelAsync(resourceGroupName, filter, cancellatio |
| 0 | 540 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 541 | | } |
| 0 | 542 | | catch (Exception e) |
| | 543 | | { |
| 0 | 544 | | scope0.Failed(e); |
| 0 | 545 | | throw; |
| | 546 | | } |
| 0 | 547 | | } |
| | 548 | | async Task<Page<ManagementLockObject>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 549 | | { |
| 0 | 550 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.ListAtResourceGroupLevel"); |
| 0 | 551 | | scope0.Start(); |
| | 552 | | try |
| | 553 | | { |
| 0 | 554 | | var response = await RestClient.ListAtResourceGroupLevelNextPageAsync(nextLink, resourceGroupName, f |
| 0 | 555 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 556 | | } |
| 0 | 557 | | catch (Exception e) |
| | 558 | | { |
| 0 | 559 | | scope0.Failed(e); |
| 0 | 560 | | throw; |
| | 561 | | } |
| 0 | 562 | | } |
| 0 | 563 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 564 | | } |
| | 565 | |
|
| | 566 | | /// <summary> Gets all the management locks for a resource group. </summary> |
| | 567 | | /// <param name="resourceGroupName"> The name of the resource group containing the locks to get. </param> |
| | 568 | | /// <param name="filter"> The filter to apply on the operation. </param> |
| | 569 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 570 | | public virtual Pageable<ManagementLockObject> ListAtResourceGroupLevel(string resourceGroupName, string filter = |
| | 571 | | { |
| 0 | 572 | | if (resourceGroupName == null) |
| | 573 | | { |
| 0 | 574 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 575 | | } |
| | 576 | |
|
| | 577 | | Page<ManagementLockObject> FirstPageFunc(int? pageSizeHint) |
| | 578 | | { |
| 0 | 579 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.ListAtResourceGroupLevel"); |
| 0 | 580 | | scope0.Start(); |
| | 581 | | try |
| | 582 | | { |
| 0 | 583 | | var response = RestClient.ListAtResourceGroupLevel(resourceGroupName, filter, cancellationToken); |
| 0 | 584 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 585 | | } |
| 0 | 586 | | catch (Exception e) |
| | 587 | | { |
| 0 | 588 | | scope0.Failed(e); |
| 0 | 589 | | throw; |
| | 590 | | } |
| 0 | 591 | | } |
| | 592 | | Page<ManagementLockObject> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 593 | | { |
| 0 | 594 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.ListAtResourceGroupLevel"); |
| 0 | 595 | | scope0.Start(); |
| | 596 | | try |
| | 597 | | { |
| 0 | 598 | | var response = RestClient.ListAtResourceGroupLevelNextPage(nextLink, resourceGroupName, filter, canc |
| 0 | 599 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 600 | | } |
| 0 | 601 | | catch (Exception e) |
| | 602 | | { |
| 0 | 603 | | scope0.Failed(e); |
| 0 | 604 | | throw; |
| | 605 | | } |
| 0 | 606 | | } |
| 0 | 607 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 608 | | } |
| | 609 | |
|
| | 610 | | /// <summary> Gets all the management locks for a resource or any level below resource. </summary> |
| | 611 | | /// <param name="resourceGroupName"> The name of the resource group containing the locked resource. The name is |
| | 612 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param> |
| | 613 | | /// <param name="parentResourcePath"> The parent resource identity. </param> |
| | 614 | | /// <param name="resourceType"> The resource type of the locked resource. </param> |
| | 615 | | /// <param name="resourceName"> The name of the locked resource. </param> |
| | 616 | | /// <param name="filter"> The filter to apply on the operation. </param> |
| | 617 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 618 | | public virtual AsyncPageable<ManagementLockObject> ListAtResourceLevelAsync(string resourceGroupName, string res |
| | 619 | | { |
| 0 | 620 | | if (resourceGroupName == null) |
| | 621 | | { |
| 0 | 622 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 623 | | } |
| 0 | 624 | | if (resourceProviderNamespace == null) |
| | 625 | | { |
| 0 | 626 | | throw new ArgumentNullException(nameof(resourceProviderNamespace)); |
| | 627 | | } |
| 0 | 628 | | if (parentResourcePath == null) |
| | 629 | | { |
| 0 | 630 | | throw new ArgumentNullException(nameof(parentResourcePath)); |
| | 631 | | } |
| 0 | 632 | | if (resourceType == null) |
| | 633 | | { |
| 0 | 634 | | throw new ArgumentNullException(nameof(resourceType)); |
| | 635 | | } |
| 0 | 636 | | if (resourceName == null) |
| | 637 | | { |
| 0 | 638 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 639 | | } |
| | 640 | |
|
| | 641 | | async Task<Page<ManagementLockObject>> FirstPageFunc(int? pageSizeHint) |
| | 642 | | { |
| 0 | 643 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.ListAtResourceLevel"); |
| 0 | 644 | | scope0.Start(); |
| | 645 | | try |
| | 646 | | { |
| 0 | 647 | | var response = await RestClient.ListAtResourceLevelAsync(resourceGroupName, resourceProviderNamespac |
| 0 | 648 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 649 | | } |
| 0 | 650 | | catch (Exception e) |
| | 651 | | { |
| 0 | 652 | | scope0.Failed(e); |
| 0 | 653 | | throw; |
| | 654 | | } |
| 0 | 655 | | } |
| | 656 | | async Task<Page<ManagementLockObject>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 657 | | { |
| 0 | 658 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.ListAtResourceLevel"); |
| 0 | 659 | | scope0.Start(); |
| | 660 | | try |
| | 661 | | { |
| 0 | 662 | | var response = await RestClient.ListAtResourceLevelNextPageAsync(nextLink, resourceGroupName, resour |
| 0 | 663 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 664 | | } |
| 0 | 665 | | catch (Exception e) |
| | 666 | | { |
| 0 | 667 | | scope0.Failed(e); |
| 0 | 668 | | throw; |
| | 669 | | } |
| 0 | 670 | | } |
| 0 | 671 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 672 | | } |
| | 673 | |
|
| | 674 | | /// <summary> Gets all the management locks for a resource or any level below resource. </summary> |
| | 675 | | /// <param name="resourceGroupName"> The name of the resource group containing the locked resource. The name is |
| | 676 | | /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param> |
| | 677 | | /// <param name="parentResourcePath"> The parent resource identity. </param> |
| | 678 | | /// <param name="resourceType"> The resource type of the locked resource. </param> |
| | 679 | | /// <param name="resourceName"> The name of the locked resource. </param> |
| | 680 | | /// <param name="filter"> The filter to apply on the operation. </param> |
| | 681 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 682 | | public virtual Pageable<ManagementLockObject> ListAtResourceLevel(string resourceGroupName, string resourceProvi |
| | 683 | | { |
| 0 | 684 | | if (resourceGroupName == null) |
| | 685 | | { |
| 0 | 686 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 687 | | } |
| 0 | 688 | | if (resourceProviderNamespace == null) |
| | 689 | | { |
| 0 | 690 | | throw new ArgumentNullException(nameof(resourceProviderNamespace)); |
| | 691 | | } |
| 0 | 692 | | if (parentResourcePath == null) |
| | 693 | | { |
| 0 | 694 | | throw new ArgumentNullException(nameof(parentResourcePath)); |
| | 695 | | } |
| 0 | 696 | | if (resourceType == null) |
| | 697 | | { |
| 0 | 698 | | throw new ArgumentNullException(nameof(resourceType)); |
| | 699 | | } |
| 0 | 700 | | if (resourceName == null) |
| | 701 | | { |
| 0 | 702 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 703 | | } |
| | 704 | |
|
| | 705 | | Page<ManagementLockObject> FirstPageFunc(int? pageSizeHint) |
| | 706 | | { |
| 0 | 707 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.ListAtResourceLevel"); |
| 0 | 708 | | scope0.Start(); |
| | 709 | | try |
| | 710 | | { |
| 0 | 711 | | var response = RestClient.ListAtResourceLevel(resourceGroupName, resourceProviderNamespace, parentRe |
| 0 | 712 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 713 | | } |
| 0 | 714 | | catch (Exception e) |
| | 715 | | { |
| 0 | 716 | | scope0.Failed(e); |
| 0 | 717 | | throw; |
| | 718 | | } |
| 0 | 719 | | } |
| | 720 | | Page<ManagementLockObject> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 721 | | { |
| 0 | 722 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.ListAtResourceLevel"); |
| 0 | 723 | | scope0.Start(); |
| | 724 | | try |
| | 725 | | { |
| 0 | 726 | | var response = RestClient.ListAtResourceLevelNextPage(nextLink, resourceGroupName, resourceProviderN |
| 0 | 727 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 728 | | } |
| 0 | 729 | | catch (Exception e) |
| | 730 | | { |
| 0 | 731 | | scope0.Failed(e); |
| 0 | 732 | | throw; |
| | 733 | | } |
| 0 | 734 | | } |
| 0 | 735 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 736 | | } |
| | 737 | |
|
| | 738 | | /// <summary> Gets all the management locks for a subscription. </summary> |
| | 739 | | /// <param name="filter"> The filter to apply on the operation. </param> |
| | 740 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 741 | | public virtual AsyncPageable<ManagementLockObject> ListAtSubscriptionLevelAsync(string filter = null, Cancellati |
| | 742 | | { |
| | 743 | | async Task<Page<ManagementLockObject>> FirstPageFunc(int? pageSizeHint) |
| | 744 | | { |
| 0 | 745 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.ListAtSubscriptionLevel"); |
| 0 | 746 | | scope0.Start(); |
| | 747 | | try |
| | 748 | | { |
| 0 | 749 | | var response = await RestClient.ListAtSubscriptionLevelAsync(filter, cancellationToken).ConfigureAwa |
| 0 | 750 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 751 | | } |
| 0 | 752 | | catch (Exception e) |
| | 753 | | { |
| 0 | 754 | | scope0.Failed(e); |
| 0 | 755 | | throw; |
| | 756 | | } |
| 0 | 757 | | } |
| | 758 | | async Task<Page<ManagementLockObject>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 759 | | { |
| 0 | 760 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.ListAtSubscriptionLevel"); |
| 0 | 761 | | scope0.Start(); |
| | 762 | | try |
| | 763 | | { |
| 0 | 764 | | var response = await RestClient.ListAtSubscriptionLevelNextPageAsync(nextLink, filter, cancellationT |
| 0 | 765 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 766 | | } |
| 0 | 767 | | catch (Exception e) |
| | 768 | | { |
| 0 | 769 | | scope0.Failed(e); |
| 0 | 770 | | throw; |
| | 771 | | } |
| 0 | 772 | | } |
| 0 | 773 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 774 | | } |
| | 775 | |
|
| | 776 | | /// <summary> Gets all the management locks for a subscription. </summary> |
| | 777 | | /// <param name="filter"> The filter to apply on the operation. </param> |
| | 778 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 779 | | public virtual Pageable<ManagementLockObject> ListAtSubscriptionLevel(string filter = null, CancellationToken ca |
| | 780 | | { |
| | 781 | | Page<ManagementLockObject> FirstPageFunc(int? pageSizeHint) |
| | 782 | | { |
| 0 | 783 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.ListAtSubscriptionLevel"); |
| 0 | 784 | | scope0.Start(); |
| | 785 | | try |
| | 786 | | { |
| 0 | 787 | | var response = RestClient.ListAtSubscriptionLevel(filter, cancellationToken); |
| 0 | 788 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 789 | | } |
| 0 | 790 | | catch (Exception e) |
| | 791 | | { |
| 0 | 792 | | scope0.Failed(e); |
| 0 | 793 | | throw; |
| | 794 | | } |
| 0 | 795 | | } |
| | 796 | | Page<ManagementLockObject> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 797 | | { |
| 0 | 798 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.ListAtSubscriptionLevel"); |
| 0 | 799 | | scope0.Start(); |
| | 800 | | try |
| | 801 | | { |
| 0 | 802 | | var response = RestClient.ListAtSubscriptionLevelNextPage(nextLink, filter, cancellationToken); |
| 0 | 803 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 804 | | } |
| 0 | 805 | | catch (Exception e) |
| | 806 | | { |
| 0 | 807 | | scope0.Failed(e); |
| 0 | 808 | | throw; |
| | 809 | | } |
| 0 | 810 | | } |
| 0 | 811 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 812 | | } |
| | 813 | |
|
| | 814 | | /// <summary> Gets all the management locks for a scope. </summary> |
| | 815 | | /// <param name="scope"> The scope for the lock. When providing a scope for the assignment, use '/subscript |
| | 816 | | /// <param name="filter"> The filter to apply on the operation. </param> |
| | 817 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 818 | | public virtual AsyncPageable<ManagementLockObject> ListByScopeAsync(string scope, string filter = null, Cancella |
| | 819 | | { |
| 0 | 820 | | if (scope == null) |
| | 821 | | { |
| 0 | 822 | | throw new ArgumentNullException(nameof(scope)); |
| | 823 | | } |
| | 824 | |
|
| | 825 | | async Task<Page<ManagementLockObject>> FirstPageFunc(int? pageSizeHint) |
| | 826 | | { |
| 0 | 827 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.ListByScope"); |
| 0 | 828 | | scope0.Start(); |
| | 829 | | try |
| | 830 | | { |
| 0 | 831 | | var response = await RestClient.ListByScopeAsync(scope, filter, cancellationToken).ConfigureAwait(fa |
| 0 | 832 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 833 | | } |
| 0 | 834 | | catch (Exception e) |
| | 835 | | { |
| 0 | 836 | | scope0.Failed(e); |
| 0 | 837 | | throw; |
| | 838 | | } |
| 0 | 839 | | } |
| | 840 | | async Task<Page<ManagementLockObject>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 841 | | { |
| 0 | 842 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.ListByScope"); |
| 0 | 843 | | scope0.Start(); |
| | 844 | | try |
| | 845 | | { |
| 0 | 846 | | var response = await RestClient.ListByScopeNextPageAsync(nextLink, scope, filter, cancellationToken) |
| 0 | 847 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 848 | | } |
| 0 | 849 | | catch (Exception e) |
| | 850 | | { |
| 0 | 851 | | scope0.Failed(e); |
| 0 | 852 | | throw; |
| | 853 | | } |
| 0 | 854 | | } |
| 0 | 855 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 856 | | } |
| | 857 | |
|
| | 858 | | /// <summary> Gets all the management locks for a scope. </summary> |
| | 859 | | /// <param name="scope"> The scope for the lock. When providing a scope for the assignment, use '/subscript |
| | 860 | | /// <param name="filter"> The filter to apply on the operation. </param> |
| | 861 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 862 | | public virtual Pageable<ManagementLockObject> ListByScope(string scope, string filter = null, CancellationToken |
| | 863 | | { |
| 0 | 864 | | if (scope == null) |
| | 865 | | { |
| 0 | 866 | | throw new ArgumentNullException(nameof(scope)); |
| | 867 | | } |
| | 868 | |
|
| | 869 | | Page<ManagementLockObject> FirstPageFunc(int? pageSizeHint) |
| | 870 | | { |
| 0 | 871 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.ListByScope"); |
| 0 | 872 | | scope0.Start(); |
| | 873 | | try |
| | 874 | | { |
| 0 | 875 | | var response = RestClient.ListByScope(scope, filter, cancellationToken); |
| 0 | 876 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 877 | | } |
| 0 | 878 | | catch (Exception e) |
| | 879 | | { |
| 0 | 880 | | scope0.Failed(e); |
| 0 | 881 | | throw; |
| | 882 | | } |
| 0 | 883 | | } |
| | 884 | | Page<ManagementLockObject> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 885 | | { |
| 0 | 886 | | using var scope0 = _clientDiagnostics.CreateScope("ManagementLocksOperations.ListByScope"); |
| 0 | 887 | | scope0.Start(); |
| | 888 | | try |
| | 889 | | { |
| 0 | 890 | | var response = RestClient.ListByScopeNextPage(nextLink, scope, filter, cancellationToken); |
| 0 | 891 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 892 | | } |
| 0 | 893 | | catch (Exception e) |
| | 894 | | { |
| 0 | 895 | | scope0.Failed(e); |
| 0 | 896 | | throw; |
| | 897 | | } |
| 0 | 898 | | } |
| 0 | 899 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 900 | | } |
| | 901 | | } |
| | 902 | | } |