共用方式為


PolicyDefinitionsOperations Class

Warning

DO NOT instantiate this class directly.

Instead, you should access the following operations through

PolicyClient's

<xref:policy_definitions> attribute.

Inheritance
builtins.object
PolicyDefinitionsOperations

Constructor

PolicyDefinitionsOperations(*args, **kwargs)

Methods

create_or_update

Creates or updates a policy definition in a subscription.

This operation creates or updates a policy definition in the given subscription with the given name.

create_or_update_at_management_group

Creates or updates a policy definition in a management group.

This operation creates or updates a policy definition in the given management group with the given name.

delete

Deletes a policy definition in a subscription.

This operation deletes the policy definition in the given subscription with the given name.

delete_at_management_group

Deletes a policy definition in a management group.

This operation deletes the policy definition in the given management group with the given name.

get

Retrieves a policy definition in a subscription.

This operation retrieves the policy definition in the given subscription with the given name.

get_at_management_group

Retrieve a policy definition in a management group.

This operation retrieves the policy definition in the given management group with the given name.

get_built_in

Retrieves a built-in policy definition.

This operation retrieves the built-in policy definition with the given name.

list

Retrieves policy definitions in a subscription.

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}.

list_built_in

Retrieve built-in policy definitions.

This operation retrieves a list of all the built-in policy definitions that match the optional given $filter. If $filter='policyType -eq {value}' is provided, the returned list only includes all built-in 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 built-in policy definitions whose category match the {value}.

list_by_management_group

Retrieve policy definitions in a management group.

This operation retrieves a list of all the policy definitions in a given management group 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 management group, including those that apply directly or from management groups that contain the given management group. If $filter=atExactScope() is provided, the returned list only includes all policy definitions that at the given management group. 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}.

create_or_update

Creates or updates a policy definition in a subscription.

This operation creates or updates a policy definition in the given subscription with the given name.

async create_or_update(policy_definition_name: str, parameters: _models.PolicyDefinition, *, content_type: str = 'application/json', **kwargs: Any) -> _models.PolicyDefinition

Parameters

Name Description
policy_definition_name
Required
str

The name of the policy definition to create. Required.

parameters
Required

The policy definition properties. Is either a PolicyDefinition type or a IO[bytes] type. Required.

Returns

Type Description

PolicyDefinition or the result of cls(response)

Exceptions

Type Description

create_or_update_at_management_group

Creates or updates a policy definition in a management group.

This operation creates or updates a policy definition in the given management group with the given name.

async create_or_update_at_management_group(management_group_id: str, policy_definition_name: str, parameters: _models.PolicyDefinition, *, content_type: str = 'application/json', **kwargs: Any) -> _models.PolicyDefinition

Parameters

Name Description
management_group_id
Required
str

The ID of the management group. Required.

policy_definition_name
Required
str

The name of the policy definition to create. Required.

parameters
Required

The policy definition properties. Is either a PolicyDefinition type or a IO[bytes] type. Required.

Returns

Type Description

PolicyDefinition or the result of cls(response)

Exceptions

Type Description

delete

Deletes a policy definition in a subscription.

This operation deletes the policy definition in the given subscription with the given name.

async delete(policy_definition_name: str, **kwargs: Any) -> None

Parameters

Name Description
policy_definition_name
Required
str

The name of the policy definition to delete. Required.

Returns

Type Description

None or the result of cls(response)

Exceptions

Type Description

delete_at_management_group

Deletes a policy definition in a management group.

This operation deletes the policy definition in the given management group with the given name.

async delete_at_management_group(management_group_id: str, policy_definition_name: str, **kwargs: Any) -> None

Parameters

Name Description
management_group_id
Required
str

The ID of the management group. Required.

policy_definition_name
Required
str

The name of the policy definition to delete. Required.

Returns

Type Description

None or the result of cls(response)

Exceptions

Type Description

get

Retrieves a policy definition in a subscription.

This operation retrieves the policy definition in the given subscription with the given name.

async get(policy_definition_name: str, **kwargs: Any) -> PolicyDefinition

Parameters

Name Description
policy_definition_name
Required
str

The name of the policy definition to get. Required.

Returns

Type Description

PolicyDefinition or the result of cls(response)

Exceptions

Type Description

get_at_management_group

Retrieve a policy definition in a management group.

This operation retrieves the policy definition in the given management group with the given name.

async get_at_management_group(management_group_id: str, policy_definition_name: str, **kwargs: Any) -> PolicyDefinition

Parameters

Name Description
management_group_id
Required
str

The ID of the management group. Required.

policy_definition_name
Required
str

The name of the policy definition to get. Required.

Returns

Type Description

PolicyDefinition or the result of cls(response)

Exceptions

Type Description

get_built_in

Retrieves a built-in policy definition.

This operation retrieves the built-in policy definition with the given name.

async get_built_in(policy_definition_name: str, **kwargs: Any) -> PolicyDefinition

Parameters

Name Description
policy_definition_name
Required
str

The name of the built-in policy definition to get. Required.

Returns

Type Description

PolicyDefinition or the result of cls(response)

Exceptions

Type Description

list

Retrieves policy definitions in a subscription.

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}.

list(filter: str | None = None, top: int | None = None, **kwargs: Any) -> AsyncIterable[PolicyDefinition]

Parameters

Name Description
filter
Required
str

The 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}. Default value is None.

top
Required
int

Maximum number of records to return. When the $top filter is not provided, it will return 500 records. Default value is None.

Returns

Type Description

An iterator like instance of either PolicyDefinition or the result of cls(response)

Exceptions

Type Description

list_built_in

Retrieve built-in policy definitions.

This operation retrieves a list of all the built-in policy definitions that match the optional given $filter. If $filter='policyType -eq {value}' is provided, the returned list only includes all built-in 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 built-in policy definitions whose category match the {value}.

list_built_in(filter: str | None = None, top: int | None = None, **kwargs: Any) -> AsyncIterable[PolicyDefinition]

Parameters

Name Description
filter
Required
str

The 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}. Default value is None.

top
Required
int

Maximum number of records to return. When the $top filter is not provided, it will return 500 records. Default value is None.

Returns

Type Description

An iterator like instance of either PolicyDefinition or the result of cls(response)

Exceptions

Type Description

list_by_management_group

Retrieve policy definitions in a management group.

This operation retrieves a list of all the policy definitions in a given management group 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 management group, including those that apply directly or from management groups that contain the given management group. If $filter=atExactScope() is provided, the returned list only includes all policy definitions that at the given management group. 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}.

list_by_management_group(management_group_id: str, filter: str | None = None, top: int | None = None, **kwargs: Any) -> AsyncIterable[PolicyDefinition]

Parameters

Name Description
management_group_id
Required
str

The ID of the management group. Required.

filter
Required
str

The 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}. Default value is None.

top
Required
int

Maximum number of records to return. When the $top filter is not provided, it will return 500 records. Default value is None.

Returns

Type Description

An iterator like instance of either PolicyDefinition or the result of cls(response)

Exceptions

Type Description

Attributes

models

models = <module 'azure.mgmt.resource.policy.v2023_04_01.models' from 'C:\\hostedtoolcache\\windows\\Python\\3.11.9\\x64\\Lib\\site-packages\\azure\\mgmt\\resource\\policy\\v2023_04_01\\models\\__init__.py'>