Table of Contents

Class ManagementLockCollection

Namespace
Azure.ResourceManager.Resources
Assembly
Azure.ResourceManager.dll

A class representing a collection of ManagementLockResource and their operations. Each ManagementLockResource in the collection will belong to the same instance of ArmResource. To get a ManagementLockCollection instance call the GetManagementLocks method from an instance of ArmResource.

public class ManagementLockCollection : ArmCollection, IEnumerable<ManagementLockResource>, IEnumerable, IAsyncEnumerable<ManagementLockResource>
Inheritance
ManagementLockCollection
Implements
IAsyncEnumerable<ManagementLockResource>
Inherited Members

Constructors

ManagementLockCollection()

Initializes a new instance of the ManagementLockCollection class for mocking.

protected ManagementLockCollection()

Methods

CreateOrUpdate(WaitUntil, string, ManagementLockData, CancellationToken)

Create or update a management lock by scope.

  • Request Path/{scope}/providers/Microsoft.Authorization/locks/{lockName}
  • Operation IdManagementLocks_CreateOrUpdateByScope
  • Default Api Version2020-05-01
  • ResourceManagementLockResource
public virtual ArmOperation<ManagementLockResource> CreateOrUpdate(WaitUntil waitUntil, string lockName, ManagementLockData data, CancellationToken cancellationToken = default)

Parameters

waitUntil WaitUntil

Azure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.

lockName string

The name of lock.

data ManagementLockData

Create or update management lock parameters.

cancellationToken CancellationToken

The cancellation token to use.

Returns

ArmOperation<ManagementLockResource>

Exceptions

ArgumentException

lockName is an empty string, and was expected to be non-empty.

ArgumentNullException

lockName or data is null.

CreateOrUpdateAsync(WaitUntil, string, ManagementLockData, CancellationToken)

Create or update a management lock by scope.

  • Request Path/{scope}/providers/Microsoft.Authorization/locks/{lockName}
  • Operation IdManagementLocks_CreateOrUpdateByScope
  • Default Api Version2020-05-01
  • ResourceManagementLockResource
public virtual Task<ArmOperation<ManagementLockResource>> CreateOrUpdateAsync(WaitUntil waitUntil, string lockName, ManagementLockData data, CancellationToken cancellationToken = default)

Parameters

waitUntil WaitUntil

Azure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.

lockName string

The name of lock.

data ManagementLockData

Create or update management lock parameters.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<ArmOperation<ManagementLockResource>>

Exceptions

ArgumentException

lockName is an empty string, and was expected to be non-empty.

ArgumentNullException

lockName or data is null.

Exists(string, CancellationToken)

Checks to see if the resource exists in azure.

  • Request Path/{scope}/providers/Microsoft.Authorization/locks/{lockName}
  • Operation IdManagementLocks_GetByScope
  • Default Api Version2020-05-01
  • ResourceManagementLockResource
public virtual Response<bool> Exists(string lockName, CancellationToken cancellationToken = default)

Parameters

lockName string

The name of lock.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Response<bool>

Exceptions

ArgumentException

lockName is an empty string, and was expected to be non-empty.

ArgumentNullException

lockName is null.

ExistsAsync(string, CancellationToken)

Checks to see if the resource exists in azure.

  • Request Path/{scope}/providers/Microsoft.Authorization/locks/{lockName}
  • Operation IdManagementLocks_GetByScope
  • Default Api Version2020-05-01
  • ResourceManagementLockResource
public virtual Task<Response<bool>> ExistsAsync(string lockName, CancellationToken cancellationToken = default)

Parameters

lockName string

The name of lock.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<Response<bool>>

Exceptions

ArgumentException

lockName is an empty string, and was expected to be non-empty.

ArgumentNullException

lockName is null.

Get(string, CancellationToken)

Get a management lock by scope.

  • Request Path/{scope}/providers/Microsoft.Authorization/locks/{lockName}
  • Operation IdManagementLocks_GetByScope
  • Default Api Version2020-05-01
  • ResourceManagementLockResource
public virtual Response<ManagementLockResource> Get(string lockName, CancellationToken cancellationToken = default)

Parameters

lockName string

The name of lock.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Response<ManagementLockResource>

Exceptions

ArgumentException

lockName is an empty string, and was expected to be non-empty.

ArgumentNullException

lockName is null.

GetAll(string, CancellationToken)

Gets all the management locks for a scope.

  • Request Path/{scope}/providers/Microsoft.Authorization/locks
  • Operation IdManagementLocks_ListByScope
  • Default Api Version2020-05-01
  • ResourceManagementLockResource
public virtual Pageable<ManagementLockResource> GetAll(string filter = null, CancellationToken cancellationToken = default)

Parameters

filter string

The filter to apply on the operation.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Pageable<ManagementLockResource>

A collection of ManagementLockResource that may take multiple service requests to iterate over.

GetAllAsync(string, CancellationToken)

Gets all the management locks for a scope.

  • Request Path/{scope}/providers/Microsoft.Authorization/locks
  • Operation IdManagementLocks_ListByScope
  • Default Api Version2020-05-01
  • ResourceManagementLockResource
public virtual AsyncPageable<ManagementLockResource> GetAllAsync(string filter = null, CancellationToken cancellationToken = default)

Parameters

filter string

The filter to apply on the operation.

cancellationToken CancellationToken

The cancellation token to use.

Returns

AsyncPageable<ManagementLockResource>

An async collection of ManagementLockResource that may take multiple service requests to iterate over.

GetAsync(string, CancellationToken)

Get a management lock by scope.

  • Request Path/{scope}/providers/Microsoft.Authorization/locks/{lockName}
  • Operation IdManagementLocks_GetByScope
  • Default Api Version2020-05-01
  • ResourceManagementLockResource
public virtual Task<Response<ManagementLockResource>> GetAsync(string lockName, CancellationToken cancellationToken = default)

Parameters

lockName string

The name of lock.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<Response<ManagementLockResource>>

Exceptions

ArgumentException

lockName is an empty string, and was expected to be non-empty.

ArgumentNullException

lockName is null.

GetIfExists(string, CancellationToken)

Tries to get details for this resource from the service.

  • Request Path/{scope}/providers/Microsoft.Authorization/locks/{lockName}
  • Operation IdManagementLocks_GetByScope
  • Default Api Version2020-05-01
  • ResourceManagementLockResource
public virtual NullableResponse<ManagementLockResource> GetIfExists(string lockName, CancellationToken cancellationToken = default)

Parameters

lockName string

The name of lock.

cancellationToken CancellationToken

The cancellation token to use.

Returns

NullableResponse<ManagementLockResource>

Exceptions

ArgumentException

lockName is an empty string, and was expected to be non-empty.

ArgumentNullException

lockName is null.

GetIfExistsAsync(string, CancellationToken)

Tries to get details for this resource from the service.

  • Request Path/{scope}/providers/Microsoft.Authorization/locks/{lockName}
  • Operation IdManagementLocks_GetByScope
  • Default Api Version2020-05-01
  • ResourceManagementLockResource
public virtual Task<NullableResponse<ManagementLockResource>> GetIfExistsAsync(string lockName, CancellationToken cancellationToken = default)

Parameters

lockName string

The name of lock.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<NullableResponse<ManagementLockResource>>

Exceptions

ArgumentException

lockName is an empty string, and was expected to be non-empty.

ArgumentNullException

lockName is null.