Class SubscriptionPolicyDefinitionCollection
- Namespace
- Azure.ResourceManager.Resources
- Assembly
- Azure.ResourceManager.dll
A class representing a collection of SubscriptionPolicyDefinitionResource and their operations. Each SubscriptionPolicyDefinitionResource in the collection will belong to the same instance of SubscriptionResource. To get a SubscriptionPolicyDefinitionCollection instance call the GetSubscriptionPolicyDefinitions method from an instance of SubscriptionResource.
public class SubscriptionPolicyDefinitionCollection : ArmCollection, IEnumerable<SubscriptionPolicyDefinitionResource>, IEnumerable, IAsyncEnumerable<SubscriptionPolicyDefinitionResource>
- Inheritance
-
SubscriptionPolicyDefinitionCollection
- Implements
-
IAsyncEnumerable<SubscriptionPolicyDefinitionResource>
- Inherited Members
Constructors
SubscriptionPolicyDefinitionCollection()
Initializes a new instance of the SubscriptionPolicyDefinitionCollection class for mocking.
protected SubscriptionPolicyDefinitionCollection()
Methods
CreateOrUpdate(WaitUntil, string, PolicyDefinitionData, CancellationToken)
This operation creates or updates a policy definition in the given subscription with the given name.
- Request Path/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}
- Operation IdPolicyDefinitions_CreateOrUpdate
- Default Api Version2021-06-01
- ResourceSubscriptionPolicyDefinitionResource
public virtual ArmOperation<SubscriptionPolicyDefinitionResource> CreateOrUpdate(WaitUntil waitUntil, string policyDefinitionName, PolicyDefinitionData 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.
policyDefinitionName
stringThe name of the policy definition to create.
data
PolicyDefinitionDataThe policy definition properties.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentException
policyDefinitionName
is an empty string, and was expected to be non-empty.- ArgumentNullException
policyDefinitionName
ordata
is null.
CreateOrUpdateAsync(WaitUntil, string, PolicyDefinitionData, CancellationToken)
This operation creates or updates a policy definition in the given subscription with the given name.
- Request Path/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}
- Operation IdPolicyDefinitions_CreateOrUpdate
- Default Api Version2021-06-01
- ResourceSubscriptionPolicyDefinitionResource
public virtual Task<ArmOperation<SubscriptionPolicyDefinitionResource>> CreateOrUpdateAsync(WaitUntil waitUntil, string policyDefinitionName, PolicyDefinitionData 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.
policyDefinitionName
stringThe name of the policy definition to create.
data
PolicyDefinitionDataThe policy definition properties.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentException
policyDefinitionName
is an empty string, and was expected to be non-empty.- ArgumentNullException
policyDefinitionName
ordata
is null.
Exists(string, CancellationToken)
Checks to see if the resource exists in azure.
- Request Path/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}
- Operation IdPolicyDefinitions_Get
- Default Api Version2021-06-01
- ResourceSubscriptionPolicyDefinitionResource
public virtual Response<bool> Exists(string policyDefinitionName, CancellationToken cancellationToken = default)
Parameters
policyDefinitionName
stringThe name of the policy definition to get.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Response<bool>
Exceptions
- ArgumentException
policyDefinitionName
is an empty string, and was expected to be non-empty.- ArgumentNullException
policyDefinitionName
is null.
ExistsAsync(string, CancellationToken)
Checks to see if the resource exists in azure.
- Request Path/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}
- Operation IdPolicyDefinitions_Get
- Default Api Version2021-06-01
- ResourceSubscriptionPolicyDefinitionResource
public virtual Task<Response<bool>> ExistsAsync(string policyDefinitionName, CancellationToken cancellationToken = default)
Parameters
policyDefinitionName
stringThe name of the policy definition to get.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentException
policyDefinitionName
is an empty string, and was expected to be non-empty.- ArgumentNullException
policyDefinitionName
is null.
Get(string, CancellationToken)
This operation retrieves the policy definition in the given subscription with the given name.
- Request Path/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}
- Operation IdPolicyDefinitions_Get
- Default Api Version2021-06-01
- ResourceSubscriptionPolicyDefinitionResource
public virtual Response<SubscriptionPolicyDefinitionResource> Get(string policyDefinitionName, CancellationToken cancellationToken = default)
Parameters
policyDefinitionName
stringThe name of the policy definition to get.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Response<SubscriptionPolicyDefinitionResource>
Exceptions
- ArgumentException
policyDefinitionName
is an empty string, and was expected to be non-empty.- ArgumentNullException
policyDefinitionName
is null.
GetAll(string, int?, CancellationToken)
This operation retrieves a list of all the policy definitions in a given subscription that match the optional given $filter. Valid values for $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not provided, the unfiltered list includes all policy definitions associated with the subscription, including those that apply directly or from management groups that contain the given subscription. If $filter=atExactScope() is provided, the returned list only includes all policy definitions that at the given subscription. If $filter='policyType -eq {value}' is provided, the returned list only includes all policy definitions whose type match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is provided, the returned list only includes all policy definitions whose category match the {value}.
- Request Path/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions
- Operation IdPolicyDefinitions_List
- Default Api Version2021-06-01
- ResourceSubscriptionPolicyDefinitionResource
public virtual Pageable<SubscriptionPolicyDefinitionResource> GetAll(string filter = null, int? top = null, CancellationToken cancellationToken = default)
Parameters
filter
stringThe filter to apply on the operation. Valid values for $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list only includes all policy definitions that at the given scope. If $filter='policyType -eq {value}' is provided, the returned list only includes all policy definitions whose type match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is provided, the returned list only includes all policy definitions whose category match the {value}.
top
int?Maximum number of records to return. When the $top filter is not provided, it will return 500 records.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Pageable<SubscriptionPolicyDefinitionResource>
A collection of SubscriptionPolicyDefinitionResource that may take multiple service requests to iterate over.
GetAllAsync(string, int?, CancellationToken)
This operation retrieves a list of all the policy definitions in a given subscription that match the optional given $filter. Valid values for $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not provided, the unfiltered list includes all policy definitions associated with the subscription, including those that apply directly or from management groups that contain the given subscription. If $filter=atExactScope() is provided, the returned list only includes all policy definitions that at the given subscription. If $filter='policyType -eq {value}' is provided, the returned list only includes all policy definitions whose type match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is provided, the returned list only includes all policy definitions whose category match the {value}.
- Request Path/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions
- Operation IdPolicyDefinitions_List
- Default Api Version2021-06-01
- ResourceSubscriptionPolicyDefinitionResource
public virtual AsyncPageable<SubscriptionPolicyDefinitionResource> GetAllAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default)
Parameters
filter
stringThe filter to apply on the operation. Valid values for $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list only includes all policy definitions that at the given scope. If $filter='policyType -eq {value}' is provided, the returned list only includes all policy definitions whose type match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is provided, the returned list only includes all policy definitions whose category match the {value}.
top
int?Maximum number of records to return. When the $top filter is not provided, it will return 500 records.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- AsyncPageable<SubscriptionPolicyDefinitionResource>
An async collection of SubscriptionPolicyDefinitionResource that may take multiple service requests to iterate over.
GetAsync(string, CancellationToken)
This operation retrieves the policy definition in the given subscription with the given name.
- Request Path/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}
- Operation IdPolicyDefinitions_Get
- Default Api Version2021-06-01
- ResourceSubscriptionPolicyDefinitionResource
public virtual Task<Response<SubscriptionPolicyDefinitionResource>> GetAsync(string policyDefinitionName, CancellationToken cancellationToken = default)
Parameters
policyDefinitionName
stringThe name of the policy definition to get.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Task<Response<SubscriptionPolicyDefinitionResource>>
Exceptions
- ArgumentException
policyDefinitionName
is an empty string, and was expected to be non-empty.- ArgumentNullException
policyDefinitionName
is null.
GetIfExists(string, CancellationToken)
Tries to get details for this resource from the service.
- Request Path/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}
- Operation IdPolicyDefinitions_Get
- Default Api Version2021-06-01
- ResourceSubscriptionPolicyDefinitionResource
public virtual NullableResponse<SubscriptionPolicyDefinitionResource> GetIfExists(string policyDefinitionName, CancellationToken cancellationToken = default)
Parameters
policyDefinitionName
stringThe name of the policy definition to get.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- NullableResponse<SubscriptionPolicyDefinitionResource>
Exceptions
- ArgumentException
policyDefinitionName
is an empty string, and was expected to be non-empty.- ArgumentNullException
policyDefinitionName
is null.
GetIfExistsAsync(string, CancellationToken)
Tries to get details for this resource from the service.
- Request Path/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}
- Operation IdPolicyDefinitions_Get
- Default Api Version2021-06-01
- ResourceSubscriptionPolicyDefinitionResource
public virtual Task<NullableResponse<SubscriptionPolicyDefinitionResource>> GetIfExistsAsync(string policyDefinitionName, CancellationToken cancellationToken = default)
Parameters
policyDefinitionName
stringThe name of the policy definition to get.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Task<NullableResponse<SubscriptionPolicyDefinitionResource>>
Exceptions
- ArgumentException
policyDefinitionName
is an empty string, and was expected to be non-empty.- ArgumentNullException
policyDefinitionName
is null.