Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR azure-mgmt-policyinsights] Policy compliance data enable pagination #82

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

try:
from ._models_py3 import ComplianceDetail
from ._models_py3 import ComponentEventDetails
from ._models_py3 import ComponentStateDetails
from ._models_py3 import ErrorDefinition
from ._models_py3 import ErrorResponse, ErrorResponseException
from ._models_py3 import ExpressionEvaluationDetails
Expand All @@ -23,11 +25,9 @@
from ._models_py3 import PolicyDetails
from ._models_py3 import PolicyEvaluationDetails
from ._models_py3 import PolicyEvent
from ._models_py3 import PolicyEventsQueryResults
from ._models_py3 import PolicyGroupSummary
from ._models_py3 import PolicyMetadata
from ._models_py3 import PolicyState
from ._models_py3 import PolicyStatesQueryResults
from ._models_py3 import PolicyTrackedResource
from ._models_py3 import QueryFailure, QueryFailureException
from ._models_py3 import QueryFailureError
Expand All @@ -44,6 +44,8 @@
from ._models_py3 import TypedErrorInfo
except (SyntaxError, ImportError):
from ._models import ComplianceDetail
from ._models import ComponentEventDetails
from ._models import ComponentStateDetails
from ._models import ErrorDefinition
from ._models import ErrorResponse, ErrorResponseException
from ._models import ExpressionEvaluationDetails
Expand All @@ -56,11 +58,9 @@
from ._models import PolicyDetails
from ._models import PolicyEvaluationDetails
from ._models import PolicyEvent
from ._models import PolicyEventsQueryResults
from ._models import PolicyGroupSummary
from ._models import PolicyMetadata
from ._models import PolicyState
from ._models import PolicyStatesQueryResults
from ._models import PolicyTrackedResource
from ._models import QueryFailure, QueryFailureException
from ._models import QueryFailureError
Expand All @@ -75,6 +75,8 @@
from ._models import SummaryResults
from ._models import TrackedResourceModificationDetails
from ._models import TypedErrorInfo
from ._paged_models import PolicyEventPaged
from ._paged_models import PolicyStatePaged
from ._paged_models import PolicyTrackedResourcePaged
from ._paged_models import RemediationDeploymentPaged
from ._paged_models import RemediationPaged
Expand All @@ -86,6 +88,8 @@

