azure.mgmt.resource.policy.v2015_10_01_preview.operations package

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

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

create(scope: str, policy_assignment_name: str, parameters: ‘models.PolicyAssignment’, **kwargs: Any) → ’models.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

create_by_id(policy_assignment_id: str, parameters: ‘models.PolicyAssignment’, **kwargs: Any) → ’models.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

delete(scope: str, policy_assignment_name: str, **kwargs: Any) → ’models.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

delete_by_id(policy_assignment_id: str, **kwargs: Any) → ’models.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

get(scope: str, policy_assignment_name: str, **kwargs: Any) → ’models.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

get_by_id(policy_assignment_id: str, **kwargs: Any) → ’models.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: Any) → Iterable[‘models.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

ItemPaged[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: Any) → Iterable[‘models.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

ItemPaged[PolicyAssignmentListResult]

Raises

~azure.core.exceptions.HttpResponseError

list_for_resource_group(resource_group_name: str, filter: Optional[str] = None, **kwargs: Any) → Iterable[‘models.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

ItemPaged[PolicyAssignmentListResult]

Raises

~azure.core.exceptions.HttpResponseError

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

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

create_or_update(policy_definition_name: str, parameters: ‘models.PolicyDefinition’, **kwargs: Any) → ’models.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

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.

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

get(policy_definition_name: str, **kwargs: Any) → ’models.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: Any) → Iterable[‘models.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

ItemPaged[PolicyDefinitionListResult]

Raises

~azure.core.exceptions.HttpResponseError

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