azure.mgmt.resource.policy.v2015_10_01_preview.operations module

class azure.mgmt.resource.policy.v2015_10_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’s policy_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:

PolicyAssignment

Raises:

HttpResponseError

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:

PolicyAssignment

Raises:

HttpResponseError

delete(scope: str, policy_assignment_name: str, **kwargs: Any) PolicyAssignment[source]

Deletes a policy assignment.

Parameters:
  • scope (str) – The scope of the policy assignment. Required.

  • policy_assignment_name (str) – The name of the policy assignment to delete. Required.

Returns:

PolicyAssignment or the result of cls(response)

Return type:

PolicyAssignment

Raises:

HttpResponseError

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:

PolicyAssignment

Raises:

HttpResponseError

get(scope: str, policy_assignment_name: str, **kwargs: Any) PolicyAssignment[source]

Gets a policy assignment.

Parameters:
  • scope (str) – The scope of the policy assignment. Required.

  • policy_assignment_name (str) – The name of the policy assignment to get. Required.

Returns:

PolicyAssignment or the result of cls(response)

Return type:

PolicyAssignment

Raises:

HttpResponseError

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:

PolicyAssignment

Raises:

HttpResponseError

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:

ItemPaged[PolicyAssignment]

Raises:

HttpResponseError

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:

ItemPaged[PolicyAssignment]

Raises:

HttpResponseError

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:
  • resource_group_name (str) – The name of the resource group that contains 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:

ItemPaged[PolicyAssignment]

Raises:

HttpResponseError

models = <module 'azure.mgmt.resource.policy.v2015_10_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/v2015_10_01_preview/models/__init__.py'>
class azure.mgmt.resource.policy.v2015_10_01_preview.operations.PolicyDefinitionsOperations(*args, **kwargs)[source]

Bases: object

Warning

DO NOT instantiate this class directly.

Instead, you should access the following operations through PolicyClient’s policy_definitions attribute.

create_or_update(policy_definition_name: str, parameters: _models.PolicyDefinition, *, content_type: str = 'application/json', **kwargs: Any) _models.PolicyDefinition[source]
create_or_update(policy_definition_name: str, parameters: IO[bytes], *, content_type: str = 'application/json', **kwargs: Any) _models.PolicyDefinition

Creates or updates a policy definition.

Parameters:
  • policy_definition_name (str) – The name of the policy definition to create. Required.

  • parameters (PolicyDefinition or IO[bytes]) – The policy definition properties. Is either a PolicyDefinition type or a IO[bytes] type. Required.

Returns:

PolicyDefinition or the result of cls(response)

Return type:

PolicyDefinition

Raises:

HttpResponseError

delete(policy_definition_name: str, **kwargs: Any) None[source]

Deletes a policy definition.

Parameters:

policy_definition_name (str) – The name of the policy definition to delete. Required.

Returns:

None or the result of cls(response)

Return type:

None

Raises:

HttpResponseError

get(policy_definition_name: str, **kwargs: Any) PolicyDefinition[source]

Gets the policy definition.

Parameters:

policy_definition_name (str) – The name of the policy definition to get. Required.

Returns:

PolicyDefinition or the result of cls(response)

Return type:

PolicyDefinition

Raises:

HttpResponseError

list(filter: str | None = None, **kwargs: Any) Iterable[PolicyDefinition][source]

Gets all the policy definitions for a subscription.

Parameters:

filter (str) – The filter to apply on the operation. Default value is None.

Returns:

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

Return type:

ItemPaged[PolicyDefinition]

Raises:

HttpResponseError

models = <module 'azure.mgmt.resource.policy.v2015_10_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/v2015_10_01_preview/models/__init__.py'>