azure.mgmt.resource.policy.v2016_04_01.operations module¶
-
class
azure.mgmt.resource.policy.v2016_04_01.operations.
PolicyAssignmentsOperations
(client, config, serializer, deserializer)[source]¶ Bases:
object
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
- 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
- Raises
~azure.core.exceptions.HttpResponseError
-
delete
(scope: str, policy_assignment_name: str, **kwargs: Any) → ’models.PolicyAssignment’[source]¶ Deletes a policy assignment.
- Parameters
- 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
- 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
- Raises
~azure.core.exceptions.HttpResponseError
-
get
(scope: str, policy_assignment_name: str, **kwargs: Any) → ’models.PolicyAssignment’[source]¶ Gets a policy assignment.
- Parameters
- 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
- 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
- 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
- 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.
- param resource_group_name
The name of the resource group containing the resource. The name is
- case insensitive.
- type resource_group_name
str
- param resource_provider_namespace
The namespace of the resource provider.
- type resource_provider_namespace
str
- param parent_resource_path
The parent resource path.
- type parent_resource_path
str
- param resource_type
The resource type.
- type resource_type
str
- param resource_name
The name of the resource with policy assignments.
- type resource_name
str
- param filter
The filter to apply on the operation.
- type filter
str
- keyword callable cls
A custom type or function that will be passed the direct response
- return
An iterator like instance of either PolicyAssignmentListResult or the result of cls(response)
- rtype
~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2016_04_01.models.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
- 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
- Raises
~azure.core.exceptions.HttpResponseError
-
models
= <module 'azure.mgmt.resource.policy.v2016_04_01.models' from '/home/vsts/work/1/s/sdk/resources/azure-mgmt-resource/.tox/sphinx/lib/python3.6/site-packages/azure/mgmt/resource/policy/v2016_04_01/models/__init__.py'>¶
-
class
azure.mgmt.resource.policy.v2016_04_01.operations.
PolicyDefinitionsOperations
(client, config, serializer, deserializer)[source]¶ Bases:
object
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
- 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
- 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
- Raises
~azure.core.exceptions.HttpResponseError
-
models
= <module 'azure.mgmt.resource.policy.v2016_04_01.models' from '/home/vsts/work/1/s/sdk/resources/azure-mgmt-resource/.tox/sphinx/lib/python3.6/site-packages/azure/mgmt/resource/policy/v2016_04_01/models/__init__.py'>¶