Table of Contents

Class ArmResource

Namespace
Azure.ResourceManager
Assembly
Azure.ResourceManager.dll

A class representing the operations that can be performed over a specific resource.

public abstract class ArmResource
Inheritance
ArmResource
Derived
Inherited Members

Constructors

ArmResource()

Initializes a new instance of the ArmResource class for mocking.

protected ArmResource()

ArmResource(ArmClient, ResourceIdentifier)

Initializes a new instance of the ArmResource class.

protected ArmResource(ArmClient client, ResourceIdentifier id)

Parameters

client ArmClient

The ArmClient this resource client should be created from.

id ResourceIdentifier

The identifier of the resource that is the target of operations.

Properties

Client

Gets the ArmClient this resource client was created from.

protected virtual ArmClient Client { get; }

Property Value

ArmClient

Diagnostics

Gets the diagnostic options for this resource client.

protected DiagnosticsOptions Diagnostics { get; }

Property Value

DiagnosticsOptions

Endpoint

Gets the base uri for this resource client.

protected Uri Endpoint { get; }

Property Value

Uri

Id

Gets the resource identifier.

public virtual ResourceIdentifier Id { get; }

Property Value

ResourceIdentifier

Pipeline

Gets the pipeline for this resource client.

protected HttpPipeline Pipeline { get; }

Property Value

HttpPipeline

Methods

CanUseTagResource(CancellationToken)

Checks to see if the TagResource API is deployed in the current environment.

protected virtual bool CanUseTagResource(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

bool

CanUseTagResourceAsync(CancellationToken)

Checks to see if the TagResource API is deployed in the current environment.

protected virtual Task<bool> CanUseTagResourceAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<bool>

GetAvailableLocations(CancellationToken)

Lists all available geo-locations.

public virtual Response<IEnumerable<AzureLocation>> GetAvailableLocations(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to allow the caller to cancel the call to the service. The default value is None.

Returns

Response<IEnumerable<AzureLocation>>

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

GetAvailableLocationsAsync(CancellationToken)

Lists all available geo-locations.

public virtual Task<Response<IEnumerable<AzureLocation>>> GetAvailableLocationsAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to allow the caller to cancel the call to the service. The default value is None.

Returns

Task<Response<IEnumerable<AzureLocation>>>

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

GetManagementLock(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> GetManagementLock(string lockName, CancellationToken cancellationToken = default)

Parameters

lockName string

The name of lock.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Response<ManagementLockResource>

Exceptions

ArgumentNullException

lockName is null.

ArgumentException

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

GetManagementLockAsync(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>> GetManagementLockAsync(string lockName, CancellationToken cancellationToken = default)

Parameters

lockName string

The name of lock.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<Response<ManagementLockResource>>

Exceptions

ArgumentNullException

lockName is null.

ArgumentException

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

GetManagementLocks()

Gets a collection of ManagementLockResources in the ArmResource.

public virtual ManagementLockCollection GetManagementLocks()

Returns

ManagementLockCollection

An object representing collection of ManagementLockResources and their operations over a ManagementLockResource.

GetPolicyAssignment(string, CancellationToken)

This operation retrieves a single policy assignment, given its name and the scope it was created at.

  • Request Path/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
  • Operation IdPolicyAssignments_Get
  • Default Api Version2022-06-01
  • ResourcePolicyAssignmentResource
public virtual Response<PolicyAssignmentResource> GetPolicyAssignment(string policyAssignmentName, CancellationToken cancellationToken = default)

Parameters

policyAssignmentName string

The name of the policy assignment to get.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Response<PolicyAssignmentResource>

Exceptions

ArgumentNullException

policyAssignmentName is null.

ArgumentException

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

GetPolicyAssignmentAsync(string, CancellationToken)

This operation retrieves a single policy assignment, given its name and the scope it was created at.

  • Request Path/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
  • Operation IdPolicyAssignments_Get
  • Default Api Version2022-06-01
  • ResourcePolicyAssignmentResource
public virtual Task<Response<PolicyAssignmentResource>> GetPolicyAssignmentAsync(string policyAssignmentName, CancellationToken cancellationToken = default)

Parameters

policyAssignmentName string

The name of the policy assignment to get.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<Response<PolicyAssignmentResource>>

Exceptions

ArgumentNullException

policyAssignmentName is null.

ArgumentException

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

GetPolicyAssignments()

Gets a collection of PolicyAssignmentResources in the ArmResource.

public virtual PolicyAssignmentCollection GetPolicyAssignments()

Returns

PolicyAssignmentCollection

An object representing collection of PolicyAssignmentResources and their operations over a PolicyAssignmentResource.

GetTagResource()

Gets an object representing a TagResource along with the instance operations that can be performed on it in the ArmResource.

public virtual TagResource GetTagResource()

Returns

TagResource

Returns a TagResource object.

TryGetApiVersion(ResourceType, out string)

Gets the api version override if it has been set for the current client options.

protected virtual bool TryGetApiVersion(ResourceType resourceType, out string apiVersion)

Parameters

resourceType ResourceType

The resource type to get the version for.

apiVersion string

The api version to variable to set.

Returns

bool