diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/CHANGELOG.md b/sdk/policyinsights/azure-mgmt-policyinsights/CHANGELOG.md index 9aa5e4408380..194234193ca9 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/CHANGELOG.md +++ b/sdk/policyinsights/azure-mgmt-policyinsights/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 1.0.0 (2020-12-22) + +**Features** + + - Model ExpressionEvaluationDetails has a new parameter expression_kind + - Added operation group PolicyRestrictionsOperations + ## 1.0.0b1 (2020-10-26) This is beta preview version. diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_policy_insights_client.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_policy_insights_client.py index 49e485f3cf99..5fec7a26850b 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_policy_insights_client.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_policy_insights_client.py @@ -24,6 +24,7 @@ from .operations import PolicyStatesOperations from .operations import Operations from .operations import PolicyMetadataOperations +from .operations import PolicyRestrictionsOperations from . import models @@ -42,6 +43,8 @@ class PolicyInsightsClient(object): :vartype operations: azure.mgmt.policyinsights.operations.Operations :ivar policy_metadata: PolicyMetadataOperations operations :vartype policy_metadata: azure.mgmt.policyinsights.operations.PolicyMetadataOperations + :ivar policy_restrictions: PolicyRestrictionsOperations operations + :vartype policy_restrictions: azure.mgmt.policyinsights.operations.PolicyRestrictionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Microsoft Azure subscription ID. @@ -80,6 +83,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.policy_metadata = PolicyMetadataOperations( self._client, self._config, self._serialize, self._deserialize) + self.policy_restrictions = PolicyRestrictionsOperations( + self._client, self._config, self._serialize, self._deserialize) def close(self): # type: () -> None diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_version.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_version.py index e5754a47ce68..c47f66669f1b 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_version.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "1.0.0" diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/_policy_insights_client.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/_policy_insights_client.py index 03edf562cd48..a25f9650bbb1 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/_policy_insights_client.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/_policy_insights_client.py @@ -22,6 +22,7 @@ from .operations import PolicyStatesOperations from .operations import Operations from .operations import PolicyMetadataOperations +from .operations import PolicyRestrictionsOperations from .. import models @@ -40,6 +41,8 @@ class PolicyInsightsClient(object): :vartype operations: azure.mgmt.policyinsights.aio.operations.Operations :ivar policy_metadata: PolicyMetadataOperations operations :vartype policy_metadata: azure.mgmt.policyinsights.aio.operations.PolicyMetadataOperations + :ivar policy_restrictions: PolicyRestrictionsOperations operations + :vartype policy_restrictions: azure.mgmt.policyinsights.aio.operations.PolicyRestrictionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Microsoft Azure subscription ID. @@ -77,6 +80,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.policy_metadata = PolicyMetadataOperations( self._client, self._config, self._serialize, self._deserialize) + self.policy_restrictions = PolicyRestrictionsOperations( + self._client, self._config, self._serialize, self._deserialize) async def close(self) -> None: await self._client.close() diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/__init__.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/__init__.py index 33f195700122..4bbdef723768 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/__init__.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/__init__.py @@ -12,6 +12,7 @@ from ._policy_states_operations import PolicyStatesOperations from ._operations import Operations from ._policy_metadata_operations import PolicyMetadataOperations +from ._policy_restrictions_operations import PolicyRestrictionsOperations __all__ = [ 'PolicyTrackedResourcesOperations', @@ -20,4 +21,5 @@ 'PolicyStatesOperations', 'Operations', 'PolicyMetadataOperations', + 'PolicyRestrictionsOperations', ] diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_operations.py index 55f666e062ee..8cfd0d1c363d 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def list( self, **kwargs - ) -> "models.OperationsListResults": + ) -> "_models.OperationsListResults": """Lists available operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -51,7 +51,7 @@ async def list( :rtype: ~azure.mgmt.policyinsights.models.OperationsListResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationsListResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsListResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -76,7 +76,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationsListResults', pipeline_response) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_events_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_events_operations.py index 2447cc2fe527..73091e34d4f2 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_events_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_events_operations.py @@ -15,7 +15,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -34,7 +34,7 @@ class PolicyEventsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,9 +45,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list_query_results_for_management_group( self, management_group_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyEventsQueryResults"]: + ) -> AsyncIterable["_models.PolicyEventsQueryResults"]: """Queries policy events for the resources under the management group. :param management_group_name: Management group name. @@ -59,7 +59,7 @@ def list_query_results_for_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyEventsQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyEventsQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -142,7 +142,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -156,9 +156,9 @@ async def get_next(next_link=None): def list_query_results_for_subscription( self, subscription_id: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyEventsQueryResults"]: + ) -> AsyncIterable["_models.PolicyEventsQueryResults"]: """Queries policy events for the resources under the subscription. :param subscription_id: Microsoft Azure subscription ID. @@ -170,7 +170,7 @@ def list_query_results_for_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyEventsQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyEventsQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -251,7 +251,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -266,9 +266,9 @@ def list_query_results_for_resource_group( self, subscription_id: str, resource_group_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyEventsQueryResults"]: + ) -> AsyncIterable["_models.PolicyEventsQueryResults"]: """Queries policy events for the resources under the resource group. :param subscription_id: Microsoft Azure subscription ID. @@ -282,7 +282,7 @@ def list_query_results_for_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyEventsQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyEventsQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -364,7 +364,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -378,9 +378,9 @@ async def get_next(next_link=None): def list_query_results_for_resource( self, resource_id: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyEventsQueryResults"]: + ) -> AsyncIterable["_models.PolicyEventsQueryResults"]: """Queries policy events for the resource. :param resource_id: Resource ID. @@ -392,7 +392,7 @@ def list_query_results_for_resource( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyEventsQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyEventsQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -477,7 +477,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -492,9 +492,9 @@ def list_query_results_for_policy_set_definition( self, subscription_id: str, policy_set_definition_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyEventsQueryResults"]: + ) -> AsyncIterable["_models.PolicyEventsQueryResults"]: """Queries policy events for the subscription level policy set definition. :param subscription_id: Microsoft Azure subscription ID. @@ -508,7 +508,7 @@ def list_query_results_for_policy_set_definition( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyEventsQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyEventsQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -592,7 +592,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -607,9 +607,9 @@ def list_query_results_for_policy_definition( self, subscription_id: str, policy_definition_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyEventsQueryResults"]: + ) -> AsyncIterable["_models.PolicyEventsQueryResults"]: """Queries policy events for the subscription level policy definition. :param subscription_id: Microsoft Azure subscription ID. @@ -623,7 +623,7 @@ def list_query_results_for_policy_definition( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyEventsQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyEventsQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -707,7 +707,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -722,9 +722,9 @@ def list_query_results_for_subscription_level_policy_assignment( self, subscription_id: str, policy_assignment_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyEventsQueryResults"]: + ) -> AsyncIterable["_models.PolicyEventsQueryResults"]: """Queries policy events for the subscription level policy assignment. :param subscription_id: Microsoft Azure subscription ID. @@ -738,7 +738,7 @@ def list_query_results_for_subscription_level_policy_assignment( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyEventsQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyEventsQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -822,7 +822,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -838,9 +838,9 @@ def list_query_results_for_resource_group_level_policy_assignment( subscription_id: str, resource_group_name: str, policy_assignment_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyEventsQueryResults"]: + ) -> AsyncIterable["_models.PolicyEventsQueryResults"]: """Queries policy events for the resource group level policy assignment. :param subscription_id: Microsoft Azure subscription ID. @@ -856,7 +856,7 @@ def list_query_results_for_resource_group_level_policy_assignment( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyEventsQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyEventsQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -941,7 +941,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_metadata_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_metadata_operations.py index c37fb1e015b9..b2488814080f 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_metadata_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_metadata_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyMetadataOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def get_resource( self, resource_name: str, **kwargs - ) -> "models.PolicyMetadata": + ) -> "_models.PolicyMetadata": """Get policy metadata resource. :param resource_name: The name of the policy metadata resource. @@ -55,7 +55,7 @@ async def get_resource( :rtype: ~azure.mgmt.policyinsights.models.PolicyMetadata :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyMetadata"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyMetadata"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -84,7 +84,7 @@ async def get_resource( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponseAutoGenerated, response) + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyMetadata', pipeline_response) @@ -97,9 +97,9 @@ async def get_resource( def list( self, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyMetadataCollection"]: + ) -> AsyncIterable["_models.PolicyMetadataCollection"]: """Get a list of the policy metadata resources. :param query_options: Parameter group. @@ -109,7 +109,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyMetadataCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyMetadataCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyMetadataCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -156,7 +156,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponseAutoGenerated, response) + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_restrictions_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_restrictions_operations.py new file mode 100644 index 000000000000..8c3907b612c3 --- /dev/null +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_restrictions_operations.py @@ -0,0 +1,164 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PolicyRestrictionsOperations: + """PolicyRestrictionsOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.policyinsights.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def check_at_subscription_scope( + self, + parameters: "_models.CheckRestrictionsRequest", + **kwargs + ) -> "_models.CheckRestrictionsResult": + """Checks what restrictions Azure Policy will place on a resource within a subscription. + + :param parameters: The check policy restrictions parameters. + :type parameters: ~azure.mgmt.policyinsights.models.CheckRestrictionsRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckRestrictionsResult, or the result of cls(response) + :rtype: ~azure.mgmt.policyinsights.models.CheckRestrictionsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckRestrictionsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckRestrictionsRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckRestrictionsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions'} # type: ignore + + async def check_at_resource_group_scope( + self, + resource_group_name: str, + parameters: "_models.CheckRestrictionsRequest", + **kwargs + ) -> "_models.CheckRestrictionsResult": + """Checks what restrictions Azure Policy will place on a resource within a resource group. Use + this when the resource group the resource will be created in is already known. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: The check policy restrictions parameters. + :type parameters: ~azure.mgmt.policyinsights.models.CheckRestrictionsRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckRestrictionsResult, or the result of cls(response) + :rtype: ~azure.mgmt.policyinsights.models.CheckRestrictionsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckRestrictionsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_at_resource_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckRestrictionsRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckRestrictionsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_at_resource_group_scope.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions'} # type: ignore diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_states_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_states_operations.py index 92b7b4723795..6d6684a697c9 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_states_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_states_operations.py @@ -17,7 +17,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +36,7 @@ class PolicyStatesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,11 +46,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list_query_results_for_management_group( self, - policy_states_resource: Union[str, "models.PolicyStatesResource"], + policy_states_resource: Union[str, "_models.PolicyStatesResource"], management_group_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyStatesQueryResults"]: + ) -> AsyncIterable["_models.PolicyStatesQueryResults"]: """Queries policy states for the resources under the management group. :param policy_states_resource: The virtual resource under PolicyStates resource type. In a @@ -66,7 +66,7 @@ def list_query_results_for_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyStatesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyStatesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyStatesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -148,7 +148,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -162,9 +162,9 @@ async def get_next(next_link=None): async def summarize_for_management_group( self, management_group_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> "models.SummarizeResults": + ) -> "_models.SummarizeResults": """Summarizes policy states for the resources under the management group. :param management_group_name: Management group name. @@ -176,7 +176,7 @@ async def summarize_for_management_group( :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SummarizeResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SummarizeResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -227,7 +227,7 @@ async def summarize_for_management_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -240,11 +240,11 @@ async def summarize_for_management_group( def list_query_results_for_subscription( self, - policy_states_resource: Union[str, "models.PolicyStatesResource"], + policy_states_resource: Union[str, "_models.PolicyStatesResource"], subscription_id: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyStatesQueryResults"]: + ) -> AsyncIterable["_models.PolicyStatesQueryResults"]: """Queries policy states for the resources under the subscription. :param policy_states_resource: The virtual resource under PolicyStates resource type. In a @@ -260,7 +260,7 @@ def list_query_results_for_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyStatesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyStatesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyStatesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -340,7 +340,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -354,9 +354,9 @@ async def get_next(next_link=None): async def summarize_for_subscription( self, subscription_id: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> "models.SummarizeResults": + ) -> "_models.SummarizeResults": """Summarizes policy states for the resources under the subscription. :param subscription_id: Microsoft Azure subscription ID. @@ -368,7 +368,7 @@ async def summarize_for_subscription( :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SummarizeResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SummarizeResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -417,7 +417,7 @@ async def summarize_for_subscription( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -430,12 +430,12 @@ async def summarize_for_subscription( def list_query_results_for_resource_group( self, - policy_states_resource: Union[str, "models.PolicyStatesResource"], + policy_states_resource: Union[str, "_models.PolicyStatesResource"], subscription_id: str, resource_group_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyStatesQueryResults"]: + ) -> AsyncIterable["_models.PolicyStatesQueryResults"]: """Queries policy states for the resources under the resource group. :param policy_states_resource: The virtual resource under PolicyStates resource type. In a @@ -453,7 +453,7 @@ def list_query_results_for_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyStatesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyStatesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyStatesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -534,7 +534,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -549,9 +549,9 @@ async def summarize_for_resource_group( self, subscription_id: str, resource_group_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> "models.SummarizeResults": + ) -> "_models.SummarizeResults": """Summarizes policy states for the resources under the resource group. :param subscription_id: Microsoft Azure subscription ID. @@ -565,7 +565,7 @@ async def summarize_for_resource_group( :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SummarizeResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SummarizeResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -615,7 +615,7 @@ async def summarize_for_resource_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -628,11 +628,11 @@ async def summarize_for_resource_group( def list_query_results_for_resource( self, - policy_states_resource: Union[str, "models.PolicyStatesResource"], + policy_states_resource: Union[str, "_models.PolicyStatesResource"], resource_id: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyStatesQueryResults"]: + ) -> AsyncIterable["_models.PolicyStatesQueryResults"]: """Queries policy states for the resource. :param policy_states_resource: The virtual resource under PolicyStates resource type. In a @@ -648,7 +648,7 @@ def list_query_results_for_resource( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyStatesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyStatesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyStatesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -732,7 +732,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -746,9 +746,9 @@ async def get_next(next_link=None): async def summarize_for_resource( self, resource_id: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> "models.SummarizeResults": + ) -> "_models.SummarizeResults": """Summarizes policy states for the resource. :param resource_id: Resource ID. @@ -760,7 +760,7 @@ async def summarize_for_resource( :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SummarizeResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SummarizeResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -809,7 +809,7 @@ async def summarize_for_resource( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -854,7 +854,7 @@ async def _trigger_subscription_evaluation_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -902,7 +902,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -952,7 +956,7 @@ async def _trigger_resource_group_evaluation_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -1004,7 +1008,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1020,12 +1029,12 @@ def get_long_running_output(pipeline_response): def list_query_results_for_policy_set_definition( self, - policy_states_resource: Union[str, "models.PolicyStatesResource"], + policy_states_resource: Union[str, "_models.PolicyStatesResource"], subscription_id: str, policy_set_definition_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyStatesQueryResults"]: + ) -> AsyncIterable["_models.PolicyStatesQueryResults"]: """Queries policy states for the subscription level policy set definition. :param policy_states_resource: The virtual resource under PolicyStates resource type. In a @@ -1043,7 +1052,7 @@ def list_query_results_for_policy_set_definition( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyStatesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyStatesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyStatesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1126,7 +1135,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1141,9 +1150,9 @@ async def summarize_for_policy_set_definition( self, subscription_id: str, policy_set_definition_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> "models.SummarizeResults": + ) -> "_models.SummarizeResults": """Summarizes policy states for the subscription level policy set definition. :param subscription_id: Microsoft Azure subscription ID. @@ -1157,7 +1166,7 @@ async def summarize_for_policy_set_definition( :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SummarizeResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SummarizeResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1209,7 +1218,7 @@ async def summarize_for_policy_set_definition( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -1222,12 +1231,12 @@ async def summarize_for_policy_set_definition( def list_query_results_for_policy_definition( self, - policy_states_resource: Union[str, "models.PolicyStatesResource"], + policy_states_resource: Union[str, "_models.PolicyStatesResource"], subscription_id: str, policy_definition_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyStatesQueryResults"]: + ) -> AsyncIterable["_models.PolicyStatesQueryResults"]: """Queries policy states for the subscription level policy definition. :param policy_states_resource: The virtual resource under PolicyStates resource type. In a @@ -1245,7 +1254,7 @@ def list_query_results_for_policy_definition( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyStatesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyStatesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyStatesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1328,7 +1337,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1343,9 +1352,9 @@ async def summarize_for_policy_definition( self, subscription_id: str, policy_definition_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> "models.SummarizeResults": + ) -> "_models.SummarizeResults": """Summarizes policy states for the subscription level policy definition. :param subscription_id: Microsoft Azure subscription ID. @@ -1359,7 +1368,7 @@ async def summarize_for_policy_definition( :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SummarizeResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SummarizeResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1411,7 +1420,7 @@ async def summarize_for_policy_definition( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -1424,12 +1433,12 @@ async def summarize_for_policy_definition( def list_query_results_for_subscription_level_policy_assignment( self, - policy_states_resource: Union[str, "models.PolicyStatesResource"], + policy_states_resource: Union[str, "_models.PolicyStatesResource"], subscription_id: str, policy_assignment_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyStatesQueryResults"]: + ) -> AsyncIterable["_models.PolicyStatesQueryResults"]: """Queries policy states for the subscription level policy assignment. :param policy_states_resource: The virtual resource under PolicyStates resource type. In a @@ -1447,7 +1456,7 @@ def list_query_results_for_subscription_level_policy_assignment( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyStatesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyStatesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyStatesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1530,7 +1539,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1545,9 +1554,9 @@ async def summarize_for_subscription_level_policy_assignment( self, subscription_id: str, policy_assignment_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> "models.SummarizeResults": + ) -> "_models.SummarizeResults": """Summarizes policy states for the subscription level policy assignment. :param subscription_id: Microsoft Azure subscription ID. @@ -1561,7 +1570,7 @@ async def summarize_for_subscription_level_policy_assignment( :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SummarizeResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SummarizeResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1613,7 +1622,7 @@ async def summarize_for_subscription_level_policy_assignment( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -1626,13 +1635,13 @@ async def summarize_for_subscription_level_policy_assignment( def list_query_results_for_resource_group_level_policy_assignment( self, - policy_states_resource: Union[str, "models.PolicyStatesResource"], + policy_states_resource: Union[str, "_models.PolicyStatesResource"], subscription_id: str, resource_group_name: str, policy_assignment_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyStatesQueryResults"]: + ) -> AsyncIterable["_models.PolicyStatesQueryResults"]: """Queries policy states for the resource group level policy assignment. :param policy_states_resource: The virtual resource under PolicyStates resource type. In a @@ -1652,7 +1661,7 @@ def list_query_results_for_resource_group_level_policy_assignment( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyStatesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyStatesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyStatesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1736,7 +1745,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1752,9 +1761,9 @@ async def summarize_for_resource_group_level_policy_assignment( subscription_id: str, resource_group_name: str, policy_assignment_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> "models.SummarizeResults": + ) -> "_models.SummarizeResults": """Summarizes policy states for the resource group level policy assignment. :param subscription_id: Microsoft Azure subscription ID. @@ -1770,7 +1779,7 @@ async def summarize_for_resource_group_level_policy_assignment( :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SummarizeResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SummarizeResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1823,7 +1832,7 @@ async def summarize_for_resource_group_level_policy_assignment( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_tracked_resources_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_tracked_resources_operations.py index 0ba63bd0fd77..b6265dc74008 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_tracked_resources_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_tracked_resources_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyTrackedResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,9 +44,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list_query_results_for_management_group( self, management_group_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyTrackedResourcesQueryResults"]: + ) -> AsyncIterable["_models.PolicyTrackedResourcesQueryResults"]: """Queries policy tracked resources under the management group. :param management_group_name: Management group name. @@ -58,7 +58,7 @@ def list_query_results_for_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyTrackedResourcesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyTrackedResourcesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyTrackedResourcesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -117,7 +117,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -130,9 +130,9 @@ async def get_next(next_link=None): def list_query_results_for_subscription( self, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyTrackedResourcesQueryResults"]: + ) -> AsyncIterable["_models.PolicyTrackedResourcesQueryResults"]: """Queries policy tracked resources under the subscription. :param query_options: Parameter group. @@ -142,7 +142,7 @@ def list_query_results_for_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyTrackedResourcesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyTrackedResourcesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyTrackedResourcesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -199,7 +199,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -213,9 +213,9 @@ async def get_next(next_link=None): def list_query_results_for_resource_group( self, resource_group_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyTrackedResourcesQueryResults"]: + ) -> AsyncIterable["_models.PolicyTrackedResourcesQueryResults"]: """Queries policy tracked resources under the resource group. :param resource_group_name: Resource group name. @@ -227,7 +227,7 @@ def list_query_results_for_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyTrackedResourcesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyTrackedResourcesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyTrackedResourcesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -285,7 +285,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -299,9 +299,9 @@ async def get_next(next_link=None): def list_query_results_for_resource( self, resource_id: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.PolicyTrackedResourcesQueryResults"]: + ) -> AsyncIterable["_models.PolicyTrackedResourcesQueryResults"]: """Queries policy tracked resources under the resource. :param resource_id: Resource ID. @@ -313,7 +313,7 @@ def list_query_results_for_resource( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.PolicyTrackedResourcesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyTrackedResourcesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyTrackedResourcesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -370,7 +370,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_remediations_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_remediations_operations.py index f3b836a04eaf..60c530affebd 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_remediations_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_remediations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class RemediationsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,9 +45,9 @@ def list_deployments_at_management_group( self, management_group_id: str, remediation_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.RemediationDeploymentsListResult"]: + ) -> AsyncIterable["_models.RemediationDeploymentsListResult"]: """Gets all deployments for a remediation at management group scope. :param management_group_id: Management group ID. @@ -61,7 +61,7 @@ def list_deployments_at_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.RemediationDeploymentsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RemediationDeploymentsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RemediationDeploymentsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -115,7 +115,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -131,7 +131,7 @@ async def cancel_at_management_group( management_group_id: str, remediation_name: str, **kwargs - ) -> "models.Remediation": + ) -> "_models.Remediation": """Cancels a remediation at management group scope. :param management_group_id: Management group ID. @@ -143,7 +143,7 @@ async def cancel_at_management_group( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -175,7 +175,7 @@ async def cancel_at_management_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -189,9 +189,9 @@ async def cancel_at_management_group( def list_for_management_group( self, management_group_id: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.RemediationListResult"]: + ) -> AsyncIterable["_models.RemediationListResult"]: """Gets all remediations for the management group. :param management_group_id: Management group ID. @@ -203,7 +203,7 @@ def list_for_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.RemediationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RemediationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RemediationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -260,7 +260,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -275,9 +275,9 @@ async def create_or_update_at_management_group( self, management_group_id: str, remediation_name: str, - parameters: "models.Remediation", + parameters: "_models.Remediation", **kwargs - ) -> "models.Remediation": + ) -> "_models.Remediation": """Creates or updates a remediation at management group scope. :param management_group_id: Management group ID. @@ -291,7 +291,7 @@ async def create_or_update_at_management_group( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -328,7 +328,7 @@ async def create_or_update_at_management_group( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -348,7 +348,7 @@ async def get_at_management_group( management_group_id: str, remediation_name: str, **kwargs - ) -> "models.Remediation": + ) -> "_models.Remediation": """Gets an existing remediation at management group scope. :param management_group_id: Management group ID. @@ -360,7 +360,7 @@ async def get_at_management_group( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -392,7 +392,7 @@ async def get_at_management_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -408,7 +408,7 @@ async def delete_at_management_group( management_group_id: str, remediation_name: str, **kwargs - ) -> Optional["models.Remediation"]: + ) -> Optional["_models.Remediation"]: """Deletes an existing remediation at management group scope. :param management_group_id: Management group ID. @@ -420,7 +420,7 @@ async def delete_at_management_group( :rtype: ~azure.mgmt.policyinsights.models.Remediation or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Remediation"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Remediation"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -452,7 +452,7 @@ async def delete_at_management_group( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -468,9 +468,9 @@ async def delete_at_management_group( def list_deployments_at_subscription( self, remediation_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.RemediationDeploymentsListResult"]: + ) -> AsyncIterable["_models.RemediationDeploymentsListResult"]: """Gets all deployments for a remediation at subscription scope. :param remediation_name: The name of the remediation. @@ -482,7 +482,7 @@ def list_deployments_at_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.RemediationDeploymentsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RemediationDeploymentsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RemediationDeploymentsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -534,7 +534,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -549,7 +549,7 @@ async def cancel_at_subscription( self, remediation_name: str, **kwargs - ) -> "models.Remediation": + ) -> "_models.Remediation": """Cancels a remediation at subscription scope. :param remediation_name: The name of the remediation. @@ -559,7 +559,7 @@ async def cancel_at_subscription( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -589,7 +589,7 @@ async def cancel_at_subscription( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -602,9 +602,9 @@ async def cancel_at_subscription( def list_for_subscription( self, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.RemediationListResult"]: + ) -> AsyncIterable["_models.RemediationListResult"]: """Gets all remediations for the subscription. :param query_options: Parameter group. @@ -614,7 +614,7 @@ def list_for_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.RemediationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RemediationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RemediationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -669,7 +669,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -683,9 +683,9 @@ async def get_next(next_link=None): async def create_or_update_at_subscription( self, remediation_name: str, - parameters: "models.Remediation", + parameters: "_models.Remediation", **kwargs - ) -> "models.Remediation": + ) -> "_models.Remediation": """Creates or updates a remediation at subscription scope. :param remediation_name: The name of the remediation. @@ -697,7 +697,7 @@ async def create_or_update_at_subscription( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -732,7 +732,7 @@ async def create_or_update_at_subscription( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -751,7 +751,7 @@ async def get_at_subscription( self, remediation_name: str, **kwargs - ) -> "models.Remediation": + ) -> "_models.Remediation": """Gets an existing remediation at subscription scope. :param remediation_name: The name of the remediation. @@ -761,7 +761,7 @@ async def get_at_subscription( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -791,7 +791,7 @@ async def get_at_subscription( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -806,7 +806,7 @@ async def delete_at_subscription( self, remediation_name: str, **kwargs - ) -> Optional["models.Remediation"]: + ) -> Optional["_models.Remediation"]: """Deletes an existing remediation at subscription scope. :param remediation_name: The name of the remediation. @@ -816,7 +816,7 @@ async def delete_at_subscription( :rtype: ~azure.mgmt.policyinsights.models.Remediation or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Remediation"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Remediation"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -846,7 +846,7 @@ async def delete_at_subscription( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -863,9 +863,9 @@ def list_deployments_at_resource_group( self, resource_group_name: str, remediation_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.RemediationDeploymentsListResult"]: + ) -> AsyncIterable["_models.RemediationDeploymentsListResult"]: """Gets all deployments for a remediation at resource group scope. :param resource_group_name: Resource group name. @@ -879,7 +879,7 @@ def list_deployments_at_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.RemediationDeploymentsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RemediationDeploymentsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RemediationDeploymentsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -932,7 +932,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -948,7 +948,7 @@ async def cancel_at_resource_group( resource_group_name: str, remediation_name: str, **kwargs - ) -> "models.Remediation": + ) -> "_models.Remediation": """Cancels a remediation at resource group scope. :param resource_group_name: Resource group name. @@ -960,7 +960,7 @@ async def cancel_at_resource_group( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -991,7 +991,7 @@ async def cancel_at_resource_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -1005,9 +1005,9 @@ async def cancel_at_resource_group( def list_for_resource_group( self, resource_group_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.RemediationListResult"]: + ) -> AsyncIterable["_models.RemediationListResult"]: """Gets all remediations for the subscription. :param resource_group_name: Resource group name. @@ -1019,7 +1019,7 @@ def list_for_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.RemediationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RemediationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RemediationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1075,7 +1075,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1090,9 +1090,9 @@ async def create_or_update_at_resource_group( self, resource_group_name: str, remediation_name: str, - parameters: "models.Remediation", + parameters: "_models.Remediation", **kwargs - ) -> "models.Remediation": + ) -> "_models.Remediation": """Creates or updates a remediation at resource group scope. :param resource_group_name: Resource group name. @@ -1106,7 +1106,7 @@ async def create_or_update_at_resource_group( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1142,7 +1142,7 @@ async def create_or_update_at_resource_group( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -1162,7 +1162,7 @@ async def get_at_resource_group( resource_group_name: str, remediation_name: str, **kwargs - ) -> "models.Remediation": + ) -> "_models.Remediation": """Gets an existing remediation at resource group scope. :param resource_group_name: Resource group name. @@ -1174,7 +1174,7 @@ async def get_at_resource_group( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1205,7 +1205,7 @@ async def get_at_resource_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -1221,7 +1221,7 @@ async def delete_at_resource_group( resource_group_name: str, remediation_name: str, **kwargs - ) -> Optional["models.Remediation"]: + ) -> Optional["_models.Remediation"]: """Deletes an existing remediation at resource group scope. :param resource_group_name: Resource group name. @@ -1233,7 +1233,7 @@ async def delete_at_resource_group( :rtype: ~azure.mgmt.policyinsights.models.Remediation or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Remediation"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Remediation"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1264,7 +1264,7 @@ async def delete_at_resource_group( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -1281,9 +1281,9 @@ def list_deployments_at_resource( self, resource_id: str, remediation_name: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.RemediationDeploymentsListResult"]: + ) -> AsyncIterable["_models.RemediationDeploymentsListResult"]: """Gets all deployments for a remediation at resource scope. :param resource_id: Resource ID. @@ -1297,7 +1297,7 @@ def list_deployments_at_resource( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.RemediationDeploymentsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RemediationDeploymentsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RemediationDeploymentsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1349,7 +1349,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1365,7 +1365,7 @@ async def cancel_at_resource( resource_id: str, remediation_name: str, **kwargs - ) -> "models.Remediation": + ) -> "_models.Remediation": """Cancel a remediation at resource scope. :param resource_id: Resource ID. @@ -1377,7 +1377,7 @@ async def cancel_at_resource( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1407,7 +1407,7 @@ async def cancel_at_resource( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -1421,9 +1421,9 @@ async def cancel_at_resource( def list_for_resource( self, resource_id: str, - query_options: Optional["models.QueryOptions"] = None, + query_options: Optional["_models.QueryOptions"] = None, **kwargs - ) -> AsyncIterable["models.RemediationListResult"]: + ) -> AsyncIterable["_models.RemediationListResult"]: """Gets all remediations for a resource. :param resource_id: Resource ID. @@ -1435,7 +1435,7 @@ def list_for_resource( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.RemediationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RemediationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RemediationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1490,7 +1490,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1505,9 +1505,9 @@ async def create_or_update_at_resource( self, resource_id: str, remediation_name: str, - parameters: "models.Remediation", + parameters: "_models.Remediation", **kwargs - ) -> "models.Remediation": + ) -> "_models.Remediation": """Creates or updates a remediation at resource scope. :param resource_id: Resource ID. @@ -1521,7 +1521,7 @@ async def create_or_update_at_resource( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1556,7 +1556,7 @@ async def create_or_update_at_resource( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -1576,7 +1576,7 @@ async def get_at_resource( resource_id: str, remediation_name: str, **kwargs - ) -> "models.Remediation": + ) -> "_models.Remediation": """Gets an existing remediation at resource scope. :param resource_id: Resource ID. @@ -1588,7 +1588,7 @@ async def get_at_resource( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1618,7 +1618,7 @@ async def get_at_resource( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -1634,7 +1634,7 @@ async def delete_at_resource( resource_id: str, remediation_name: str, **kwargs - ) -> Optional["models.Remediation"]: + ) -> Optional["_models.Remediation"]: """Deletes an existing remediation at individual resource scope. :param resource_id: Resource ID. @@ -1646,7 +1646,7 @@ async def delete_at_resource( :rtype: ~azure.mgmt.policyinsights.models.Remediation or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Remediation"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Remediation"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1676,7 +1676,7 @@ async def delete_at_resource( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/__init__.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/__init__.py index 818a66829a35..a50103be3989 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/__init__.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/__init__.py @@ -7,6 +7,10 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import CheckRestrictionsRequest + from ._models_py3 import CheckRestrictionsResourceDetails + from ._models_py3 import CheckRestrictionsResult + from ._models_py3 import CheckRestrictionsResultContentEvaluationResult from ._models_py3 import ComplianceDetail from ._models_py3 import ComponentEventDetails from ._models_py3 import ComponentStateDetails @@ -15,14 +19,18 @@ from ._models_py3 import ErrorResponse from ._models_py3 import ErrorResponseAutoGenerated from ._models_py3 import ExpressionEvaluationDetails + from ._models_py3 import FieldRestriction + from ._models_py3 import FieldRestrictions from ._models_py3 import IfNotExistsEvaluationDetails from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationsListResults + from ._models_py3 import PendingField from ._models_py3 import PolicyAssignmentSummary from ._models_py3 import PolicyDefinitionSummary from ._models_py3 import PolicyDetails from ._models_py3 import PolicyEvaluationDetails + from ._models_py3 import PolicyEvaluationResult from ._models_py3 import PolicyEvent from ._models_py3 import PolicyEventsQueryResults from ._models_py3 import PolicyGroupSummary @@ -30,6 +38,7 @@ from ._models_py3 import PolicyMetadataCollection from ._models_py3 import PolicyMetadataProperties from ._models_py3 import PolicyMetadataSlimProperties + from ._models_py3 import PolicyReference from ._models_py3 import PolicyState from ._models_py3 import PolicyStatesQueryResults from ._models_py3 import PolicyTrackedResource @@ -50,6 +59,10 @@ from ._models_py3 import TrackedResourceModificationDetails from ._models_py3 import TypedErrorInfo except (SyntaxError, ImportError): + from ._models import CheckRestrictionsRequest # type: ignore + from ._models import CheckRestrictionsResourceDetails # type: ignore + from ._models import CheckRestrictionsResult # type: ignore + from ._models import CheckRestrictionsResultContentEvaluationResult # type: ignore from ._models import ComplianceDetail # type: ignore from ._models import ComponentEventDetails # type: ignore from ._models import ComponentStateDetails # type: ignore @@ -58,14 +71,18 @@ from ._models import ErrorResponse # type: ignore from ._models import ErrorResponseAutoGenerated # type: ignore from ._models import ExpressionEvaluationDetails # type: ignore + from ._models import FieldRestriction # type: ignore + from ._models import FieldRestrictions # type: ignore from ._models import IfNotExistsEvaluationDetails # type: ignore from ._models import Operation # type: ignore from ._models import OperationDisplay # type: ignore from ._models import OperationsListResults # type: ignore + from ._models import PendingField # type: ignore from ._models import PolicyAssignmentSummary # type: ignore from ._models import PolicyDefinitionSummary # type: ignore from ._models import PolicyDetails # type: ignore from ._models import PolicyEvaluationDetails # type: ignore + from ._models import PolicyEvaluationResult # type: ignore from ._models import PolicyEvent # type: ignore from ._models import PolicyEventsQueryResults # type: ignore from ._models import PolicyGroupSummary # type: ignore @@ -73,6 +90,7 @@ from ._models import PolicyMetadataCollection # type: ignore from ._models import PolicyMetadataProperties # type: ignore from ._models import PolicyMetadataSlimProperties # type: ignore + from ._models import PolicyReference # type: ignore from ._models import PolicyState # type: ignore from ._models import PolicyStatesQueryResults # type: ignore from ._models import PolicyTrackedResource # type: ignore @@ -94,11 +112,16 @@ from ._models import TypedErrorInfo # type: ignore from ._policy_insights_client_enums import ( + FieldRestrictionResult, PolicyStatesResource, ResourceDiscoveryMode, ) __all__ = [ + 'CheckRestrictionsRequest', + 'CheckRestrictionsResourceDetails', + 'CheckRestrictionsResult', + 'CheckRestrictionsResultContentEvaluationResult', 'ComplianceDetail', 'ComponentEventDetails', 'ComponentStateDetails', @@ -107,14 +130,18 @@ 'ErrorResponse', 'ErrorResponseAutoGenerated', 'ExpressionEvaluationDetails', + 'FieldRestriction', + 'FieldRestrictions', 'IfNotExistsEvaluationDetails', 'Operation', 'OperationDisplay', 'OperationsListResults', + 'PendingField', 'PolicyAssignmentSummary', 'PolicyDefinitionSummary', 'PolicyDetails', 'PolicyEvaluationDetails', + 'PolicyEvaluationResult', 'PolicyEvent', 'PolicyEventsQueryResults', 'PolicyGroupSummary', @@ -122,6 +149,7 @@ 'PolicyMetadataCollection', 'PolicyMetadataProperties', 'PolicyMetadataSlimProperties', + 'PolicyReference', 'PolicyState', 'PolicyStatesQueryResults', 'PolicyTrackedResource', @@ -141,6 +169,7 @@ 'SummaryResults', 'TrackedResourceModificationDetails', 'TypedErrorInfo', + 'FieldRestrictionResult', 'PolicyStatesResource', 'ResourceDiscoveryMode', ] diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_models.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_models.py index 2c3ed5118396..3129367f2ef0 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_models.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_models.py @@ -10,6 +10,123 @@ import msrest.serialization +class CheckRestrictionsRequest(msrest.serialization.Model): + """The check policy restrictions parameters describing the resource that is being evaluated. + + All required parameters must be populated in order to send to Azure. + + :param resource_details: Required. The information about the resource that will be evaluated. + :type resource_details: ~azure.mgmt.policyinsights.models.CheckRestrictionsResourceDetails + :param pending_fields: The list of fields and values that should be evaluated for potential + restrictions. + :type pending_fields: list[~azure.mgmt.policyinsights.models.PendingField] + """ + + _validation = { + 'resource_details': {'required': True}, + } + + _attribute_map = { + 'resource_details': {'key': 'resourceDetails', 'type': 'CheckRestrictionsResourceDetails'}, + 'pending_fields': {'key': 'pendingFields', 'type': '[PendingField]'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckRestrictionsRequest, self).__init__(**kwargs) + self.resource_details = kwargs['resource_details'] + self.pending_fields = kwargs.get('pending_fields', None) + + +class CheckRestrictionsResourceDetails(msrest.serialization.Model): + """The information about the resource that will be evaluated. + + All required parameters must be populated in order to send to Azure. + + :param resource_content: Required. The resource content. This should include whatever + properties are already known and can be a partial set of all resource properties. + :type resource_content: object + :param api_version: The api-version of the resource content. + :type api_version: str + :param scope: The scope where the resource is being created. For example, if the resource is a + child resource this would be the parent resource's resource ID. + :type scope: str + """ + + _validation = { + 'resource_content': {'required': True}, + } + + _attribute_map = { + 'resource_content': {'key': 'resourceContent', 'type': 'object'}, + 'api_version': {'key': 'apiVersion', 'type': 'str'}, + 'scope': {'key': 'scope', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckRestrictionsResourceDetails, self).__init__(**kwargs) + self.resource_content = kwargs['resource_content'] + self.api_version = kwargs.get('api_version', None) + self.scope = kwargs.get('scope', None) + + +class CheckRestrictionsResult(msrest.serialization.Model): + """The result of a check policy restrictions evaluation on a resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar field_restrictions: The restrictions that will be placed on various fields in the + resource by policy. + :vartype field_restrictions: list[~azure.mgmt.policyinsights.models.FieldRestrictions] + :ivar content_evaluation_result: Evaluation results for the provided partial resource content. + :vartype content_evaluation_result: + ~azure.mgmt.policyinsights.models.CheckRestrictionsResultContentEvaluationResult + """ + + _validation = { + 'field_restrictions': {'readonly': True}, + 'content_evaluation_result': {'readonly': True}, + } + + _attribute_map = { + 'field_restrictions': {'key': 'fieldRestrictions', 'type': '[FieldRestrictions]'}, + 'content_evaluation_result': {'key': 'contentEvaluationResult', 'type': 'CheckRestrictionsResultContentEvaluationResult'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckRestrictionsResult, self).__init__(**kwargs) + self.field_restrictions = None + self.content_evaluation_result = None + + +class CheckRestrictionsResultContentEvaluationResult(msrest.serialization.Model): + """Evaluation results for the provided partial resource content. + + :param policy_evaluations: Policy evaluation results against the given resource content. This + will indicate if the partial content that was provided will be denied as-is. + :type policy_evaluations: list[~azure.mgmt.policyinsights.models.PolicyEvaluationResult] + """ + + _attribute_map = { + 'policy_evaluations': {'key': 'policyEvaluations', 'type': '[PolicyEvaluationResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckRestrictionsResultContentEvaluationResult, self).__init__(**kwargs) + self.policy_evaluations = kwargs.get('policy_evaluations', None) + + class ComplianceDetail(msrest.serialization.Model): """The compliance state rollup. @@ -253,10 +370,14 @@ def __init__( class ExpressionEvaluationDetails(msrest.serialization.Model): """Evaluation details of policy language expressions. + Variables are only populated by the server, and will be ignored when sending a request. + :param result: Evaluation result. :type result: str :param expression: Expression evaluated. :type expression: str + :ivar expression_kind: The kind of expression that was evaluated. + :vartype expression_kind: str :param path: Property path if the expression is a field or an alias. :type path: str :param expression_value: Value of the expression. @@ -267,9 +388,14 @@ class ExpressionEvaluationDetails(msrest.serialization.Model): :type operator: str """ + _validation = { + 'expression_kind': {'readonly': True}, + } + _attribute_map = { 'result': {'key': 'result', 'type': 'str'}, 'expression': {'key': 'expression', 'type': 'str'}, + 'expression_kind': {'key': 'expressionKind', 'type': 'str'}, 'path': {'key': 'path', 'type': 'str'}, 'expression_value': {'key': 'expressionValue', 'type': 'object'}, 'target_value': {'key': 'targetValue', 'type': 'object'}, @@ -283,12 +409,85 @@ def __init__( super(ExpressionEvaluationDetails, self).__init__(**kwargs) self.result = kwargs.get('result', None) self.expression = kwargs.get('expression', None) + self.expression_kind = None self.path = kwargs.get('path', None) self.expression_value = kwargs.get('expression_value', None) self.target_value = kwargs.get('target_value', None) self.operator = kwargs.get('operator', None) +class FieldRestriction(msrest.serialization.Model): + """The restrictions on a field imposed by a specific policy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar result: The type of restriction that is imposed on the field. Possible values include: + "Required", "Removed", "Deny". + :vartype result: str or ~azure.mgmt.policyinsights.models.FieldRestrictionResult + :ivar default_value: The value that policy will set for the field if the user does not provide + a value. + :vartype default_value: str + :ivar values: The values that policy either requires or denies for the field. + :vartype values: list[str] + :ivar policy: The details of the policy that is causing the field restriction. + :vartype policy: ~azure.mgmt.policyinsights.models.PolicyReference + """ + + _validation = { + 'result': {'readonly': True}, + 'default_value': {'readonly': True}, + 'values': {'readonly': True}, + 'policy': {'readonly': True}, + } + + _attribute_map = { + 'result': {'key': 'result', 'type': 'str'}, + 'default_value': {'key': 'defaultValue', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + 'policy': {'key': 'policy', 'type': 'PolicyReference'}, + } + + def __init__( + self, + **kwargs + ): + super(FieldRestriction, self).__init__(**kwargs) + self.result = None + self.default_value = None + self.values = None + self.policy = None + + +class FieldRestrictions(msrest.serialization.Model): + """The restrictions that will be placed on a field in the resource by policy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar field: The name of the field. This can be a top-level property like 'name' or 'type' or + an Azure Policy field alias. + :vartype field: str + :param restrictions: The restrictions placed on that field by policy. + :type restrictions: list[~azure.mgmt.policyinsights.models.FieldRestriction] + """ + + _validation = { + 'field': {'readonly': True}, + } + + _attribute_map = { + 'field': {'key': 'field', 'type': 'str'}, + 'restrictions': {'key': 'restrictions', 'type': '[FieldRestriction]'}, + } + + def __init__( + self, + **kwargs + ): + super(FieldRestrictions, self).__init__(**kwargs) + self.field = None + self.restrictions = kwargs.get('restrictions', None) + + class IfNotExistsEvaluationDetails(msrest.serialization.Model): """Evaluation details of IfNotExists effect. @@ -394,6 +593,37 @@ def __init__( self.value = kwargs.get('value', None) +class PendingField(msrest.serialization.Model): + """A field that should be evaluated against Azure Policy to determine restrictions. + + All required parameters must be populated in order to send to Azure. + + :param field: Required. The name of the field. This can be a top-level property like 'name' or + 'type' or an Azure Policy field alias. + :type field: str + :param values: The list of potential values for the field that should be evaluated against + Azure Policy. + :type values: list[str] + """ + + _validation = { + 'field': {'required': True}, + } + + _attribute_map = { + 'field': {'key': 'field', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PendingField, self).__init__(**kwargs) + self.field = kwargs['field'] + self.values = kwargs.get('values', None) + + class PolicyAssignmentSummary(msrest.serialization.Model): """Policy assignment summary. @@ -540,6 +770,43 @@ def __init__( self.if_not_exists_details = kwargs.get('if_not_exists_details', None) +class PolicyEvaluationResult(msrest.serialization.Model): + """The result of a non-compliant policy evaluation against the given resource content. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar policy_info: The details of the policy that was evaluated. + :vartype policy_info: ~azure.mgmt.policyinsights.models.PolicyReference + :ivar evaluation_result: The result of the policy evaluation against the resource. This will + typically be 'NonCompliant' but may contain other values if errors were encountered. + :vartype evaluation_result: str + :ivar evaluation_details: The detailed results of the policy expressions and values that were + evaluated. + :vartype evaluation_details: ~azure.mgmt.policyinsights.models.PolicyEvaluationDetails + """ + + _validation = { + 'policy_info': {'readonly': True}, + 'evaluation_result': {'readonly': True}, + 'evaluation_details': {'readonly': True}, + } + + _attribute_map = { + 'policy_info': {'key': 'policyInfo', 'type': 'PolicyReference'}, + 'evaluation_result': {'key': 'evaluationResult', 'type': 'str'}, + 'evaluation_details': {'key': 'evaluationDetails', 'type': 'PolicyEvaluationDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(PolicyEvaluationResult, self).__init__(**kwargs) + self.policy_info = None + self.evaluation_result = None + self.evaluation_details = None + + class PolicyEvent(msrest.serialization.Model): """Policy event record. @@ -964,6 +1231,47 @@ def __init__( self.requirements = None +class PolicyReference(msrest.serialization.Model): + """Resource identifiers for a policy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar policy_definition_id: The resource identifier of the policy definition. + :vartype policy_definition_id: str + :ivar policy_set_definition_id: The resource identifier of the policy set definition. + :vartype policy_set_definition_id: str + :ivar policy_definition_reference_id: The reference identifier of a specific policy definition + within a policy set definition. + :vartype policy_definition_reference_id: str + :ivar policy_assignment_id: The resource identifier of the policy assignment. + :vartype policy_assignment_id: str + """ + + _validation = { + 'policy_definition_id': {'readonly': True}, + 'policy_set_definition_id': {'readonly': True}, + 'policy_definition_reference_id': {'readonly': True}, + 'policy_assignment_id': {'readonly': True}, + } + + _attribute_map = { + 'policy_definition_id': {'key': 'policyDefinitionId', 'type': 'str'}, + 'policy_set_definition_id': {'key': 'policySetDefinitionId', 'type': 'str'}, + 'policy_definition_reference_id': {'key': 'policyDefinitionReferenceId', 'type': 'str'}, + 'policy_assignment_id': {'key': 'policyAssignmentId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PolicyReference, self).__init__(**kwargs) + self.policy_definition_id = None + self.policy_set_definition_id = None + self.policy_definition_reference_id = None + self.policy_assignment_id = None + + class PolicyState(msrest.serialization.Model): """Policy state record. diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_models_py3.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_models_py3.py index 322766d60a6a..e2f211c86063 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_models_py3.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_models_py3.py @@ -15,6 +15,132 @@ from ._policy_insights_client_enums import * +class CheckRestrictionsRequest(msrest.serialization.Model): + """The check policy restrictions parameters describing the resource that is being evaluated. + + All required parameters must be populated in order to send to Azure. + + :param resource_details: Required. The information about the resource that will be evaluated. + :type resource_details: ~azure.mgmt.policyinsights.models.CheckRestrictionsResourceDetails + :param pending_fields: The list of fields and values that should be evaluated for potential + restrictions. + :type pending_fields: list[~azure.mgmt.policyinsights.models.PendingField] + """ + + _validation = { + 'resource_details': {'required': True}, + } + + _attribute_map = { + 'resource_details': {'key': 'resourceDetails', 'type': 'CheckRestrictionsResourceDetails'}, + 'pending_fields': {'key': 'pendingFields', 'type': '[PendingField]'}, + } + + def __init__( + self, + *, + resource_details: "CheckRestrictionsResourceDetails", + pending_fields: Optional[List["PendingField"]] = None, + **kwargs + ): + super(CheckRestrictionsRequest, self).__init__(**kwargs) + self.resource_details = resource_details + self.pending_fields = pending_fields + + +class CheckRestrictionsResourceDetails(msrest.serialization.Model): + """The information about the resource that will be evaluated. + + All required parameters must be populated in order to send to Azure. + + :param resource_content: Required. The resource content. This should include whatever + properties are already known and can be a partial set of all resource properties. + :type resource_content: object + :param api_version: The api-version of the resource content. + :type api_version: str + :param scope: The scope where the resource is being created. For example, if the resource is a + child resource this would be the parent resource's resource ID. + :type scope: str + """ + + _validation = { + 'resource_content': {'required': True}, + } + + _attribute_map = { + 'resource_content': {'key': 'resourceContent', 'type': 'object'}, + 'api_version': {'key': 'apiVersion', 'type': 'str'}, + 'scope': {'key': 'scope', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_content: object, + api_version: Optional[str] = None, + scope: Optional[str] = None, + **kwargs + ): + super(CheckRestrictionsResourceDetails, self).__init__(**kwargs) + self.resource_content = resource_content + self.api_version = api_version + self.scope = scope + + +class CheckRestrictionsResult(msrest.serialization.Model): + """The result of a check policy restrictions evaluation on a resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar field_restrictions: The restrictions that will be placed on various fields in the + resource by policy. + :vartype field_restrictions: list[~azure.mgmt.policyinsights.models.FieldRestrictions] + :ivar content_evaluation_result: Evaluation results for the provided partial resource content. + :vartype content_evaluation_result: + ~azure.mgmt.policyinsights.models.CheckRestrictionsResultContentEvaluationResult + """ + + _validation = { + 'field_restrictions': {'readonly': True}, + 'content_evaluation_result': {'readonly': True}, + } + + _attribute_map = { + 'field_restrictions': {'key': 'fieldRestrictions', 'type': '[FieldRestrictions]'}, + 'content_evaluation_result': {'key': 'contentEvaluationResult', 'type': 'CheckRestrictionsResultContentEvaluationResult'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckRestrictionsResult, self).__init__(**kwargs) + self.field_restrictions = None + self.content_evaluation_result = None + + +class CheckRestrictionsResultContentEvaluationResult(msrest.serialization.Model): + """Evaluation results for the provided partial resource content. + + :param policy_evaluations: Policy evaluation results against the given resource content. This + will indicate if the partial content that was provided will be denied as-is. + :type policy_evaluations: list[~azure.mgmt.policyinsights.models.PolicyEvaluationResult] + """ + + _attribute_map = { + 'policy_evaluations': {'key': 'policyEvaluations', 'type': '[PolicyEvaluationResult]'}, + } + + def __init__( + self, + *, + policy_evaluations: Optional[List["PolicyEvaluationResult"]] = None, + **kwargs + ): + super(CheckRestrictionsResultContentEvaluationResult, self).__init__(**kwargs) + self.policy_evaluations = policy_evaluations + + class ComplianceDetail(msrest.serialization.Model): """The compliance state rollup. @@ -281,10 +407,14 @@ def __init__( class ExpressionEvaluationDetails(msrest.serialization.Model): """Evaluation details of policy language expressions. + Variables are only populated by the server, and will be ignored when sending a request. + :param result: Evaluation result. :type result: str :param expression: Expression evaluated. :type expression: str + :ivar expression_kind: The kind of expression that was evaluated. + :vartype expression_kind: str :param path: Property path if the expression is a field or an alias. :type path: str :param expression_value: Value of the expression. @@ -295,9 +425,14 @@ class ExpressionEvaluationDetails(msrest.serialization.Model): :type operator: str """ + _validation = { + 'expression_kind': {'readonly': True}, + } + _attribute_map = { 'result': {'key': 'result', 'type': 'str'}, 'expression': {'key': 'expression', 'type': 'str'}, + 'expression_kind': {'key': 'expressionKind', 'type': 'str'}, 'path': {'key': 'path', 'type': 'str'}, 'expression_value': {'key': 'expressionValue', 'type': 'object'}, 'target_value': {'key': 'targetValue', 'type': 'object'}, @@ -318,12 +453,87 @@ def __init__( super(ExpressionEvaluationDetails, self).__init__(**kwargs) self.result = result self.expression = expression + self.expression_kind = None self.path = path self.expression_value = expression_value self.target_value = target_value self.operator = operator +class FieldRestriction(msrest.serialization.Model): + """The restrictions on a field imposed by a specific policy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar result: The type of restriction that is imposed on the field. Possible values include: + "Required", "Removed", "Deny". + :vartype result: str or ~azure.mgmt.policyinsights.models.FieldRestrictionResult + :ivar default_value: The value that policy will set for the field if the user does not provide + a value. + :vartype default_value: str + :ivar values: The values that policy either requires or denies for the field. + :vartype values: list[str] + :ivar policy: The details of the policy that is causing the field restriction. + :vartype policy: ~azure.mgmt.policyinsights.models.PolicyReference + """ + + _validation = { + 'result': {'readonly': True}, + 'default_value': {'readonly': True}, + 'values': {'readonly': True}, + 'policy': {'readonly': True}, + } + + _attribute_map = { + 'result': {'key': 'result', 'type': 'str'}, + 'default_value': {'key': 'defaultValue', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + 'policy': {'key': 'policy', 'type': 'PolicyReference'}, + } + + def __init__( + self, + **kwargs + ): + super(FieldRestriction, self).__init__(**kwargs) + self.result = None + self.default_value = None + self.values = None + self.policy = None + + +class FieldRestrictions(msrest.serialization.Model): + """The restrictions that will be placed on a field in the resource by policy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar field: The name of the field. This can be a top-level property like 'name' or 'type' or + an Azure Policy field alias. + :vartype field: str + :param restrictions: The restrictions placed on that field by policy. + :type restrictions: list[~azure.mgmt.policyinsights.models.FieldRestriction] + """ + + _validation = { + 'field': {'readonly': True}, + } + + _attribute_map = { + 'field': {'key': 'field', 'type': 'str'}, + 'restrictions': {'key': 'restrictions', 'type': '[FieldRestriction]'}, + } + + def __init__( + self, + *, + restrictions: Optional[List["FieldRestriction"]] = None, + **kwargs + ): + super(FieldRestrictions, self).__init__(**kwargs) + self.field = None + self.restrictions = restrictions + + class IfNotExistsEvaluationDetails(msrest.serialization.Model): """Evaluation details of IfNotExists effect. @@ -443,6 +653,40 @@ def __init__( self.value = value +class PendingField(msrest.serialization.Model): + """A field that should be evaluated against Azure Policy to determine restrictions. + + All required parameters must be populated in order to send to Azure. + + :param field: Required. The name of the field. This can be a top-level property like 'name' or + 'type' or an Azure Policy field alias. + :type field: str + :param values: The list of potential values for the field that should be evaluated against + Azure Policy. + :type values: list[str] + """ + + _validation = { + 'field': {'required': True}, + } + + _attribute_map = { + 'field': {'key': 'field', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__( + self, + *, + field: str, + values: Optional[List[str]] = None, + **kwargs + ): + super(PendingField, self).__init__(**kwargs) + self.field = field + self.values = values + + class PolicyAssignmentSummary(msrest.serialization.Model): """Policy assignment summary. @@ -604,6 +848,43 @@ def __init__( self.if_not_exists_details = if_not_exists_details +class PolicyEvaluationResult(msrest.serialization.Model): + """The result of a non-compliant policy evaluation against the given resource content. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar policy_info: The details of the policy that was evaluated. + :vartype policy_info: ~azure.mgmt.policyinsights.models.PolicyReference + :ivar evaluation_result: The result of the policy evaluation against the resource. This will + typically be 'NonCompliant' but may contain other values if errors were encountered. + :vartype evaluation_result: str + :ivar evaluation_details: The detailed results of the policy expressions and values that were + evaluated. + :vartype evaluation_details: ~azure.mgmt.policyinsights.models.PolicyEvaluationDetails + """ + + _validation = { + 'policy_info': {'readonly': True}, + 'evaluation_result': {'readonly': True}, + 'evaluation_details': {'readonly': True}, + } + + _attribute_map = { + 'policy_info': {'key': 'policyInfo', 'type': 'PolicyReference'}, + 'evaluation_result': {'key': 'evaluationResult', 'type': 'str'}, + 'evaluation_details': {'key': 'evaluationDetails', 'type': 'PolicyEvaluationDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(PolicyEvaluationResult, self).__init__(**kwargs) + self.policy_info = None + self.evaluation_result = None + self.evaluation_details = None + + class PolicyEvent(msrest.serialization.Model): """Policy event record. @@ -1069,6 +1350,47 @@ def __init__( self.requirements = None +class PolicyReference(msrest.serialization.Model): + """Resource identifiers for a policy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar policy_definition_id: The resource identifier of the policy definition. + :vartype policy_definition_id: str + :ivar policy_set_definition_id: The resource identifier of the policy set definition. + :vartype policy_set_definition_id: str + :ivar policy_definition_reference_id: The reference identifier of a specific policy definition + within a policy set definition. + :vartype policy_definition_reference_id: str + :ivar policy_assignment_id: The resource identifier of the policy assignment. + :vartype policy_assignment_id: str + """ + + _validation = { + 'policy_definition_id': {'readonly': True}, + 'policy_set_definition_id': {'readonly': True}, + 'policy_definition_reference_id': {'readonly': True}, + 'policy_assignment_id': {'readonly': True}, + } + + _attribute_map = { + 'policy_definition_id': {'key': 'policyDefinitionId', 'type': 'str'}, + 'policy_set_definition_id': {'key': 'policySetDefinitionId', 'type': 'str'}, + 'policy_definition_reference_id': {'key': 'policyDefinitionReferenceId', 'type': 'str'}, + 'policy_assignment_id': {'key': 'policyAssignmentId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PolicyReference, self).__init__(**kwargs) + self.policy_definition_id = None + self.policy_set_definition_id = None + self.policy_definition_reference_id = None + self.policy_assignment_id = None + + class PolicyState(msrest.serialization.Model): """Policy state record. diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_policy_insights_client_enums.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_policy_insights_client_enums.py index ea72fee2c682..e713fd7f9e3c 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_policy_insights_client_enums.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_policy_insights_client_enums.py @@ -26,6 +26,14 @@ def __getattr__(cls, name): raise AttributeError(name) +class FieldRestrictionResult(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of restriction that is imposed on the field. + """ + + REQUIRED = "Required" #: The field and/or values are required by policy. + REMOVED = "Removed" #: The field will be removed by policy. + DENY = "Deny" #: The field and/or values will be denied by policy. + class PolicyStatesResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/__init__.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/__init__.py index 33f195700122..4bbdef723768 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/__init__.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/__init__.py @@ -12,6 +12,7 @@ from ._policy_states_operations import PolicyStatesOperations from ._operations import Operations from ._policy_metadata_operations import PolicyMetadataOperations +from ._policy_restrictions_operations import PolicyRestrictionsOperations __all__ = [ 'PolicyTrackedResourcesOperations', @@ -20,4 +21,5 @@ 'PolicyStatesOperations', 'Operations', 'PolicyMetadataOperations', + 'PolicyRestrictionsOperations', ] diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_operations.py index 6dd6215f5e71..20eb9c00c20a 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,7 +48,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> "models.OperationsListResults" + # type: (...) -> "_models.OperationsListResults" """Lists available operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -56,7 +56,7 @@ def list( :rtype: ~azure.mgmt.policyinsights.models.OperationsListResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationsListResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsListResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -81,7 +81,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationsListResults', pipeline_response) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_events_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_events_operations.py index 52acc67c30e4..f0b43e3d10c5 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_events_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_events_operations.py @@ -15,7 +15,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -38,7 +38,7 @@ class PolicyEventsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,10 +49,10 @@ def __init__(self, client, config, serializer, deserializer): def list_query_results_for_management_group( self, management_group_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyEventsQueryResults"] + # type: (...) -> Iterable["_models.PolicyEventsQueryResults"] """Queries policy events for the resources under the management group. :param management_group_name: Management group name. @@ -64,7 +64,7 @@ def list_query_results_for_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyEventsQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyEventsQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -147,7 +147,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -161,10 +161,10 @@ def get_next(next_link=None): def list_query_results_for_subscription( self, subscription_id, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyEventsQueryResults"] + # type: (...) -> Iterable["_models.PolicyEventsQueryResults"] """Queries policy events for the resources under the subscription. :param subscription_id: Microsoft Azure subscription ID. @@ -176,7 +176,7 @@ def list_query_results_for_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyEventsQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyEventsQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -257,7 +257,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -272,10 +272,10 @@ def list_query_results_for_resource_group( self, subscription_id, # type: str resource_group_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyEventsQueryResults"] + # type: (...) -> Iterable["_models.PolicyEventsQueryResults"] """Queries policy events for the resources under the resource group. :param subscription_id: Microsoft Azure subscription ID. @@ -289,7 +289,7 @@ def list_query_results_for_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyEventsQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyEventsQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -371,7 +371,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -385,10 +385,10 @@ def get_next(next_link=None): def list_query_results_for_resource( self, resource_id, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyEventsQueryResults"] + # type: (...) -> Iterable["_models.PolicyEventsQueryResults"] """Queries policy events for the resource. :param resource_id: Resource ID. @@ -400,7 +400,7 @@ def list_query_results_for_resource( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyEventsQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyEventsQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -485,7 +485,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -500,10 +500,10 @@ def list_query_results_for_policy_set_definition( self, subscription_id, # type: str policy_set_definition_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyEventsQueryResults"] + # type: (...) -> Iterable["_models.PolicyEventsQueryResults"] """Queries policy events for the subscription level policy set definition. :param subscription_id: Microsoft Azure subscription ID. @@ -517,7 +517,7 @@ def list_query_results_for_policy_set_definition( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyEventsQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyEventsQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -601,7 +601,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -616,10 +616,10 @@ def list_query_results_for_policy_definition( self, subscription_id, # type: str policy_definition_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyEventsQueryResults"] + # type: (...) -> Iterable["_models.PolicyEventsQueryResults"] """Queries policy events for the subscription level policy definition. :param subscription_id: Microsoft Azure subscription ID. @@ -633,7 +633,7 @@ def list_query_results_for_policy_definition( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyEventsQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyEventsQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -717,7 +717,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -732,10 +732,10 @@ def list_query_results_for_subscription_level_policy_assignment( self, subscription_id, # type: str policy_assignment_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyEventsQueryResults"] + # type: (...) -> Iterable["_models.PolicyEventsQueryResults"] """Queries policy events for the subscription level policy assignment. :param subscription_id: Microsoft Azure subscription ID. @@ -749,7 +749,7 @@ def list_query_results_for_subscription_level_policy_assignment( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyEventsQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyEventsQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -833,7 +833,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -849,10 +849,10 @@ def list_query_results_for_resource_group_level_policy_assignment( subscription_id, # type: str resource_group_name, # type: str policy_assignment_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyEventsQueryResults"] + # type: (...) -> Iterable["_models.PolicyEventsQueryResults"] """Queries policy events for the resource group level policy assignment. :param subscription_id: Microsoft Azure subscription ID. @@ -868,7 +868,7 @@ def list_query_results_for_resource_group_level_policy_assignment( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyEventsQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyEventsQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -953,7 +953,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_metadata_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_metadata_operations.py index e6150b44db16..5ce62077e9c8 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_metadata_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_metadata_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyMetadataOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def get_resource( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyMetadata" + # type: (...) -> "_models.PolicyMetadata" """Get policy metadata resource. :param resource_name: The name of the policy metadata resource. @@ -60,7 +60,7 @@ def get_resource( :rtype: ~azure.mgmt.policyinsights.models.PolicyMetadata :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyMetadata"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyMetadata"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -89,7 +89,7 @@ def get_resource( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponseAutoGenerated, response) + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyMetadata', pipeline_response) @@ -102,10 +102,10 @@ def get_resource( def list( self, - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyMetadataCollection"] + # type: (...) -> Iterable["_models.PolicyMetadataCollection"] """Get a list of the policy metadata resources. :param query_options: Parameter group. @@ -115,7 +115,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyMetadataCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyMetadataCollection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyMetadataCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -162,7 +162,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponseAutoGenerated, response) + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_restrictions_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_restrictions_operations.py new file mode 100644 index 000000000000..784ec4685d81 --- /dev/null +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_restrictions_operations.py @@ -0,0 +1,170 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PolicyRestrictionsOperations(object): + """PolicyRestrictionsOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.policyinsights.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def check_at_subscription_scope( + self, + parameters, # type: "_models.CheckRestrictionsRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckRestrictionsResult" + """Checks what restrictions Azure Policy will place on a resource within a subscription. + + :param parameters: The check policy restrictions parameters. + :type parameters: ~azure.mgmt.policyinsights.models.CheckRestrictionsRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckRestrictionsResult, or the result of cls(response) + :rtype: ~azure.mgmt.policyinsights.models.CheckRestrictionsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckRestrictionsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckRestrictionsRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckRestrictionsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions'} # type: ignore + + def check_at_resource_group_scope( + self, + resource_group_name, # type: str + parameters, # type: "_models.CheckRestrictionsRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckRestrictionsResult" + """Checks what restrictions Azure Policy will place on a resource within a resource group. Use + this when the resource group the resource will be created in is already known. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: The check policy restrictions parameters. + :type parameters: ~azure.mgmt.policyinsights.models.CheckRestrictionsRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckRestrictionsResult, or the result of cls(response) + :rtype: ~azure.mgmt.policyinsights.models.CheckRestrictionsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckRestrictionsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_at_resource_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckRestrictionsRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckRestrictionsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_at_resource_group_scope.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions'} # type: ignore diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_states_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_states_operations.py index d221f7a403d5..e97d5023ade9 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_states_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_states_operations.py @@ -17,7 +17,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -40,7 +40,7 @@ class PolicyStatesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,12 +50,12 @@ def __init__(self, client, config, serializer, deserializer): def list_query_results_for_management_group( self, - policy_states_resource, # type: Union[str, "models.PolicyStatesResource"] + policy_states_resource, # type: Union[str, "_models.PolicyStatesResource"] management_group_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyStatesQueryResults"] + # type: (...) -> Iterable["_models.PolicyStatesQueryResults"] """Queries policy states for the resources under the management group. :param policy_states_resource: The virtual resource under PolicyStates resource type. In a @@ -71,7 +71,7 @@ def list_query_results_for_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyStatesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyStatesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyStatesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -153,7 +153,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -167,10 +167,10 @@ def get_next(next_link=None): def summarize_for_management_group( self, management_group_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> "models.SummarizeResults" + # type: (...) -> "_models.SummarizeResults" """Summarizes policy states for the resources under the management group. :param management_group_name: Management group name. @@ -182,7 +182,7 @@ def summarize_for_management_group( :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SummarizeResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SummarizeResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -233,7 +233,7 @@ def summarize_for_management_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -246,12 +246,12 @@ def summarize_for_management_group( def list_query_results_for_subscription( self, - policy_states_resource, # type: Union[str, "models.PolicyStatesResource"] + policy_states_resource, # type: Union[str, "_models.PolicyStatesResource"] subscription_id, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyStatesQueryResults"] + # type: (...) -> Iterable["_models.PolicyStatesQueryResults"] """Queries policy states for the resources under the subscription. :param policy_states_resource: The virtual resource under PolicyStates resource type. In a @@ -267,7 +267,7 @@ def list_query_results_for_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyStatesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyStatesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyStatesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -347,7 +347,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -361,10 +361,10 @@ def get_next(next_link=None): def summarize_for_subscription( self, subscription_id, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> "models.SummarizeResults" + # type: (...) -> "_models.SummarizeResults" """Summarizes policy states for the resources under the subscription. :param subscription_id: Microsoft Azure subscription ID. @@ -376,7 +376,7 @@ def summarize_for_subscription( :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SummarizeResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SummarizeResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -425,7 +425,7 @@ def summarize_for_subscription( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -438,13 +438,13 @@ def summarize_for_subscription( def list_query_results_for_resource_group( self, - policy_states_resource, # type: Union[str, "models.PolicyStatesResource"] + policy_states_resource, # type: Union[str, "_models.PolicyStatesResource"] subscription_id, # type: str resource_group_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyStatesQueryResults"] + # type: (...) -> Iterable["_models.PolicyStatesQueryResults"] """Queries policy states for the resources under the resource group. :param policy_states_resource: The virtual resource under PolicyStates resource type. In a @@ -462,7 +462,7 @@ def list_query_results_for_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyStatesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyStatesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyStatesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -543,7 +543,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -558,10 +558,10 @@ def summarize_for_resource_group( self, subscription_id, # type: str resource_group_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> "models.SummarizeResults" + # type: (...) -> "_models.SummarizeResults" """Summarizes policy states for the resources under the resource group. :param subscription_id: Microsoft Azure subscription ID. @@ -575,7 +575,7 @@ def summarize_for_resource_group( :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SummarizeResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SummarizeResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -625,7 +625,7 @@ def summarize_for_resource_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -638,12 +638,12 @@ def summarize_for_resource_group( def list_query_results_for_resource( self, - policy_states_resource, # type: Union[str, "models.PolicyStatesResource"] + policy_states_resource, # type: Union[str, "_models.PolicyStatesResource"] resource_id, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyStatesQueryResults"] + # type: (...) -> Iterable["_models.PolicyStatesQueryResults"] """Queries policy states for the resource. :param policy_states_resource: The virtual resource under PolicyStates resource type. In a @@ -659,7 +659,7 @@ def list_query_results_for_resource( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyStatesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyStatesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyStatesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -743,7 +743,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -757,10 +757,10 @@ def get_next(next_link=None): def summarize_for_resource( self, resource_id, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> "models.SummarizeResults" + # type: (...) -> "_models.SummarizeResults" """Summarizes policy states for the resource. :param resource_id: Resource ID. @@ -772,7 +772,7 @@ def summarize_for_resource( :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SummarizeResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SummarizeResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -821,7 +821,7 @@ def summarize_for_resource( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -867,7 +867,7 @@ def _trigger_subscription_evaluation_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -916,7 +916,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -967,7 +971,7 @@ def _trigger_resource_group_evaluation_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -1020,7 +1024,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1036,13 +1045,13 @@ def get_long_running_output(pipeline_response): def list_query_results_for_policy_set_definition( self, - policy_states_resource, # type: Union[str, "models.PolicyStatesResource"] + policy_states_resource, # type: Union[str, "_models.PolicyStatesResource"] subscription_id, # type: str policy_set_definition_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyStatesQueryResults"] + # type: (...) -> Iterable["_models.PolicyStatesQueryResults"] """Queries policy states for the subscription level policy set definition. :param policy_states_resource: The virtual resource under PolicyStates resource type. In a @@ -1060,7 +1069,7 @@ def list_query_results_for_policy_set_definition( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyStatesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyStatesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyStatesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1143,7 +1152,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1158,10 +1167,10 @@ def summarize_for_policy_set_definition( self, subscription_id, # type: str policy_set_definition_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> "models.SummarizeResults" + # type: (...) -> "_models.SummarizeResults" """Summarizes policy states for the subscription level policy set definition. :param subscription_id: Microsoft Azure subscription ID. @@ -1175,7 +1184,7 @@ def summarize_for_policy_set_definition( :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SummarizeResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SummarizeResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1227,7 +1236,7 @@ def summarize_for_policy_set_definition( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -1240,13 +1249,13 @@ def summarize_for_policy_set_definition( def list_query_results_for_policy_definition( self, - policy_states_resource, # type: Union[str, "models.PolicyStatesResource"] + policy_states_resource, # type: Union[str, "_models.PolicyStatesResource"] subscription_id, # type: str policy_definition_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyStatesQueryResults"] + # type: (...) -> Iterable["_models.PolicyStatesQueryResults"] """Queries policy states for the subscription level policy definition. :param policy_states_resource: The virtual resource under PolicyStates resource type. In a @@ -1264,7 +1273,7 @@ def list_query_results_for_policy_definition( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyStatesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyStatesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyStatesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1347,7 +1356,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1362,10 +1371,10 @@ def summarize_for_policy_definition( self, subscription_id, # type: str policy_definition_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> "models.SummarizeResults" + # type: (...) -> "_models.SummarizeResults" """Summarizes policy states for the subscription level policy definition. :param subscription_id: Microsoft Azure subscription ID. @@ -1379,7 +1388,7 @@ def summarize_for_policy_definition( :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SummarizeResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SummarizeResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1431,7 +1440,7 @@ def summarize_for_policy_definition( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -1444,13 +1453,13 @@ def summarize_for_policy_definition( def list_query_results_for_subscription_level_policy_assignment( self, - policy_states_resource, # type: Union[str, "models.PolicyStatesResource"] + policy_states_resource, # type: Union[str, "_models.PolicyStatesResource"] subscription_id, # type: str policy_assignment_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyStatesQueryResults"] + # type: (...) -> Iterable["_models.PolicyStatesQueryResults"] """Queries policy states for the subscription level policy assignment. :param policy_states_resource: The virtual resource under PolicyStates resource type. In a @@ -1468,7 +1477,7 @@ def list_query_results_for_subscription_level_policy_assignment( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyStatesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyStatesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyStatesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1551,7 +1560,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1566,10 +1575,10 @@ def summarize_for_subscription_level_policy_assignment( self, subscription_id, # type: str policy_assignment_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> "models.SummarizeResults" + # type: (...) -> "_models.SummarizeResults" """Summarizes policy states for the subscription level policy assignment. :param subscription_id: Microsoft Azure subscription ID. @@ -1583,7 +1592,7 @@ def summarize_for_subscription_level_policy_assignment( :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SummarizeResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SummarizeResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1635,7 +1644,7 @@ def summarize_for_subscription_level_policy_assignment( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -1648,14 +1657,14 @@ def summarize_for_subscription_level_policy_assignment( def list_query_results_for_resource_group_level_policy_assignment( self, - policy_states_resource, # type: Union[str, "models.PolicyStatesResource"] + policy_states_resource, # type: Union[str, "_models.PolicyStatesResource"] subscription_id, # type: str resource_group_name, # type: str policy_assignment_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyStatesQueryResults"] + # type: (...) -> Iterable["_models.PolicyStatesQueryResults"] """Queries policy states for the resource group level policy assignment. :param policy_states_resource: The virtual resource under PolicyStates resource type. In a @@ -1675,7 +1684,7 @@ def list_query_results_for_resource_group_level_policy_assignment( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyStatesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyStatesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyStatesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1759,7 +1768,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1775,10 +1784,10 @@ def summarize_for_resource_group_level_policy_assignment( subscription_id, # type: str resource_group_name, # type: str policy_assignment_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> "models.SummarizeResults" + # type: (...) -> "_models.SummarizeResults" """Summarizes policy states for the resource group level policy assignment. :param subscription_id: Microsoft Azure subscription ID. @@ -1794,7 +1803,7 @@ def summarize_for_resource_group_level_policy_assignment( :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SummarizeResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SummarizeResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1847,7 +1856,7 @@ def summarize_for_resource_group_level_policy_assignment( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_tracked_resources_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_tracked_resources_operations.py index 930104f077aa..041bc997e6e0 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_tracked_resources_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_tracked_resources_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyTrackedResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,10 +48,10 @@ def __init__(self, client, config, serializer, deserializer): def list_query_results_for_management_group( self, management_group_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyTrackedResourcesQueryResults"] + # type: (...) -> Iterable["_models.PolicyTrackedResourcesQueryResults"] """Queries policy tracked resources under the management group. :param management_group_name: Management group name. @@ -63,7 +63,7 @@ def list_query_results_for_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyTrackedResourcesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyTrackedResourcesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyTrackedResourcesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -122,7 +122,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -135,10 +135,10 @@ def get_next(next_link=None): def list_query_results_for_subscription( self, - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyTrackedResourcesQueryResults"] + # type: (...) -> Iterable["_models.PolicyTrackedResourcesQueryResults"] """Queries policy tracked resources under the subscription. :param query_options: Parameter group. @@ -148,7 +148,7 @@ def list_query_results_for_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyTrackedResourcesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyTrackedResourcesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyTrackedResourcesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -205,7 +205,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -219,10 +219,10 @@ def get_next(next_link=None): def list_query_results_for_resource_group( self, resource_group_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyTrackedResourcesQueryResults"] + # type: (...) -> Iterable["_models.PolicyTrackedResourcesQueryResults"] """Queries policy tracked resources under the resource group. :param resource_group_name: Resource group name. @@ -234,7 +234,7 @@ def list_query_results_for_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyTrackedResourcesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyTrackedResourcesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyTrackedResourcesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -292,7 +292,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -306,10 +306,10 @@ def get_next(next_link=None): def list_query_results_for_resource( self, resource_id, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyTrackedResourcesQueryResults"] + # type: (...) -> Iterable["_models.PolicyTrackedResourcesQueryResults"] """Queries policy tracked resources under the resource. :param resource_id: Resource ID. @@ -321,7 +321,7 @@ def list_query_results_for_resource( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyTrackedResourcesQueryResults] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyTrackedResourcesQueryResults"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyTrackedResourcesQueryResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -378,7 +378,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.QueryFailure, response) + error = self._deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_remediations_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_remediations_operations.py index 56ff03a269be..c0ed1d389296 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_remediations_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_remediations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class RemediationsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,10 +49,10 @@ def list_deployments_at_management_group( self, management_group_id, # type: str remediation_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.RemediationDeploymentsListResult"] + # type: (...) -> Iterable["_models.RemediationDeploymentsListResult"] """Gets all deployments for a remediation at management group scope. :param management_group_id: Management group ID. @@ -66,7 +66,7 @@ def list_deployments_at_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.RemediationDeploymentsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RemediationDeploymentsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RemediationDeploymentsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -120,7 +120,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -137,7 +137,7 @@ def cancel_at_management_group( remediation_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Remediation" + # type: (...) -> "_models.Remediation" """Cancels a remediation at management group scope. :param management_group_id: Management group ID. @@ -149,7 +149,7 @@ def cancel_at_management_group( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -181,7 +181,7 @@ def cancel_at_management_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -195,10 +195,10 @@ def cancel_at_management_group( def list_for_management_group( self, management_group_id, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.RemediationListResult"] + # type: (...) -> Iterable["_models.RemediationListResult"] """Gets all remediations for the management group. :param management_group_id: Management group ID. @@ -210,7 +210,7 @@ def list_for_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.RemediationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RemediationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RemediationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -267,7 +267,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -282,10 +282,10 @@ def create_or_update_at_management_group( self, management_group_id, # type: str remediation_name, # type: str - parameters, # type: "models.Remediation" + parameters, # type: "_models.Remediation" **kwargs # type: Any ): - # type: (...) -> "models.Remediation" + # type: (...) -> "_models.Remediation" """Creates or updates a remediation at management group scope. :param management_group_id: Management group ID. @@ -299,7 +299,7 @@ def create_or_update_at_management_group( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -336,7 +336,7 @@ def create_or_update_at_management_group( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -357,7 +357,7 @@ def get_at_management_group( remediation_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Remediation" + # type: (...) -> "_models.Remediation" """Gets an existing remediation at management group scope. :param management_group_id: Management group ID. @@ -369,7 +369,7 @@ def get_at_management_group( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -401,7 +401,7 @@ def get_at_management_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -418,7 +418,7 @@ def delete_at_management_group( remediation_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.Remediation"] + # type: (...) -> Optional["_models.Remediation"] """Deletes an existing remediation at management group scope. :param management_group_id: Management group ID. @@ -430,7 +430,7 @@ def delete_at_management_group( :rtype: ~azure.mgmt.policyinsights.models.Remediation or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Remediation"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Remediation"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -462,7 +462,7 @@ def delete_at_management_group( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -478,10 +478,10 @@ def delete_at_management_group( def list_deployments_at_subscription( self, remediation_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.RemediationDeploymentsListResult"] + # type: (...) -> Iterable["_models.RemediationDeploymentsListResult"] """Gets all deployments for a remediation at subscription scope. :param remediation_name: The name of the remediation. @@ -493,7 +493,7 @@ def list_deployments_at_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.RemediationDeploymentsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RemediationDeploymentsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RemediationDeploymentsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -545,7 +545,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -561,7 +561,7 @@ def cancel_at_subscription( remediation_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Remediation" + # type: (...) -> "_models.Remediation" """Cancels a remediation at subscription scope. :param remediation_name: The name of the remediation. @@ -571,7 +571,7 @@ def cancel_at_subscription( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -601,7 +601,7 @@ def cancel_at_subscription( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -614,10 +614,10 @@ def cancel_at_subscription( def list_for_subscription( self, - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.RemediationListResult"] + # type: (...) -> Iterable["_models.RemediationListResult"] """Gets all remediations for the subscription. :param query_options: Parameter group. @@ -627,7 +627,7 @@ def list_for_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.RemediationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RemediationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RemediationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -682,7 +682,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -696,10 +696,10 @@ def get_next(next_link=None): def create_or_update_at_subscription( self, remediation_name, # type: str - parameters, # type: "models.Remediation" + parameters, # type: "_models.Remediation" **kwargs # type: Any ): - # type: (...) -> "models.Remediation" + # type: (...) -> "_models.Remediation" """Creates or updates a remediation at subscription scope. :param remediation_name: The name of the remediation. @@ -711,7 +711,7 @@ def create_or_update_at_subscription( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -746,7 +746,7 @@ def create_or_update_at_subscription( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -766,7 +766,7 @@ def get_at_subscription( remediation_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Remediation" + # type: (...) -> "_models.Remediation" """Gets an existing remediation at subscription scope. :param remediation_name: The name of the remediation. @@ -776,7 +776,7 @@ def get_at_subscription( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -806,7 +806,7 @@ def get_at_subscription( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -822,7 +822,7 @@ def delete_at_subscription( remediation_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.Remediation"] + # type: (...) -> Optional["_models.Remediation"] """Deletes an existing remediation at subscription scope. :param remediation_name: The name of the remediation. @@ -832,7 +832,7 @@ def delete_at_subscription( :rtype: ~azure.mgmt.policyinsights.models.Remediation or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Remediation"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Remediation"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -862,7 +862,7 @@ def delete_at_subscription( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -879,10 +879,10 @@ def list_deployments_at_resource_group( self, resource_group_name, # type: str remediation_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.RemediationDeploymentsListResult"] + # type: (...) -> Iterable["_models.RemediationDeploymentsListResult"] """Gets all deployments for a remediation at resource group scope. :param resource_group_name: Resource group name. @@ -896,7 +896,7 @@ def list_deployments_at_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.RemediationDeploymentsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RemediationDeploymentsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RemediationDeploymentsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -949,7 +949,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -966,7 +966,7 @@ def cancel_at_resource_group( remediation_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Remediation" + # type: (...) -> "_models.Remediation" """Cancels a remediation at resource group scope. :param resource_group_name: Resource group name. @@ -978,7 +978,7 @@ def cancel_at_resource_group( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1009,7 +1009,7 @@ def cancel_at_resource_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -1023,10 +1023,10 @@ def cancel_at_resource_group( def list_for_resource_group( self, resource_group_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.RemediationListResult"] + # type: (...) -> Iterable["_models.RemediationListResult"] """Gets all remediations for the subscription. :param resource_group_name: Resource group name. @@ -1038,7 +1038,7 @@ def list_for_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.RemediationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RemediationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RemediationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1094,7 +1094,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1109,10 +1109,10 @@ def create_or_update_at_resource_group( self, resource_group_name, # type: str remediation_name, # type: str - parameters, # type: "models.Remediation" + parameters, # type: "_models.Remediation" **kwargs # type: Any ): - # type: (...) -> "models.Remediation" + # type: (...) -> "_models.Remediation" """Creates or updates a remediation at resource group scope. :param resource_group_name: Resource group name. @@ -1126,7 +1126,7 @@ def create_or_update_at_resource_group( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1162,7 +1162,7 @@ def create_or_update_at_resource_group( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -1183,7 +1183,7 @@ def get_at_resource_group( remediation_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Remediation" + # type: (...) -> "_models.Remediation" """Gets an existing remediation at resource group scope. :param resource_group_name: Resource group name. @@ -1195,7 +1195,7 @@ def get_at_resource_group( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1226,7 +1226,7 @@ def get_at_resource_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -1243,7 +1243,7 @@ def delete_at_resource_group( remediation_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.Remediation"] + # type: (...) -> Optional["_models.Remediation"] """Deletes an existing remediation at resource group scope. :param resource_group_name: Resource group name. @@ -1255,7 +1255,7 @@ def delete_at_resource_group( :rtype: ~azure.mgmt.policyinsights.models.Remediation or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Remediation"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Remediation"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1286,7 +1286,7 @@ def delete_at_resource_group( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -1303,10 +1303,10 @@ def list_deployments_at_resource( self, resource_id, # type: str remediation_name, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.RemediationDeploymentsListResult"] + # type: (...) -> Iterable["_models.RemediationDeploymentsListResult"] """Gets all deployments for a remediation at resource scope. :param resource_id: Resource ID. @@ -1320,7 +1320,7 @@ def list_deployments_at_resource( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.RemediationDeploymentsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RemediationDeploymentsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RemediationDeploymentsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1372,7 +1372,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1389,7 +1389,7 @@ def cancel_at_resource( remediation_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Remediation" + # type: (...) -> "_models.Remediation" """Cancel a remediation at resource scope. :param resource_id: Resource ID. @@ -1401,7 +1401,7 @@ def cancel_at_resource( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1431,7 +1431,7 @@ def cancel_at_resource( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -1445,10 +1445,10 @@ def cancel_at_resource( def list_for_resource( self, resource_id, # type: str - query_options=None, # type: Optional["models.QueryOptions"] + query_options=None, # type: Optional["_models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Iterable["models.RemediationListResult"] + # type: (...) -> Iterable["_models.RemediationListResult"] """Gets all remediations for a resource. :param resource_id: Resource ID. @@ -1460,7 +1460,7 @@ def list_for_resource( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.RemediationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RemediationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RemediationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1515,7 +1515,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1530,10 +1530,10 @@ def create_or_update_at_resource( self, resource_id, # type: str remediation_name, # type: str - parameters, # type: "models.Remediation" + parameters, # type: "_models.Remediation" **kwargs # type: Any ): - # type: (...) -> "models.Remediation" + # type: (...) -> "_models.Remediation" """Creates or updates a remediation at resource scope. :param resource_id: Resource ID. @@ -1547,7 +1547,7 @@ def create_or_update_at_resource( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1582,7 +1582,7 @@ def create_or_update_at_resource( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -1603,7 +1603,7 @@ def get_at_resource( remediation_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Remediation" + # type: (...) -> "_models.Remediation" """Gets an existing remediation at resource scope. :param resource_id: Resource ID. @@ -1615,7 +1615,7 @@ def get_at_resource( :rtype: ~azure.mgmt.policyinsights.models.Remediation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Remediation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Remediation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1645,7 +1645,7 @@ def get_at_resource( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -1662,7 +1662,7 @@ def delete_at_resource( remediation_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.Remediation"] + # type: (...) -> Optional["_models.Remediation"] """Deletes an existing remediation at individual resource scope. :param resource_id: Resource ID. @@ -1674,7 +1674,7 @@ def delete_at_resource( :rtype: ~azure.mgmt.policyinsights.models.Remediation or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Remediation"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Remediation"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1704,7 +1704,7 @@ def delete_at_resource( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None