azure.mgmt.resource.policy.v2016_04_01.aio.operations package

class azure.mgmt.resource.policy.v2016_04_01.aio.operations.PolicyAssignmentsOperations(client, config, serializer, deserializer)[source]

PolicyAssignmentsOperations async operations.

You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute.

Variables

models – Alias to model classes used in this operation group.

Parameters
  • client – Client for service requests.

  • config – Configuration of service client.

  • serializer – An object model serializer.

  • deserializer – An object model deserializer.

async create(scope: str, policy_assignment_name: str, parameters: azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyAssignment, **kwargs) → azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyAssignment[source]

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.

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

  • parameters (PolicyAssignment) – Parameters for the policy assignment.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

PolicyAssignment, or the result of cls(response)

Return type

PolicyAssignment

Raises

~azure.core.exceptions.HttpResponseError

async create_by_id(policy_assignment_id: str, parameters: azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyAssignment, **kwargs) → azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyAssignment[source]

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

  • parameters (PolicyAssignment) – Parameters for policy assignment.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

PolicyAssignment, or the result of cls(response)

Return type

PolicyAssignment

Raises

~azure.core.exceptions.HttpResponseError

async delete(scope: str, policy_assignment_name: str, **kwargs) → azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyAssignment[source]

Deletes a policy assignment.

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

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

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

PolicyAssignment, or the result of cls(response)

Return type

PolicyAssignment

Raises

~azure.core.exceptions.HttpResponseError

async delete_by_id(policy_assignment_id: str, **kwargs) → azure.mgmt.resource.policy.v2016_04_01.models._models_py3.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}’.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

PolicyAssignment, or the result of cls(response)

Return type

PolicyAssignment

Raises

~azure.core.exceptions.HttpResponseError

async get(scope: str, policy_assignment_name: str, **kwargs) → azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyAssignment[source]

Gets a policy assignment.

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

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

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

PolicyAssignment, or the result of cls(response)

Return type

PolicyAssignment

Raises

~azure.core.exceptions.HttpResponseError

async get_by_id(policy_assignment_id: str, **kwargs) → azure.mgmt.resource.policy.v2016_04_01.models._models_py3.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}’.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

PolicyAssignment, or the result of cls(response)

Return type

PolicyAssignment

Raises

~azure.core.exceptions.HttpResponseError

list(filter: Optional[str] = None, **kwargs) → AsyncIterable[azure.mgmt.resource.policy.v2015_10_01_preview.models._models_py3.PolicyAssignmentListResult][source]

Gets all the policy assignments for a subscription.

Parameters

filter (str) – The filter to apply on the operation.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

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

Return type

AsyncItemPaged[PolicyAssignmentListResult]

Raises

~azure.core.exceptions.HttpResponseError

list_for_resource(resource_group_name: str, resource_provider_namespace: str, parent_resource_path: str, resource_type: str, resource_name: str, filter: Optional[str] = None, **kwargs) → AsyncIterable[azure.mgmt.resource.policy.v2015_10_01_preview.models._models_py3.PolicyAssignmentListResult][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.

  • resource_provider_namespace (str) – The namespace of the resource provider.

  • parent_resource_path (str) – The parent resource path.

  • resource_type (str) – The resource type.

  • resource_name (str) – The name of the resource with policy assignments.

  • filter (str) – The filter to apply on the operation.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

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

Return type

AsyncItemPaged[PolicyAssignmentListResult]

Raises

~azure.core.exceptions.HttpResponseError

list_for_resource_group(resource_group_name: str, filter: Optional[str] = None, **kwargs) → AsyncIterable[azure.mgmt.resource.policy.v2015_10_01_preview.models._models_py3.PolicyAssignmentListResult][source]

Gets policy assignments for the resource group.

Parameters
  • resource_group_name (str) – The name of the resource group that contains policy assignments.

  • filter (str) – The filter to apply on the operation.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

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

Return type

AsyncItemPaged[PolicyAssignmentListResult]

Raises

~azure.core.exceptions.HttpResponseError

models = <module 'azure.mgmt.resource.policy.v2016_04_01.models' from 'c:\\repo\\azure-sdk-for-python\\sdk\\resources\\azure-mgmt-resource\\.tox\\sphinx\\lib\\site-packages\\azure\\mgmt\\resource\\policy\\v2016_04_01\\models\\__init__.py'>
class azure.mgmt.resource.policy.v2016_04_01.aio.operations.PolicyDefinitionsOperations(client, config, serializer, deserializer)[source]

PolicyDefinitionsOperations async operations.

You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute.

Variables

models – Alias to model classes used in this operation group.

Parameters
  • client – Client for service requests.

  • config – Configuration of service client.

  • serializer – An object model serializer.

  • deserializer – An object model deserializer.

async create_or_update(policy_definition_name: str, parameters: azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyDefinition, **kwargs) → azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyDefinition[source]

Creates or updates a policy definition.

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

  • parameters (PolicyDefinition) – The policy definition properties.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

PolicyDefinition, or the result of cls(response)

Return type

PolicyDefinition

Raises

~azure.core.exceptions.HttpResponseError

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

Deletes a policy definition.

Parameters

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

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

None, or the result of cls(response)

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

async get(policy_definition_name: str, **kwargs) → azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyDefinition[source]

Gets the policy definition.

Parameters

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

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

PolicyDefinition, or the result of cls(response)

Return type

PolicyDefinition

Raises

~azure.core.exceptions.HttpResponseError

list(filter: Optional[str] = None, **kwargs) → AsyncIterable[azure.mgmt.resource.policy.v2015_10_01_preview.models._models_py3.PolicyDefinitionListResult][source]

Gets all the policy definitions for a subscription.

Parameters

filter (str) – The filter to apply on the operation.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

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

Return type

AsyncItemPaged[PolicyDefinitionListResult]

Raises

~azure.core.exceptions.HttpResponseError

models = <module 'azure.mgmt.resource.policy.v2016_04_01.models' from 'c:\\repo\\azure-sdk-for-python\\sdk\\resources\\azure-mgmt-resource\\.tox\\sphinx\\lib\\site-packages\\azure\\mgmt\\resource\\policy\\v2016_04_01\\models\\__init__.py'>