Class PolicyAssignmentResource
- Namespace
- Azure.ResourceManager.Resources
- Assembly
- Azure.ResourceManager.dll
A Class representing a PolicyAssignment along with the instance operations that can be performed on it. If you have a Azure.Core.ResourceIdentifier you can construct a PolicyAssignmentResource from an instance of ArmClient using the GetPolicyAssignmentResource method. Otherwise you can get one from its parent resource ArmResource using the GetPolicyAssignment method.
public class PolicyAssignmentResource : ArmResource, IJsonModel<PolicyAssignmentData>, IPersistableModel<PolicyAssignmentData>
- Inheritance
-
PolicyAssignmentResource
- Implements
-
IJsonModel<PolicyAssignmentData>IPersistableModel<PolicyAssignmentData>
- Inherited Members
Constructors
PolicyAssignmentResource()
Initializes a new instance of the PolicyAssignmentResource class for mocking.
protected PolicyAssignmentResource()
Fields
ResourceType
Gets the resource type for the operations.
public static readonly ResourceType ResourceType
Field Value
- ResourceType
Properties
Data
Gets the data representing this Feature.
public virtual PolicyAssignmentData Data { get; }
Property Value
Exceptions
- InvalidOperationException
Throws if there is no data loaded in the current instance.
HasData
Gets whether or not the current instance has data.
public virtual bool HasData { get; }
Property Value
Methods
CreateResourceIdentifier(string, string)
Generate the resource identifier of a PolicyAssignmentResource instance.
public static ResourceIdentifier CreateResourceIdentifier(string scope, string policyAssignmentName)
Parameters
Returns
- ResourceIdentifier
Delete(WaitUntil, CancellationToken)
This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
- Request Path/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
- Operation IdPolicyAssignments_Delete
- Default Api Version2022-06-01
- ResourcePolicyAssignmentResource
public virtual ArmOperation<PolicyAssignmentResource> Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default)
Parameters
waitUntil
WaitUntilAzure.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.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
DeleteAsync(WaitUntil, CancellationToken)
This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
- Request Path/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
- Operation IdPolicyAssignments_Delete
- Default Api Version2022-06-01
- ResourcePolicyAssignmentResource
public virtual Task<ArmOperation<PolicyAssignmentResource>> DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default)
Parameters
waitUntil
WaitUntilAzure.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.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
Get(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> Get(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Response<PolicyAssignmentResource>
GetAsync(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>> GetAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Task<Response<PolicyAssignmentResource>>
Update(PolicyAssignmentPatch, CancellationToken)
This operation updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group.
- Request Path/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
- Operation IdPolicyAssignments_Update
- Default Api Version2022-06-01
- ResourcePolicyAssignmentResource
public virtual Response<PolicyAssignmentResource> Update(PolicyAssignmentPatch patch, CancellationToken cancellationToken = default)
Parameters
patch
PolicyAssignmentPatchParameters for policy assignment patch request.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Response<PolicyAssignmentResource>
Exceptions
- ArgumentNullException
patch
is null.
Update(WaitUntil, PolicyAssignmentData, CancellationToken)
This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group.
- Request Path/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
- Operation IdPolicyAssignments_Create
public virtual ArmOperation<PolicyAssignmentResource> Update(WaitUntil waitUntil, PolicyAssignmentData data, CancellationToken cancellationToken = default)
Parameters
waitUntil
WaitUntilAzure.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.
data
PolicyAssignmentDataParameters for the policy assignment.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentNullException
data
is null.
UpdateAsync(PolicyAssignmentPatch, CancellationToken)
This operation updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group.
- Request Path/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
- Operation IdPolicyAssignments_Update
- Default Api Version2022-06-01
- ResourcePolicyAssignmentResource
public virtual Task<Response<PolicyAssignmentResource>> UpdateAsync(PolicyAssignmentPatch patch, CancellationToken cancellationToken = default)
Parameters
patch
PolicyAssignmentPatchParameters for policy assignment patch request.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Task<Response<PolicyAssignmentResource>>
Exceptions
- ArgumentNullException
patch
is null.
UpdateAsync(WaitUntil, PolicyAssignmentData, CancellationToken)
This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group.
- Request Path/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
- Operation IdPolicyAssignments_Create
public virtual Task<ArmOperation<PolicyAssignmentResource>> UpdateAsync(WaitUntil waitUntil, PolicyAssignmentData data, CancellationToken cancellationToken = default)
Parameters
waitUntil
WaitUntilAzure.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.
data
PolicyAssignmentDataParameters for the policy assignment.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentNullException
data
is null.