Skip to content

Commit

Permalink
GA policyinsights track2 sdk (Azure#15905)
Browse files Browse the repository at this point in the history
  • Loading branch information
00Kai0 authored and rakshith91 committed Jan 8, 2021
1 parent ef9b86d commit 0e7edda
Show file tree
Hide file tree
Showing 24 changed files with 1,501 additions and 461 deletions.
7 changes: 7 additions & 0 deletions sdk/policyinsights/azure-mgmt-policyinsights/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from .operations import PolicyStatesOperations
from .operations import Operations
from .operations import PolicyMetadataOperations
from .operations import PolicyRestrictionsOperations
from . import models


Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from .operations import PolicyStatesOperations
from .operations import Operations
from .operations import PolicyMetadataOperations
from .operations import PolicyRestrictionsOperations
from .. import models


Expand All @@ -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.
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -20,4 +21,5 @@
'PolicyStatesOperations',
'Operations',
'PolicyMetadataOperations',
'PolicyRestrictionsOperations',
]
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand All @@ -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
Expand All @@ -43,15 +43,15 @@ 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
:return: OperationsListResults, or the result of cls(response)
: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
}
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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
}
Expand Down Expand Up @@ -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)

Expand All @@ -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.
Expand All @@ -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
}
Expand Down Expand Up @@ -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)

Expand All @@ -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.
Expand All @@ -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
}
Expand Down Expand Up @@ -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)

Expand All @@ -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.
Expand All @@ -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
}
Expand Down Expand Up @@ -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)

Expand All @@ -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.
Expand All @@ -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
}
Expand Down Expand Up @@ -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)

Expand All @@ -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.
Expand All @@ -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
}
Expand Down Expand Up @@ -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)

Expand All @@ -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.
Expand All @@ -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
}
Expand Down Expand Up @@ -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)

Expand All @@ -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.
Expand All @@ -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
}
Expand Down Expand Up @@ -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)

Expand Down
Loading

0 comments on commit 0e7edda

Please sign in to comment.