__all__ = [
'ComplianceDetail',
'ComponentEventDetails',
'ComponentStateDetails',
'ErrorDefinition',
'ErrorResponse', 'ErrorResponseException',
'ExpressionEvaluationDetails',
Expand All @@ -98,11 +102,9 @@
'PolicyDetails',
'PolicyEvaluationDetails',
'PolicyEvent',
'PolicyEventsQueryResults',
'PolicyGroupSummary',
'PolicyMetadata',
'PolicyState',
'PolicyStatesQueryResults',
'PolicyTrackedResource',
'QueryFailure', 'QueryFailureException',
'QueryFailureError',
Expand All @@ -120,6 +122,8 @@
'PolicyTrackedResourcePaged',
'RemediationDeploymentPaged',
'RemediationPaged',
'PolicyEventPaged',
'PolicyStatePaged',
'SlimPolicyMetadataPaged',
'ResourceDiscoveryMode',
'PolicyStatesResource',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,89 @@ def __init__(self, **kwargs):
self.count = kwargs.get('count', None)


class ComponentEventDetails(Model):
"""Component event details.

:param additional_properties: Unmatched properties from the message are
deserialized this collection
:type additional_properties: dict[str, object]
:param id: Component Id.
:type id: str
:param type: Component type.
:type type: str
:param name: Component name.
:type name: str
:param timestamp: Timestamp for component policy event record.
:type timestamp: datetime
:param tenant_id: Tenant ID for the policy event record.
:type tenant_id: str
:param principal_oid: Principal object ID for the user who initiated the
resource component operation that triggered the policy event.
:type principal_oid: str
:param policy_definition_action: Policy definition action, i.e. effect.
:type policy_definition_action: str
"""

_attribute_map = {
'additional_properties': {'key': '', 'type': '{object}'},
'id': {'key': 'id', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'timestamp': {'key': 'timestamp', 'type': 'iso-8601'},
'tenant_id': {'key': 'tenantId', 'type': 'str'},
'principal_oid': {'key': 'principalOid', 'type': 'str'},
'policy_definition_action': {'key': 'policyDefinitionAction', 'type': 'str'},
}

def __init__(self, **kwargs):
super(ComponentEventDetails, self).__init__(**kwargs)
self.additional_properties = kwargs.get('additional_properties', None)
self.id = kwargs.get('id', None)
self.type = kwargs.get('type', None)
self.name = kwargs.get('name', None)
self.timestamp = kwargs.get('timestamp', None)
self.tenant_id = kwargs.get('tenant_id', None)
self.principal_oid = kwargs.get('principal_oid', None)
self.policy_definition_action = kwargs.get('policy_definition_action', None)


class ComponentStateDetails(Model):
"""Component state details.

:param additional_properties: Unmatched properties from the message are
deserialized this collection
:type additional_properties: dict[str, object]
:param id: Component Id.
:type id: str
:param type: Component type.
:type type: str
:param name: Component name.
:type name: str
:param timestamp: Component compliance evaluation timestamp.
:type timestamp: datetime
:param compliance_state: Component compliance state.
:type compliance_state: str
"""

_attribute_map = {
'additional_properties': {'key': '', 'type': '{object}'},
'id': {'key': 'id', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'timestamp': {'key': 'timestamp', 'type': 'iso-8601'},
'compliance_state': {'key': 'complianceState', 'type': 'str'},
}

def __init__(self, **kwargs):
super(ComponentStateDetails, self).__init__(**kwargs)
self.additional_properties = kwargs.get('additional_properties', None)
self.id = kwargs.get('id', None)
self.type = kwargs.get('type', None)
self.name = kwargs.get('name', None)
self.timestamp = kwargs.get('timestamp', None)
self.compliance_state = kwargs.get('compliance_state', None)


class ErrorDefinition(Model):
"""Error definition.

Expand Down Expand Up @@ -459,11 +542,17 @@ class PolicyEvent(Model):
definition inside the policy set, if the policy assignment is for a policy
set.
:type policy_definition_reference_id: str
:param compliance_state: Compliance state of the resource.
:type compliance_state: str
:param tenant_id: Tenant ID for the policy event record.
:type tenant_id: str
:param principal_oid: Principal object ID for the user who initiated the
resource operation that triggered the policy event.
:type principal_oid: str
:param components: Components events records populated only when URL
contains $expand=components clause.
:type components:
list[~azure.mgmt.policyinsights.models.ComponentEventDetails]
"""

_attribute_map = {
Expand Down Expand Up @@ -495,8 +584,10 @@ class PolicyEvent(Model):
'policy_set_definition_parameters': {'key': 'policySetDefinitionParameters', 'type': 'str'},
'management_group_ids': {'key': 'managementGroupIds', 'type': 'str'},
'policy_definition_reference_id': {'key': 'policyDefinitionReferenceId', 'type': 'str'},
'compliance_state': {'key': 'complianceState', 'type': 'str'},
'tenant_id': {'key': 'tenantId', 'type': 'str'},
'principal_oid': {'key': 'principalOid', 'type': 'str'},
'components': {'key': 'components', 'type': '[ComponentEventDetails]'},
}

def __init__(self, **kwargs):
Expand Down Expand Up @@ -529,38 +620,10 @@ def __init__(self, **kwargs):
self.policy_set_definition_parameters = kwargs.get('policy_set_definition_parameters', None)
self.management_group_ids = kwargs.get('management_group_ids', None)
self.policy_definition_reference_id = kwargs.get('policy_definition_reference_id', None)
self.compliance_state = kwargs.get('compliance_state', None)
self.tenant_id = kwargs.get('tenant_id', None)
self.principal_oid = kwargs.get('principal_oid', None)


class PolicyEventsQueryResults(Model):
"""Query results.

:param odatacontext: OData context string; used by OData clients to
resolve type information based on metadata.
:type odatacontext: str
:param odatacount: OData entity count; represents the number of policy
event records returned.
:type odatacount: int
:param value: Query results.
:type value: list[~azure.mgmt.policyinsights.models.PolicyEvent]
"""

_validation = {
'odatacount': {'minimum': 0},
}

_attribute_map = {
'odatacontext': {'key': '@odata\\.context', 'type': 'str'},
'odatacount': {'key': '@odata\\.count', 'type': 'int'},
'value': {'key': 'value', 'type': '[PolicyEvent]'},
}

def __init__(self, **kwargs):
super(PolicyEventsQueryResults, self).__init__(**kwargs)
self.odatacontext = kwargs.get('odatacontext', None)
self.odatacount = kwargs.get('odatacount', None)
self.value = kwargs.get('value', None)
self.components = kwargs.get('components', None)


class PolicyGroupSummary(Model):
Expand Down Expand Up @@ -741,6 +804,10 @@ class PolicyState(Model):
~azure.mgmt.policyinsights.models.PolicyEvaluationDetails
:param policy_definition_group_names: Policy definition group names.
:type policy_definition_group_names: list[str]
:param components: Components state compliance records populated only when
URL contains $expand=components clause.
:type components:
list[~azure.mgmt.policyinsights.models.ComponentStateDetails]
:ivar policy_definition_version: Evaluated policy definition version.
:vartype policy_definition_version: str
:ivar policy_set_definition_version: Evaluated policy set definition
Expand Down Expand Up @@ -788,6 +855,7 @@ class PolicyState(Model):
'compliance_state': {'key': 'complianceState', 'type': 'str'},
'policy_evaluation_details': {'key': 'policyEvaluationDetails', 'type': 'PolicyEvaluationDetails'},
'policy_definition_group_names': {'key': 'policyDefinitionGroupNames', 'type': '[str]'},
'components': {'key': 'components', 'type': '[ComponentStateDetails]'},
'policy_definition_version': {'key': 'policyDefinitionVersion', 'type': 'str'},
'policy_set_definition_version': {'key': 'policySetDefinitionVersion', 'type': 'str'},
'policy_assignment_version': {'key': 'policyAssignmentVersion', 'type': 'str'},
Expand Down Expand Up @@ -826,41 +894,12 @@ def __init__(self, **kwargs):
self.compliance_state = kwargs.get('compliance_state', None)
self.policy_evaluation_details = kwargs.get('policy_evaluation_details', None)
self.policy_definition_group_names = kwargs.get('policy_definition_group_names', None)
self.components = kwargs.get('components', None)
self.policy_definition_version = None
self.policy_set_definition_version = None
self.policy_assignment_version = None


class PolicyStatesQueryResults(Model):
"""Query results.

:param odatacontext: OData context string; used by OData clients to
resolve type information based on metadata.
:type odatacontext: str
:param odatacount: OData entity count; represents the number of policy
state records returned.
:type odatacount: int
:param value: Query results.
:type value: list[~azure.mgmt.policyinsights.models.PolicyState]
"""

_validation = {
'odatacount': {'minimum': 0},
}

_attribute_map = {
'odatacontext': {'key': '@odata\\.context', 'type': 'str'},
'odatacount': {'key': '@odata\\.count', 'type': 'int'},
'value': {'key': 'value', 'type': '[PolicyState]'},
}

def __init__(self, **kwargs):
super(PolicyStatesQueryResults, self).__init__(**kwargs)
self.odatacontext = kwargs.get('odatacontext', None)
self.odatacount = kwargs.get('odatacount', None)
self.value = kwargs.get('value', None)


class PolicyTrackedResource(Model):
"""Policy tracked resource record.

Expand Down Expand Up @@ -991,8 +1030,11 @@ class QueryOptions(Model):
:type to: datetime
:param apply: OData apply expression for aggregations.
:type apply: str
:param skip_token: Skiptoken is only provided if a previous response
returned a partial result as a part of nextLink element.
:type skip_token: str
:param expand: The $expand query parameter. For example, to expand
policyEvaluationDetails, use $expand=policyEvaluationDetails
components use $expand=components
:type expand: str
"""

Expand All @@ -1004,6 +1046,7 @@ class QueryOptions(Model):
'from_property': {'key': '', 'type': 'iso-8601'},
'to': {'key': '', 'type': 'iso-8601'},
'apply': {'key': '', 'type': 'str'},
'skip_token': {'key': '', 'type': 'str'},
'expand': {'key': '', 'type': 'str'},
}

Expand All @@ -1016,6 +1059,7 @@ def __init__(self, **kwargs):
self.from_property = kwargs.get('from_property', None)
self.to = kwargs.get('to', None)
self.apply = kwargs.get('apply', None)
self.skip_token = kwargs.get('skip_token', None)
self.expand = kwargs.get('expand', None)


Expand Down
Loading