azure.mgmt.resource.policy.v2016_12_01.operations module

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

Bases: object

PolicyDefinitionsOperations operations.

Parameters:
  • client – Client for service requests.
  • config – Configuration of service client.
  • serializer – An object model serializer.
  • deserializer – An objec model deserializer.
Variables:

api_version – The API version to use for the operation. Constant value: “2016-12-01”.

create_or_update(policy_definition_name, parameters, custom_headers=None, raw=False, **operation_config)[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.
  • custom_headers (dict) – headers that will be added to the request
  • raw (bool) – returns the direct response alongside the deserialized response
  • operation_configOperation configuration overrides.
Returns:

PolicyDefinition or ClientRawResponse if raw=true

Return type:

PolicyDefinition or ClientRawResponse

Raises:

CloudError

delete(policy_definition_name, custom_headers=None, raw=False, **operation_config)[source]

Deletes a policy definition.

Parameters:
  • policy_definition_name (str) – The name of the policy definition to delete.
  • custom_headers (dict) – headers that will be added to the request
  • raw (bool) – returns the direct response alongside the deserialized response
  • operation_configOperation configuration overrides.
Returns:

None or ClientRawResponse if raw=true

Return type:

None or ClientRawResponse

Raises:

CloudError

get(policy_definition_name, custom_headers=None, raw=False, **operation_config)[source]

Gets the policy definition.

Parameters:
  • policy_definition_name (str) – The name of the policy definition to get.
  • custom_headers (dict) – headers that will be added to the request
  • raw (bool) – returns the direct response alongside the deserialized response
  • operation_configOperation configuration overrides.
Returns:

PolicyDefinition or ClientRawResponse if raw=true

Return type:

PolicyDefinition or ClientRawResponse

Raises:

CloudError

list(filter=None, custom_headers=None, raw=False, **operation_config)[source]

Gets all the policy definitions for a subscription.

Parameters:
  • filter (str) – The filter to apply on the operation.
  • custom_headers (dict) – headers that will be added to the request
  • raw (bool) – returns the direct response alongside the deserialized response
  • operation_configOperation configuration overrides.
Returns:

An iterator like instance of PolicyDefinition

Return type:

PolicyDefinitionPaged

Raises:

CloudError

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

Bases: object

PolicyAssignmentsOperations operations.

Parameters:
  • client – Client for service requests.
  • config – Configuration of service client.
  • serializer – An object model serializer.
  • deserializer – An objec model deserializer.
Variables:

api_version – The API version to use for the operation. Constant value: “2016-12-01”.

create(scope, policy_assignment_name, parameters, custom_headers=None, raw=False, **operation_config)[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.
  • custom_headers (dict) – headers that will be added to the request
  • raw (bool) – returns the direct response alongside the deserialized response
  • operation_configOperation configuration overrides.
Returns:

PolicyAssignment or ClientRawResponse if raw=true

Return type:

PolicyAssignment or ClientRawResponse

Raises:

CloudError

create_by_id(policy_assignment_id, parameters, custom_headers=None, raw=False, **operation_config)[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 assigment, 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.
  • custom_headers (dict) – headers that will be added to the request
  • raw (bool) – returns the direct response alongside the deserialized response
  • operation_configOperation configuration overrides.
Returns:

PolicyAssignment or ClientRawResponse if raw=true

Return type:

PolicyAssignment or ClientRawResponse

Raises:

CloudError

delete(scope, policy_assignment_name, custom_headers=None, raw=False, **operation_config)[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.
  • custom_headers (dict) – headers that will be added to the request
  • raw (bool) – returns the direct response alongside the deserialized response
  • operation_configOperation configuration overrides.
Returns:

PolicyAssignment or ClientRawResponse if raw=true

Return type:

PolicyAssignment or ClientRawResponse

Raises:

CloudError

delete_by_id(policy_assignment_id, custom_headers=None, raw=False, **operation_config)[source]

Deletes a policy assignment by ID.

When providing a scope for the assigment, 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}’.
  • custom_headers (dict) – headers that will be added to the request
  • raw (bool) – returns the direct response alongside the deserialized response
  • operation_configOperation configuration overrides.
Returns:

PolicyAssignment or ClientRawResponse if raw=true

Return type:

PolicyAssignment or ClientRawResponse

Raises:

CloudError

get(scope, policy_assignment_name, custom_headers=None, raw=False, **operation_config)[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.
  • custom_headers (dict) – headers that will be added to the request
  • raw (bool) – returns the direct response alongside the deserialized response
  • operation_configOperation configuration overrides.
Returns:

PolicyAssignment or ClientRawResponse if raw=true

Return type:

PolicyAssignment or ClientRawResponse

Raises:

CloudError

get_by_id(policy_assignment_id, custom_headers=None, raw=False, **operation_config)[source]

Gets a policy assignment by ID.

When providing a scope for the assigment, 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}’.
  • custom_headers (dict) – headers that will be added to the request
  • raw (bool) – returns the direct response alongside the deserialized response
  • operation_configOperation configuration overrides.
Returns:

PolicyAssignment or ClientRawResponse if raw=true

Return type:

PolicyAssignment or ClientRawResponse

Raises:

CloudError

list(filter=None, custom_headers=None, raw=False, **operation_config)[source]

Gets all the policy assignments for a subscription.

Parameters:
  • filter (str) – The filter to apply on the operation.
  • custom_headers (dict) – headers that will be added to the request
  • raw (bool) – returns the direct response alongside the deserialized response
  • operation_configOperation configuration overrides.
Returns:

An iterator like instance of PolicyAssignment

Return type:

PolicyAssignmentPaged

Raises:

CloudError

list_for_resource(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter=None, custom_headers=None, raw=False, **operation_config)[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.
  • custom_headers (dict) – headers that will be added to the request
  • raw (bool) – returns the direct response alongside the deserialized response
  • operation_configOperation configuration overrides.
Returns:

An iterator like instance of PolicyAssignment

Return type:

PolicyAssignmentPaged

Raises:

CloudError

list_for_resource_group(resource_group_name, filter=None, custom_headers=None, raw=False, **operation_config)[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.
  • custom_headers (dict) – headers that will be added to the request
  • raw (bool) – returns the direct response alongside the deserialized response
  • operation_configOperation configuration overrides.
Returns:

An iterator like instance of PolicyAssignment

Return type:

PolicyAssignmentPaged

Raises:

CloudError