azure.mgmt.resource.policy.v2017_06_01_preview.operations module
- class azure.mgmt.resource.policy.v2017_06_01_preview.operations.PolicyAssignmentsOperations(*args, **kwargs)[source]
Bases:
object
Warning
DO NOT instantiate this class directly.
Instead, you should access the following operations through
PolicyClient
’spolicy_assignments
attribute.- create(scope: str, policy_assignment_name: str, parameters: _models.PolicyAssignment, *, content_type: str = 'application/json', **kwargs: Any) _models.PolicyAssignment [source]
- create(scope: str, policy_assignment_name: str, parameters: IO[bytes], *, content_type: str = 'application/json', **kwargs: Any) _models.PolicyAssignment
Creates a policy assignment.
Policy assignments are inherited by child resources. For example, when you apply a policy to a resource group that policy is assigned to all resources in the group.
- Parameters:
scope (str) – The scope of the policy assignment. Required.
policy_assignment_name (str) – The name of the policy assignment. Required.
parameters (PolicyAssignment or IO[bytes]) – Parameters for the policy assignment. Is either a PolicyAssignment type or a IO[bytes] type. Required.
- Returns:
PolicyAssignment or the result of cls(response)
- Return type:
- Raises:
- create_by_id(policy_assignment_id: str, parameters: _models.PolicyAssignment, *, content_type: str = 'application/json', **kwargs: Any) _models.PolicyAssignment [source]
- create_by_id(policy_assignment_id: str, parameters: IO[bytes], *, content_type: str = 'application/json', **kwargs: Any) _models.PolicyAssignment
Creates a policy assignment by ID.
Policy assignments are inherited by child resources. For example, when you apply a policy to a resource group that policy is assigned to all resources in the group. When providing a scope for the assignment, use ‘/subscriptions/{subscription-id}/’ for subscriptions, ‘/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}’ for resource groups, and ‘/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}’ for resources.
- Parameters:
policy_assignment_id (str) – The ID of the policy assignment to create. Use the format ‘/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}’. Required.
parameters (PolicyAssignment or IO[bytes]) – Parameters for policy assignment. Is either a PolicyAssignment type or a IO[bytes] type. Required.
- Returns:
PolicyAssignment or the result of cls(response)
- Return type:
- Raises:
- delete(scope: str, policy_assignment_name: str, **kwargs: Any) PolicyAssignment | None [source]
Deletes a policy assignment.
- Parameters:
- Returns:
PolicyAssignment or None or the result of cls(response)
- Return type:
PolicyAssignment or None
- Raises:
- delete_by_id(policy_assignment_id: str, **kwargs: Any) PolicyAssignment [source]
Deletes a policy assignment by ID.
When providing a scope for the assignment, use ‘/subscriptions/{subscription-id}/’ for subscriptions, ‘/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}’ for resource groups, and ‘/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}’ for resources.
- Parameters:
policy_assignment_id (str) – The ID of the policy assignment to delete. Use the format ‘/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}’. Required.
- Returns:
PolicyAssignment or the result of cls(response)
- Return type:
- Raises:
- get(scope: str, policy_assignment_name: str, **kwargs: Any) PolicyAssignment [source]
Gets a policy assignment.
- Parameters:
- Returns:
PolicyAssignment or the result of cls(response)
- Return type:
- Raises:
- get_by_id(policy_assignment_id: str, **kwargs: Any) PolicyAssignment [source]
Gets a policy assignment by ID.
When providing a scope for the assignment, use ‘/subscriptions/{subscription-id}/’ for subscriptions, ‘/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}’ for resource groups, and ‘/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}’ for resources.
- Parameters:
policy_assignment_id (str) – The ID of the policy assignment to get. Use the format ‘/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}’. Required.
- Returns:
PolicyAssignment or the result of cls(response)
- Return type:
- Raises:
- list(filter: str | None = None, **kwargs: Any) Iterable[PolicyAssignment] [source]
Gets all the policy assignments for a subscription.
- Parameters:
filter (str) – The filter to apply on the operation. Default value is None.
- Returns:
An iterator like instance of either PolicyAssignment or the result of cls(response)
- Return type:
- Raises:
- list_for_resource(resource_group_name: str, resource_provider_namespace: str, parent_resource_path: str, resource_type: str, resource_name: str, filter: str | None = None, **kwargs: Any) Iterable[PolicyAssignment] [source]
Gets policy assignments for a resource.
- Parameters:
resource_group_name (str) – The name of the resource group containing the resource. The name is case insensitive. Required.
resource_provider_namespace (str) – The namespace of the resource provider. Required.
parent_resource_path (str) – The parent resource path. Required.
resource_type (str) – The resource type. Required.
resource_name (str) – The name of the resource with policy assignments. Required.
filter (str) – The filter to apply on the operation. Default value is None.
- Returns:
An iterator like instance of either PolicyAssignment or the result of cls(response)
- Return type:
- Raises:
- list_for_resource_group(resource_group_name: str, filter: str | None = None, **kwargs: Any) Iterable[PolicyAssignment] [source]
Gets policy assignments for the resource group.
- Parameters:
- Returns:
An iterator like instance of either PolicyAssignment or the result of cls(response)
- Return type:
- Raises:
- models = <module 'azure.mgmt.resource.policy.v2017_06_01_preview.models' from '/mnt/vss/_work/1/s/sdk/resources/azure-mgmt-resource/.tox/sphinx/lib/python3.11/site-packages/azure/mgmt/resource/policy/v2017_06_01_preview/models/__init__.py'>
- class azure.mgmt.resource.policy.v2017_06_01_preview.operations.PolicySetDefinitionsOperations(*args, **kwargs)[source]
Bases:
object
Warning
DO NOT instantiate this class directly.
Instead, you should access the following operations through
PolicyClient
’spolicy_set_definitions
attribute.- create_or_update(policy_set_definition_name: str, parameters: _models.PolicySetDefinition, *, content_type: str = 'application/json', **kwargs: Any) _models.PolicySetDefinition [source]
- create_or_update(policy_set_definition_name: str, parameters: IO[bytes], *, content_type: str = 'application/json', **kwargs: Any) _models.PolicySetDefinition
Creates or updates a policy set definition.
- Parameters:
policy_set_definition_name (str) – The name of the policy set definition to create. Required.
parameters (PolicySetDefinition or IO[bytes]) – The policy set definition properties. Is either a PolicySetDefinition type or a IO[bytes] type. Required.
- Returns:
PolicySetDefinition or the result of cls(response)
- Return type:
- Raises:
- create_or_update_at_management_group(policy_set_definition_name: str, management_group_id: str, parameters: _models.PolicySetDefinition, *, content_type: str = 'application/json', **kwargs: Any) _models.PolicySetDefinition [source]
- create_or_update_at_management_group(policy_set_definition_name: str, management_group_id: str, parameters: IO[bytes], *, content_type: str = 'application/json', **kwargs: Any) _models.PolicySetDefinition
Creates or updates a policy set definition at management group level.
- Parameters:
policy_set_definition_name (str) – The name of the policy set definition to create. Required.
management_group_id (str) – The ID of the management group. Required.
parameters (PolicySetDefinition or IO[bytes]) – The policy set definition properties. Is either a PolicySetDefinition type or a IO[bytes] type. Required.
- Returns:
PolicySetDefinition or the result of cls(response)
- Return type:
- Raises:
- delete(policy_set_definition_name: str, **kwargs: Any) None [source]
Deletes a policy set definition.
- Parameters:
policy_set_definition_name (str) – The name of the policy set definition to delete. Required.
- Returns:
None or the result of cls(response)
- Return type:
None
- Raises:
- delete_at_management_group(policy_set_definition_name: str, management_group_id: str, **kwargs: Any) None [source]
Deletes a policy set definition at management group level.
- Parameters:
- Returns:
None or the result of cls(response)
- Return type:
None
- Raises:
- get(policy_set_definition_name: str, **kwargs: Any) PolicySetDefinition [source]
Gets the policy set definition.
- Parameters:
policy_set_definition_name (str) – The name of the policy set definition to get. Required.
- Returns:
PolicySetDefinition or the result of cls(response)
- Return type:
- Raises:
- get_at_management_group(policy_set_definition_name: str, management_group_id: str, **kwargs: Any) PolicySetDefinition [source]
Gets the policy set definition at management group level.
- Parameters:
- Returns:
PolicySetDefinition or the result of cls(response)
- Return type:
- Raises:
- get_built_in(policy_set_definition_name: str, **kwargs: Any) PolicySetDefinition [source]
Gets the built in policy set definition.
- Parameters:
policy_set_definition_name (str) – The name of the policy set definition to get. Required.
- Returns:
PolicySetDefinition or the result of cls(response)
- Return type:
- Raises:
- list(**kwargs: Any) Iterable[PolicySetDefinition] [source]
Gets all the policy set definitions for a subscription.
- Returns:
An iterator like instance of either PolicySetDefinition or the result of cls(response)
- Return type:
- Raises:
- list_built_in(**kwargs: Any) Iterable[PolicySetDefinition] [source]
Gets all the built in policy set definitions.
- Returns:
An iterator like instance of either PolicySetDefinition or the result of cls(response)
- Return type:
- Raises:
- list_by_management_group(management_group_id: str, **kwargs: Any) Iterable[PolicySetDefinition] [source]
Gets all the policy set definitions for a subscription at management group.
- Parameters:
management_group_id (str) – The ID of the management group. Required.
- Returns:
An iterator like instance of either PolicySetDefinition or the result of cls(response)
- Return type:
- Raises:
- models = <module 'azure.mgmt.resource.policy.v2017_06_01_preview.models' from '/mnt/vss/_work/1/s/sdk/resources/azure-mgmt-resource/.tox/sphinx/lib/python3.11/site-packages/azure/mgmt/resource/policy/v2017_06_01_preview/models/__init__.py'>