diff --git a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_resource_graph_client.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_resource_graph_client.py index 7a3564f517bd..43435e40d8be 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_resource_graph_client.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_resource_graph_client.py @@ -40,7 +40,7 @@ def __init__( super(ResourceGraphClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2019-04-01' + self.api_version = '2020-04-01-preview' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) diff --git a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/__init__.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/__init__.py index 80be262d3f2a..f67fccbc4d74 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/__init__.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/__init__.py @@ -11,6 +11,7 @@ try: from ._models_py3 import Column + from ._models_py3 import DateTimeInterval from ._models_py3 import Error from ._models_py3 import ErrorDetails from ._models_py3 import ErrorResponse, ErrorResponseException @@ -24,9 +25,19 @@ from ._models_py3 import QueryRequest from ._models_py3 import QueryRequestOptions from ._models_py3 import QueryResponse + from ._models_py3 import ResourceChangeData + from ._models_py3 import ResourceChangeDataAfterSnapshot + from ._models_py3 import ResourceChangeDataBeforeSnapshot + from ._models_py3 import ResourceChangeDetailsRequestParameters + from ._models_py3 import ResourceChangeList + from ._models_py3 import ResourceChangesRequestParameters + from ._models_py3 import ResourceChangesRequestParametersInterval + from ._models_py3 import ResourcePropertyChange + from ._models_py3 import ResourceSnapshotData from ._models_py3 import Table except (SyntaxError, ImportError): from ._models import Column + from ._models import DateTimeInterval from ._models import Error from ._models import ErrorDetails from ._models import ErrorResponse, ErrorResponseException @@ -40,6 +51,15 @@ from ._models import QueryRequest from ._models import QueryRequestOptions from ._models import QueryResponse + from ._models import ResourceChangeData + from ._models import ResourceChangeDataAfterSnapshot + from ._models import ResourceChangeDataBeforeSnapshot + from ._models import ResourceChangeDetailsRequestParameters + from ._models import ResourceChangeList + from ._models import ResourceChangesRequestParameters + from ._models import ResourceChangesRequestParametersInterval + from ._models import ResourcePropertyChange + from ._models import ResourceSnapshotData from ._models import Table from ._paged_models import OperationPaged from ._resource_graph_client_enums import ( @@ -47,10 +67,14 @@ FacetSortOrder, ResultTruncated, ColumnDataType, + ChangeType, + ChangeCategory, + PropertyChangeType, ) __all__ = [ 'Column', + 'DateTimeInterval', 'Error', 'ErrorDetails', 'ErrorResponse', 'ErrorResponseException', @@ -64,10 +88,22 @@ 'QueryRequest', 'QueryRequestOptions', 'QueryResponse', + 'ResourceChangeData', + 'ResourceChangeDataAfterSnapshot', + 'ResourceChangeDataBeforeSnapshot', + 'ResourceChangeDetailsRequestParameters', + 'ResourceChangeList', + 'ResourceChangesRequestParameters', + 'ResourceChangesRequestParametersInterval', + 'ResourcePropertyChange', + 'ResourceSnapshotData', 'Table', 'OperationPaged', 'ResultFormat', 'FacetSortOrder', 'ResultTruncated', 'ColumnDataType', + 'ChangeType', + 'ChangeCategory', + 'PropertyChangeType', ] diff --git a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_models.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_models.py index 4189d18fb28e..a994ae1be4f4 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_models.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_models.py @@ -49,6 +49,38 @@ def __init__(self, **kwargs): self.type = kwargs.get('type', None) +class DateTimeInterval(Model): + """An interval in time specifying the date and time for the inclusive start + and exclusive end, i.e. `[start, end)`. + + All required parameters must be populated in order to send to Azure. + + :param start: Required. A datetime indicating the inclusive/closed start + of the time interval, i.e. `[`**`start`**`, end)`. Specifying a `start` + that occurs chronologically after `end` will result in an error. + :type start: datetime + :param end: Required. A datetime indicating the exclusive/open end of the + time interval, i.e. `[start, `**`end`**`)`. Specifying an `end` that + occurs chronologically before `start` will result in an error. + :type end: datetime + """ + + _validation = { + 'start': {'required': True}, + 'end': {'required': True}, + } + + _attribute_map = { + 'start': {'key': 'start', 'type': 'iso-8601'}, + 'end': {'key': 'end', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(DateTimeInterval, self).__init__(**kwargs) + self.start = kwargs.get('start', None) + self.end = kwargs.get('end', None) + + class Error(Model): """Error info. @@ -382,9 +414,11 @@ class QueryRequest(Model): All required parameters must be populated in order to send to Azure. - :param subscriptions: Required. Azure subscriptions against which to - execute the query. + :param subscriptions: Azure subscriptions against which to execute the + query. :type subscriptions: list[str] + :param management_group_id: The management group identifier. + :type management_group_id: str :param query: Required. The resources query. :type query: str :param options: The query evaluation options @@ -395,12 +429,12 @@ class QueryRequest(Model): """ _validation = { - 'subscriptions': {'required': True}, 'query': {'required': True}, } _attribute_map = { 'subscriptions': {'key': 'subscriptions', 'type': '[str]'}, + 'management_group_id': {'key': 'managementGroupId', 'type': 'str'}, 'query': {'key': 'query', 'type': 'str'}, 'options': {'key': 'options', 'type': 'QueryRequestOptions'}, 'facets': {'key': 'facets', 'type': '[FacetRequest]'}, @@ -409,6 +443,7 @@ class QueryRequest(Model): def __init__(self, **kwargs): super(QueryRequest, self).__init__(**kwargs) self.subscriptions = kwargs.get('subscriptions', None) + self.management_group_id = kwargs.get('management_group_id', None) self.query = kwargs.get('query', None) self.options = kwargs.get('options', None) self.facets = kwargs.get('facets', None) @@ -503,6 +538,319 @@ def __init__(self, **kwargs): self.facets = kwargs.get('facets', None) +class ResourceChangeData(Model): + """Data on a specific change, represented by a pair of before and after + resource snapshots. + + All required parameters must be populated in order to send to Azure. + + :param change_id: Required. The change ID. Valid and unique within the + specified resource only. + :type change_id: str + :param before_snapshot: Required. The snapshot before the change. + :type before_snapshot: + ~azure.mgmt.resourcegraph.models.ResourceChangeDataBeforeSnapshot + :param after_snapshot: Required. The snapshot after the change. + :type after_snapshot: + ~azure.mgmt.resourcegraph.models.ResourceChangeDataAfterSnapshot + :param change_type: The change type for snapshot. PropertyChanges will be + provided in case of Update change type. Possible values include: 'Create', + 'Update', 'Delete' + :type change_type: str or ~azure.mgmt.resourcegraph.models.ChangeType + :param property_changes: An array of resource property change + :type property_changes: + list[~azure.mgmt.resourcegraph.models.ResourcePropertyChange] + """ + + _validation = { + 'change_id': {'required': True}, + 'before_snapshot': {'required': True}, + 'after_snapshot': {'required': True}, + } + + _attribute_map = { + 'change_id': {'key': 'changeId', 'type': 'str'}, + 'before_snapshot': {'key': 'beforeSnapshot', 'type': 'ResourceChangeDataBeforeSnapshot'}, + 'after_snapshot': {'key': 'afterSnapshot', 'type': 'ResourceChangeDataAfterSnapshot'}, + 'change_type': {'key': 'changeType', 'type': 'ChangeType'}, + 'property_changes': {'key': 'propertyChanges', 'type': '[ResourcePropertyChange]'}, + } + + def __init__(self, **kwargs): + super(ResourceChangeData, self).__init__(**kwargs) + self.change_id = kwargs.get('change_id', None) + self.before_snapshot = kwargs.get('before_snapshot', None) + self.after_snapshot = kwargs.get('after_snapshot', None) + self.change_type = kwargs.get('change_type', None) + self.property_changes = kwargs.get('property_changes', None) + + +class ResourceSnapshotData(Model): + """Data on a specific resource snapshot. + + All required parameters must be populated in order to send to Azure. + + :param timestamp: Required. The time when the snapshot was created. + The snapshot timestamp provides an approximation as to when a modification + to a resource was detected. There can be a difference between the actual + modification time and the detection time. This is due to differences in + how operations that modify a resource are processed, versus how operation + that record resource snapshots are processed. + :type timestamp: datetime + :param content: The resource snapshot content (in resourceChangeDetails + response only). + :type content: object + """ + + _validation = { + 'timestamp': {'required': True}, + } + + _attribute_map = { + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'content': {'key': 'content', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(ResourceSnapshotData, self).__init__(**kwargs) + self.timestamp = kwargs.get('timestamp', None) + self.content = kwargs.get('content', None) + + +class ResourceChangeDataAfterSnapshot(ResourceSnapshotData): + """The snapshot after the change. + + All required parameters must be populated in order to send to Azure. + + :param timestamp: Required. The time when the snapshot was created. + The snapshot timestamp provides an approximation as to when a modification + to a resource was detected. There can be a difference between the actual + modification time and the detection time. This is due to differences in + how operations that modify a resource are processed, versus how operation + that record resource snapshots are processed. + :type timestamp: datetime + :param content: The resource snapshot content (in resourceChangeDetails + response only). + :type content: object + """ + + _validation = { + 'timestamp': {'required': True}, + } + + _attribute_map = { + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'content': {'key': 'content', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(ResourceChangeDataAfterSnapshot, self).__init__(**kwargs) + + +class ResourceChangeDataBeforeSnapshot(ResourceSnapshotData): + """The snapshot before the change. + + All required parameters must be populated in order to send to Azure. + + :param timestamp: Required. The time when the snapshot was created. + The snapshot timestamp provides an approximation as to when a modification + to a resource was detected. There can be a difference between the actual + modification time and the detection time. This is due to differences in + how operations that modify a resource are processed, versus how operation + that record resource snapshots are processed. + :type timestamp: datetime + :param content: The resource snapshot content (in resourceChangeDetails + response only). + :type content: object + """ + + _validation = { + 'timestamp': {'required': True}, + } + + _attribute_map = { + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'content': {'key': 'content', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(ResourceChangeDataBeforeSnapshot, self).__init__(**kwargs) + + +class ResourceChangeDetailsRequestParameters(Model): + """The parameters for a specific change details request. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. Specifies the resource for a change details + request. + :type resource_id: str + :param change_id: Required. Specifies the change ID. + :type change_id: str + """ + + _validation = { + 'resource_id': {'required': True}, + 'change_id': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'change_id': {'key': 'changeId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ResourceChangeDetailsRequestParameters, self).__init__(**kwargs) + self.resource_id = kwargs.get('resource_id', None) + self.change_id = kwargs.get('change_id', None) + + +class ResourceChangeList(Model): + """A list of changes associated with a resource over a specific time interval. + + :param changes: The pageable value returned by the operation, i.e. a list + of changes to the resource. + - The list is ordered from the most recent changes to the least recent + changes. + - This list will be empty if there were no changes during the requested + interval. + - The `Before` snapshot timestamp value of the oldest change can be + outside of the specified time interval. + :type changes: list[~azure.mgmt.resourcegraph.models.ResourceChangeData] + :param skip_token: Skip token that encodes the skip information while + executing the current request + :type skip_token: object + """ + + _attribute_map = { + 'changes': {'key': 'changes', 'type': '[ResourceChangeData]'}, + 'skip_token': {'key': '$skipToken', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(ResourceChangeList, self).__init__(**kwargs) + self.changes = kwargs.get('changes', None) + self.skip_token = kwargs.get('skip_token', None) + + +class ResourceChangesRequestParameters(Model): + """The parameters for a specific changes request. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. Specifies the resource for a changes + request. + :type resource_id: str + :param interval: Required. Specifies the date and time interval for a + changes request. + :type interval: + ~azure.mgmt.resourcegraph.models.ResourceChangesRequestParametersInterval + :param skip_token: Acts as the continuation token for paged responses. + :type skip_token: str + :param top: The maximum number of changes the client can accept in a paged + response. + :type top: int + :param fetch_property_changes: The flag if set to true will fetch property + changes + :type fetch_property_changes: bool + """ + + _validation = { + 'resource_id': {'required': True}, + 'interval': {'required': True}, + 'top': {'maximum': 1000, 'minimum': 1}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'interval': {'key': 'interval', 'type': 'ResourceChangesRequestParametersInterval'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'top': {'key': '$top', 'type': 'int'}, + 'fetch_property_changes': {'key': 'fetchPropertyChanges', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ResourceChangesRequestParameters, self).__init__(**kwargs) + self.resource_id = kwargs.get('resource_id', None) + self.interval = kwargs.get('interval', None) + self.skip_token = kwargs.get('skip_token', None) + self.top = kwargs.get('top', None) + self.fetch_property_changes = kwargs.get('fetch_property_changes', None) + + +class ResourceChangesRequestParametersInterval(DateTimeInterval): + """Specifies the date and time interval for a changes request. + + All required parameters must be populated in order to send to Azure. + + :param start: Required. A datetime indicating the inclusive/closed start + of the time interval, i.e. `[`**`start`**`, end)`. Specifying a `start` + that occurs chronologically after `end` will result in an error. + :type start: datetime + :param end: Required. A datetime indicating the exclusive/open end of the + time interval, i.e. `[start, `**`end`**`)`. Specifying an `end` that + occurs chronologically before `start` will result in an error. + :type end: datetime + """ + + _validation = { + 'start': {'required': True}, + 'end': {'required': True}, + } + + _attribute_map = { + 'start': {'key': 'start', 'type': 'iso-8601'}, + 'end': {'key': 'end', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(ResourceChangesRequestParametersInterval, self).__init__(**kwargs) + + +class ResourcePropertyChange(Model): + """The resource property change. + + All required parameters must be populated in order to send to Azure. + + :param property_name: Required. The property name + :type property_name: str + :param before_value: The property value in before snapshot + :type before_value: str + :param after_value: The property value in after snapshot + :type after_value: str + :param change_category: Required. The change category. Possible values + include: 'User', 'System' + :type change_category: str or + ~azure.mgmt.resourcegraph.models.ChangeCategory + :param property_change_type: Required. The property change Type. Possible + values include: 'Insert', 'Update', 'Remove' + :type property_change_type: str or + ~azure.mgmt.resourcegraph.models.PropertyChangeType + """ + + _validation = { + 'property_name': {'required': True}, + 'change_category': {'required': True}, + 'property_change_type': {'required': True}, + } + + _attribute_map = { + 'property_name': {'key': 'propertyName', 'type': 'str'}, + 'before_value': {'key': 'beforeValue', 'type': 'str'}, + 'after_value': {'key': 'afterValue', 'type': 'str'}, + 'change_category': {'key': 'changeCategory', 'type': 'ChangeCategory'}, + 'property_change_type': {'key': 'propertyChangeType', 'type': 'PropertyChangeType'}, + } + + def __init__(self, **kwargs): + super(ResourcePropertyChange, self).__init__(**kwargs) + self.property_name = kwargs.get('property_name', None) + self.before_value = kwargs.get('before_value', None) + self.after_value = kwargs.get('after_value', None) + self.change_category = kwargs.get('change_category', None) + self.property_change_type = kwargs.get('property_change_type', None) + + class Table(Model): """Query output in tabular format. diff --git a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_models_py3.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_models_py3.py index c63c9f66c1e1..6351ac6ebcaf 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_models_py3.py @@ -49,6 +49,38 @@ def __init__(self, *, name: str, type, **kwargs) -> None: self.type = type +class DateTimeInterval(Model): + """An interval in time specifying the date and time for the inclusive start + and exclusive end, i.e. `[start, end)`. + + All required parameters must be populated in order to send to Azure. + + :param start: Required. A datetime indicating the inclusive/closed start + of the time interval, i.e. `[`**`start`**`, end)`. Specifying a `start` + that occurs chronologically after `end` will result in an error. + :type start: datetime + :param end: Required. A datetime indicating the exclusive/open end of the + time interval, i.e. `[start, `**`end`**`)`. Specifying an `end` that + occurs chronologically before `start` will result in an error. + :type end: datetime + """ + + _validation = { + 'start': {'required': True}, + 'end': {'required': True}, + } + + _attribute_map = { + 'start': {'key': 'start', 'type': 'iso-8601'}, + 'end': {'key': 'end', 'type': 'iso-8601'}, + } + + def __init__(self, *, start, end, **kwargs) -> None: + super(DateTimeInterval, self).__init__(**kwargs) + self.start = start + self.end = end + + class Error(Model): """Error info. @@ -382,9 +414,11 @@ class QueryRequest(Model): All required parameters must be populated in order to send to Azure. - :param subscriptions: Required. Azure subscriptions against which to - execute the query. + :param subscriptions: Azure subscriptions against which to execute the + query. :type subscriptions: list[str] + :param management_group_id: The management group identifier. + :type management_group_id: str :param query: Required. The resources query. :type query: str :param options: The query evaluation options @@ -395,20 +429,21 @@ class QueryRequest(Model): """ _validation = { - 'subscriptions': {'required': True}, 'query': {'required': True}, } _attribute_map = { 'subscriptions': {'key': 'subscriptions', 'type': '[str]'}, + 'management_group_id': {'key': 'managementGroupId', 'type': 'str'}, 'query': {'key': 'query', 'type': 'str'}, 'options': {'key': 'options', 'type': 'QueryRequestOptions'}, 'facets': {'key': 'facets', 'type': '[FacetRequest]'}, } - def __init__(self, *, subscriptions, query: str, options=None, facets=None, **kwargs) -> None: + def __init__(self, *, query: str, subscriptions=None, management_group_id: str=None, options=None, facets=None, **kwargs) -> None: super(QueryRequest, self).__init__(**kwargs) self.subscriptions = subscriptions + self.management_group_id = management_group_id self.query = query self.options = options self.facets = facets @@ -503,6 +538,319 @@ def __init__(self, *, total_records: int, count: int, result_truncated, data, sk self.facets = facets +class ResourceChangeData(Model): + """Data on a specific change, represented by a pair of before and after + resource snapshots. + + All required parameters must be populated in order to send to Azure. + + :param change_id: Required. The change ID. Valid and unique within the + specified resource only. + :type change_id: str + :param before_snapshot: Required. The snapshot before the change. + :type before_snapshot: + ~azure.mgmt.resourcegraph.models.ResourceChangeDataBeforeSnapshot + :param after_snapshot: Required. The snapshot after the change. + :type after_snapshot: + ~azure.mgmt.resourcegraph.models.ResourceChangeDataAfterSnapshot + :param change_type: The change type for snapshot. PropertyChanges will be + provided in case of Update change type. Possible values include: 'Create', + 'Update', 'Delete' + :type change_type: str or ~azure.mgmt.resourcegraph.models.ChangeType + :param property_changes: An array of resource property change + :type property_changes: + list[~azure.mgmt.resourcegraph.models.ResourcePropertyChange] + """ + + _validation = { + 'change_id': {'required': True}, + 'before_snapshot': {'required': True}, + 'after_snapshot': {'required': True}, + } + + _attribute_map = { + 'change_id': {'key': 'changeId', 'type': 'str'}, + 'before_snapshot': {'key': 'beforeSnapshot', 'type': 'ResourceChangeDataBeforeSnapshot'}, + 'after_snapshot': {'key': 'afterSnapshot', 'type': 'ResourceChangeDataAfterSnapshot'}, + 'change_type': {'key': 'changeType', 'type': 'ChangeType'}, + 'property_changes': {'key': 'propertyChanges', 'type': '[ResourcePropertyChange]'}, + } + + def __init__(self, *, change_id: str, before_snapshot, after_snapshot, change_type=None, property_changes=None, **kwargs) -> None: + super(ResourceChangeData, self).__init__(**kwargs) + self.change_id = change_id + self.before_snapshot = before_snapshot + self.after_snapshot = after_snapshot + self.change_type = change_type + self.property_changes = property_changes + + +class ResourceSnapshotData(Model): + """Data on a specific resource snapshot. + + All required parameters must be populated in order to send to Azure. + + :param timestamp: Required. The time when the snapshot was created. + The snapshot timestamp provides an approximation as to when a modification + to a resource was detected. There can be a difference between the actual + modification time and the detection time. This is due to differences in + how operations that modify a resource are processed, versus how operation + that record resource snapshots are processed. + :type timestamp: datetime + :param content: The resource snapshot content (in resourceChangeDetails + response only). + :type content: object + """ + + _validation = { + 'timestamp': {'required': True}, + } + + _attribute_map = { + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'content': {'key': 'content', 'type': 'object'}, + } + + def __init__(self, *, timestamp, content=None, **kwargs) -> None: + super(ResourceSnapshotData, self).__init__(**kwargs) + self.timestamp = timestamp + self.content = content + + +class ResourceChangeDataAfterSnapshot(ResourceSnapshotData): + """The snapshot after the change. + + All required parameters must be populated in order to send to Azure. + + :param timestamp: Required. The time when the snapshot was created. + The snapshot timestamp provides an approximation as to when a modification + to a resource was detected. There can be a difference between the actual + modification time and the detection time. This is due to differences in + how operations that modify a resource are processed, versus how operation + that record resource snapshots are processed. + :type timestamp: datetime + :param content: The resource snapshot content (in resourceChangeDetails + response only). + :type content: object + """ + + _validation = { + 'timestamp': {'required': True}, + } + + _attribute_map = { + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'content': {'key': 'content', 'type': 'object'}, + } + + def __init__(self, *, timestamp, content=None, **kwargs) -> None: + super(ResourceChangeDataAfterSnapshot, self).__init__(timestamp=timestamp, content=content, **kwargs) + + +class ResourceChangeDataBeforeSnapshot(ResourceSnapshotData): + """The snapshot before the change. + + All required parameters must be populated in order to send to Azure. + + :param timestamp: Required. The time when the snapshot was created. + The snapshot timestamp provides an approximation as to when a modification + to a resource was detected. There can be a difference between the actual + modification time and the detection time. This is due to differences in + how operations that modify a resource are processed, versus how operation + that record resource snapshots are processed. + :type timestamp: datetime + :param content: The resource snapshot content (in resourceChangeDetails + response only). + :type content: object + """ + + _validation = { + 'timestamp': {'required': True}, + } + + _attribute_map = { + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'content': {'key': 'content', 'type': 'object'}, + } + + def __init__(self, *, timestamp, content=None, **kwargs) -> None: + super(ResourceChangeDataBeforeSnapshot, self).__init__(timestamp=timestamp, content=content, **kwargs) + + +class ResourceChangeDetailsRequestParameters(Model): + """The parameters for a specific change details request. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. Specifies the resource for a change details + request. + :type resource_id: str + :param change_id: Required. Specifies the change ID. + :type change_id: str + """ + + _validation = { + 'resource_id': {'required': True}, + 'change_id': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'change_id': {'key': 'changeId', 'type': 'str'}, + } + + def __init__(self, *, resource_id: str, change_id: str, **kwargs) -> None: + super(ResourceChangeDetailsRequestParameters, self).__init__(**kwargs) + self.resource_id = resource_id + self.change_id = change_id + + +class ResourceChangeList(Model): + """A list of changes associated with a resource over a specific time interval. + + :param changes: The pageable value returned by the operation, i.e. a list + of changes to the resource. + - The list is ordered from the most recent changes to the least recent + changes. + - This list will be empty if there were no changes during the requested + interval. + - The `Before` snapshot timestamp value of the oldest change can be + outside of the specified time interval. + :type changes: list[~azure.mgmt.resourcegraph.models.ResourceChangeData] + :param skip_token: Skip token that encodes the skip information while + executing the current request + :type skip_token: object + """ + + _attribute_map = { + 'changes': {'key': 'changes', 'type': '[ResourceChangeData]'}, + 'skip_token': {'key': '$skipToken', 'type': 'object'}, + } + + def __init__(self, *, changes=None, skip_token=None, **kwargs) -> None: + super(ResourceChangeList, self).__init__(**kwargs) + self.changes = changes + self.skip_token = skip_token + + +class ResourceChangesRequestParameters(Model): + """The parameters for a specific changes request. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. Specifies the resource for a changes + request. + :type resource_id: str + :param interval: Required. Specifies the date and time interval for a + changes request. + :type interval: + ~azure.mgmt.resourcegraph.models.ResourceChangesRequestParametersInterval + :param skip_token: Acts as the continuation token for paged responses. + :type skip_token: str + :param top: The maximum number of changes the client can accept in a paged + response. + :type top: int + :param fetch_property_changes: The flag if set to true will fetch property + changes + :type fetch_property_changes: bool + """ + + _validation = { + 'resource_id': {'required': True}, + 'interval': {'required': True}, + 'top': {'maximum': 1000, 'minimum': 1}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'interval': {'key': 'interval', 'type': 'ResourceChangesRequestParametersInterval'}, + 'skip_token': {'key': '$skipToken', 'type': 'str'}, + 'top': {'key': '$top', 'type': 'int'}, + 'fetch_property_changes': {'key': 'fetchPropertyChanges', 'type': 'bool'}, + } + + def __init__(self, *, resource_id: str, interval, skip_token: str=None, top: int=None, fetch_property_changes: bool=None, **kwargs) -> None: + super(ResourceChangesRequestParameters, self).__init__(**kwargs) + self.resource_id = resource_id + self.interval = interval + self.skip_token = skip_token + self.top = top + self.fetch_property_changes = fetch_property_changes + + +class ResourceChangesRequestParametersInterval(DateTimeInterval): + """Specifies the date and time interval for a changes request. + + All required parameters must be populated in order to send to Azure. + + :param start: Required. A datetime indicating the inclusive/closed start + of the time interval, i.e. `[`**`start`**`, end)`. Specifying a `start` + that occurs chronologically after `end` will result in an error. + :type start: datetime + :param end: Required. A datetime indicating the exclusive/open end of the + time interval, i.e. `[start, `**`end`**`)`. Specifying an `end` that + occurs chronologically before `start` will result in an error. + :type end: datetime + """ + + _validation = { + 'start': {'required': True}, + 'end': {'required': True}, + } + + _attribute_map = { + 'start': {'key': 'start', 'type': 'iso-8601'}, + 'end': {'key': 'end', 'type': 'iso-8601'}, + } + + def __init__(self, *, start, end, **kwargs) -> None: + super(ResourceChangesRequestParametersInterval, self).__init__(start=start, end=end, **kwargs) + + +class ResourcePropertyChange(Model): + """The resource property change. + + All required parameters must be populated in order to send to Azure. + + :param property_name: Required. The property name + :type property_name: str + :param before_value: The property value in before snapshot + :type before_value: str + :param after_value: The property value in after snapshot + :type after_value: str + :param change_category: Required. The change category. Possible values + include: 'User', 'System' + :type change_category: str or + ~azure.mgmt.resourcegraph.models.ChangeCategory + :param property_change_type: Required. The property change Type. Possible + values include: 'Insert', 'Update', 'Remove' + :type property_change_type: str or + ~azure.mgmt.resourcegraph.models.PropertyChangeType + """ + + _validation = { + 'property_name': {'required': True}, + 'change_category': {'required': True}, + 'property_change_type': {'required': True}, + } + + _attribute_map = { + 'property_name': {'key': 'propertyName', 'type': 'str'}, + 'before_value': {'key': 'beforeValue', 'type': 'str'}, + 'after_value': {'key': 'afterValue', 'type': 'str'}, + 'change_category': {'key': 'changeCategory', 'type': 'ChangeCategory'}, + 'property_change_type': {'key': 'propertyChangeType', 'type': 'PropertyChangeType'}, + } + + def __init__(self, *, property_name: str, change_category, property_change_type, before_value: str=None, after_value: str=None, **kwargs) -> None: + super(ResourcePropertyChange, self).__init__(**kwargs) + self.property_name = property_name + self.before_value = before_value + self.after_value = after_value + self.change_category = change_category + self.property_change_type = property_change_type + + class Table(Model): """Query output in tabular format. diff --git a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_resource_graph_client_enums.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_resource_graph_client_enums.py index 6a5c881e616c..7b391609a226 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_resource_graph_client_enums.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_resource_graph_client_enums.py @@ -37,3 +37,23 @@ class ColumnDataType(str, Enum): number = "number" boolean = "boolean" object_enum = "object" + + +class ChangeType(str, Enum): + + create = "Create" + update = "Update" + delete = "Delete" + + +class ChangeCategory(str, Enum): + + user = "User" + system = "System" + + +class PropertyChangeType(str, Enum): + + insert = "Insert" + update = "Update" + remove = "Remove" diff --git a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/operations/_operations.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/operations/_operations.py index d75001893c83..4bc345b82382 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/operations/_operations.py @@ -25,7 +25,7 @@ class Operations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: API version. Constant value: "2019-04-01". + :ivar api_version: Api Version. Constant value: "2020-04-01-preview". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-04-01" + self.api_version = "2020-04-01-preview" self.config = config diff --git a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/operations/_resource_graph_client_operations.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/operations/_resource_graph_client_operations.py index 0d4d795ebbd2..66f107067c50 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/operations/_resource_graph_client_operations.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/operations/_resource_graph_client_operations.py @@ -73,3 +73,121 @@ def resources( return deserialized resources.metadata = {'url': '/providers/Microsoft.ResourceGraph/resources'} + + def resource_changes( + self, parameters, custom_headers=None, raw=False, **operation_config): + """List changes to a resource for a given time interval. + + :param parameters: the parameters for this request for changes. + :type parameters: + ~azure.mgmt.resourcegraph.models.ResourceChangesRequestParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ResourceChangeList or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.resourcegraph.models.ResourceChangeList or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.resource_changes.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ResourceChangesRequestParameters') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ResourceChangeList', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + resource_changes.metadata = {'url': '/providers/Microsoft.ResourceGraph/resourceChanges'} + + def resource_change_details( + self, resource_id, change_id, custom_headers=None, raw=False, **operation_config): + """Get resource change details. + + :param resource_id: Specifies the resource for a change details + request. + :type resource_id: str + :param change_id: Specifies the change ID. + :type change_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ResourceChangeData or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.resourcegraph.models.ResourceChangeData or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.ResourceChangeDetailsRequestParameters(resource_id=resource_id, change_id=change_id) + + # Construct URL + url = self.resource_change_details.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ResourceChangeDetailsRequestParameters') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ResourceChangeData', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + resource_change_details.metadata = {'url': '/providers/Microsoft.ResourceGraph/resourceChangeDetails'}