diff --git a/azure-mgmt-resourcegraph/MANIFEST.in b/azure-mgmt-resourcegraph/MANIFEST.in index 6ceb27f7a96e..e4884efef41b 100644 --- a/azure-mgmt-resourcegraph/MANIFEST.in +++ b/azure-mgmt-resourcegraph/MANIFEST.in @@ -1,3 +1,4 @@ +recursive-include tests *.py *.yaml include *.rst include azure/__init__.py include azure/mgmt/__init__.py diff --git a/azure-mgmt-resourcegraph/README.rst b/azure-mgmt-resourcegraph/README.rst index 96a089ff2698..eac5fcf7dc63 100644 --- a/azure-mgmt-resourcegraph/README.rst +++ b/azure-mgmt-resourcegraph/README.rst @@ -14,25 +14,6 @@ For the older Azure Service Management (ASM) libraries, see For a more complete set of Azure libraries, see the `azure `__ bundle package. -Compatibility -============= - -**IMPORTANT**: If you have an earlier version of the azure package -(version < 1.0), you should uninstall it before installing this package. - -You can check the version using pip: - -.. code:: shell - - pip freeze - -If you see azure==0.11.0 (or any version below 1.0), uninstall it first: - -.. code:: shell - - pip uninstall azure - - Usage ===== @@ -47,3 +28,6 @@ Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the `Issues `__ section of the project. + + +.. image:: https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-resourcegraph%2FREADME.png diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/__init__.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/__init__.py index b9665e9850d4..a8db6d6463ab 100644 --- a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/__init__.py +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/__init__.py @@ -21,6 +21,15 @@ from .facet_result_py3 import FacetResult from .error_details_py3 import ErrorDetails from .facet_error_py3 import FacetError + from .resource_changes_request_parameters_interval_py3 import ResourceChangesRequestParametersInterval + from .resource_changes_request_parameters_py3 import ResourceChangesRequestParameters + from .resource_change_data_before_snapshot_py3 import ResourceChangeDataBeforeSnapshot + from .resource_change_data_after_snapshot_py3 import ResourceChangeDataAfterSnapshot + from .resource_change_data_py3 import ResourceChangeData + from .resource_change_list_py3 import ResourceChangeList + from .resource_snapshot_data_py3 import ResourceSnapshotData + from .resource_change_details_request_parameters_py3 import ResourceChangeDetailsRequestParameters + from .date_time_interval_py3 import DateTimeInterval from .error_py3 import Error from .error_response_py3 import ErrorResponse, ErrorResponseException from .operation_display_py3 import OperationDisplay @@ -37,6 +46,15 @@ from .facet_result import FacetResult from .error_details import ErrorDetails from .facet_error import FacetError + from .resource_changes_request_parameters_interval import ResourceChangesRequestParametersInterval + from .resource_changes_request_parameters import ResourceChangesRequestParameters + from .resource_change_data_before_snapshot import ResourceChangeDataBeforeSnapshot + from .resource_change_data_after_snapshot import ResourceChangeDataAfterSnapshot + from .resource_change_data import ResourceChangeData + from .resource_change_list import ResourceChangeList + from .resource_snapshot_data import ResourceSnapshotData + from .resource_change_details_request_parameters import ResourceChangeDetailsRequestParameters + from .date_time_interval import DateTimeInterval from .error import Error from .error_response import ErrorResponse, ErrorResponseException from .operation_display import OperationDisplay @@ -60,6 +78,15 @@ 'FacetResult', 'ErrorDetails', 'FacetError', + 'ResourceChangesRequestParametersInterval', + 'ResourceChangesRequestParameters', + 'ResourceChangeDataBeforeSnapshot', + 'ResourceChangeDataAfterSnapshot', + 'ResourceChangeData', + 'ResourceChangeList', + 'ResourceSnapshotData', + 'ResourceChangeDetailsRequestParameters', + 'DateTimeInterval', 'Error', 'ErrorResponse', 'ErrorResponseException', 'OperationDisplay', diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/date_time_interval.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/date_time_interval.py new file mode 100644 index 000000000000..4a58e6079723 --- /dev/null +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/date_time_interval.py @@ -0,0 +1,44 @@ +# 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 msrest.serialization import Model + + +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) diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/date_time_interval_py3.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/date_time_interval_py3.py new file mode 100644 index 000000000000..ad32b98bfa1c --- /dev/null +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/date_time_interval_py3.py @@ -0,0 +1,44 @@ +# 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 msrest.serialization import Model + + +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 diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_data.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_data.py new file mode 100644 index 000000000000..286e331f966c --- /dev/null +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_data.py @@ -0,0 +1,48 @@ +# 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 msrest.serialization import Model + + +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 + """ + + _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'}, + } + + 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) diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_data_after_snapshot.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_data_after_snapshot.py new file mode 100644 index 000000000000..ac485c0fe1d7 --- /dev/null +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_data_after_snapshot.py @@ -0,0 +1,42 @@ +# 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 .resource_snapshot_data import ResourceSnapshotData + + +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) diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_data_after_snapshot_py3.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_data_after_snapshot_py3.py new file mode 100644 index 000000000000..f9950ca433d0 --- /dev/null +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_data_after_snapshot_py3.py @@ -0,0 +1,42 @@ +# 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 .resource_snapshot_data_py3 import ResourceSnapshotData + + +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) diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_data_before_snapshot.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_data_before_snapshot.py new file mode 100644 index 000000000000..d26366cf6de5 --- /dev/null +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_data_before_snapshot.py @@ -0,0 +1,42 @@ +# 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 .resource_snapshot_data import ResourceSnapshotData + + +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) diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_data_before_snapshot_py3.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_data_before_snapshot_py3.py new file mode 100644 index 000000000000..c0ffbc39d645 --- /dev/null +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_data_before_snapshot_py3.py @@ -0,0 +1,42 @@ +# 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 .resource_snapshot_data_py3 import ResourceSnapshotData + + +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) diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_data_py3.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_data_py3.py new file mode 100644 index 000000000000..5cf6885a8dfe --- /dev/null +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_data_py3.py @@ -0,0 +1,48 @@ +# 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 msrest.serialization import Model + + +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 + """ + + _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'}, + } + + def __init__(self, *, change_id: str, before_snapshot, after_snapshot, **kwargs) -> None: + super(ResourceChangeData, self).__init__(**kwargs) + self.change_id = change_id + self.before_snapshot = before_snapshot + self.after_snapshot = after_snapshot diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_details_request_parameters.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_details_request_parameters.py new file mode 100644 index 000000000000..4f220e5ac509 --- /dev/null +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_details_request_parameters.py @@ -0,0 +1,40 @@ +# 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 msrest.serialization import Model + + +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) diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_details_request_parameters_py3.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_details_request_parameters_py3.py new file mode 100644 index 000000000000..781fdcb711a6 --- /dev/null +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_details_request_parameters_py3.py @@ -0,0 +1,40 @@ +# 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 msrest.serialization import Model + + +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 diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_list.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_list.py new file mode 100644 index 000000000000..6c75d262778f --- /dev/null +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_list.py @@ -0,0 +1,40 @@ +# 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 msrest.serialization import Model + + +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) diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_list_py3.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_list_py3.py new file mode 100644 index 000000000000..4127ebc3a626 --- /dev/null +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_change_list_py3.py @@ -0,0 +1,40 @@ +# 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 msrest.serialization import Model + + +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 diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_changes_request_parameters.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_changes_request_parameters.py new file mode 100644 index 000000000000..3e4798d6bd1f --- /dev/null +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_changes_request_parameters.py @@ -0,0 +1,52 @@ +# 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 msrest.serialization import Model + + +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 + """ + + _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'}, + } + + 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) diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_changes_request_parameters_interval.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_changes_request_parameters_interval.py new file mode 100644 index 000000000000..abed36af27cf --- /dev/null +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_changes_request_parameters_interval.py @@ -0,0 +1,41 @@ +# 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 .date_time_interval import DateTimeInterval + + +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) diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_changes_request_parameters_interval_py3.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_changes_request_parameters_interval_py3.py new file mode 100644 index 000000000000..bef210f0dafa --- /dev/null +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_changes_request_parameters_interval_py3.py @@ -0,0 +1,41 @@ +# 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 .date_time_interval_py3 import DateTimeInterval + + +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) diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_changes_request_parameters_py3.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_changes_request_parameters_py3.py new file mode 100644 index 000000000000..9fe9fa4bbf9c --- /dev/null +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_changes_request_parameters_py3.py @@ -0,0 +1,52 @@ +# 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 msrest.serialization import Model + + +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 + """ + + _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'}, + } + + def __init__(self, *, resource_id: str, interval, skip_token: str=None, top: int=None, **kwargs) -> None: + super(ResourceChangesRequestParameters, self).__init__(**kwargs) + self.resource_id = resource_id + self.interval = interval + self.skip_token = skip_token + self.top = top diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_snapshot_data.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_snapshot_data.py new file mode 100644 index 000000000000..69179a315d42 --- /dev/null +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_snapshot_data.py @@ -0,0 +1,44 @@ +# 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 msrest.serialization import Model + + +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) diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_snapshot_data_py3.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_snapshot_data_py3.py new file mode 100644 index 000000000000..65961a2bdd82 --- /dev/null +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/resource_snapshot_data_py3.py @@ -0,0 +1,44 @@ +# 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 msrest.serialization import Model + + +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 diff --git a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/resource_graph_client.py b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/resource_graph_client.py index 6f5ff0e93e33..dbead393d965 100644 --- a/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/resource_graph_client.py +++ b/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/resource_graph_client.py @@ -133,3 +133,123 @@ 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'}