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..0bd35c8c1aad 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 = '2021-03-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) 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..79a125e84c6b 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 @@ -296,8 +296,8 @@ class FacetResult(Facet): :type total_records: long :param count: Required. Number of records returned in the facet response. :type count: int - :param data: Required. A table containing the desired facets. Only present - if the facet is valid. + :param data: Required. A JObject array or Table containing the desired + facets. Only present if the facet is valid. :type data: object """ @@ -382,9 +382,12 @@ 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_groups: Azure management groups against which to execute + the query. Example: [ 'mg1', 'mg2' ] + :type management_groups: list[str] :param query: Required. The resources query. :type query: str :param options: The query evaluation options @@ -395,12 +398,12 @@ class QueryRequest(Model): """ _validation = { - 'subscriptions': {'required': True}, 'query': {'required': True}, } _attribute_map = { 'subscriptions': {'key': 'subscriptions', 'type': '[str]'}, + 'management_groups': {'key': 'managementGroups', 'type': '[str]'}, 'query': {'key': 'query', 'type': 'str'}, 'options': {'key': 'options', 'type': 'QueryRequestOptions'}, 'facets': {'key': 'facets', 'type': '[FacetRequest]'}, @@ -409,6 +412,7 @@ class QueryRequest(Model): def __init__(self, **kwargs): super(QueryRequest, self).__init__(**kwargs) self.subscriptions = kwargs.get('subscriptions', None) + self.management_groups = kwargs.get('management_groups', None) self.query = kwargs.get('query', None) self.options = kwargs.get('options', None) self.facets = kwargs.get('facets', None) @@ -427,8 +431,14 @@ class QueryRequestOptions(Model): Overrides the next page offset when ```$skipToken``` property is present. :type skip: int :param result_format: Defines in which format query result returned. - Possible values include: 'table', 'objectArray' + Possible values include: 'table', 'objectArray'. Default value: + "objectArray" . :type result_format: str or ~azure.mgmt.resourcegraph.models.ResultFormat + :param allow_partial_scopes: Only applicable for tenant and management + group level queries to decide whether to allow partial scopes for result + in case the number of subscriptions exceed allowed limits. Default value: + False . + :type allow_partial_scopes: bool """ _validation = { @@ -441,6 +451,7 @@ class QueryRequestOptions(Model): 'top': {'key': '$top', 'type': 'int'}, 'skip': {'key': '$skip', 'type': 'int'}, 'result_format': {'key': 'resultFormat', 'type': 'ResultFormat'}, + 'allow_partial_scopes': {'key': 'allowPartialScopes', 'type': 'bool'}, } def __init__(self, **kwargs): @@ -448,7 +459,8 @@ def __init__(self, **kwargs): self.skip_token = kwargs.get('skip_token', None) self.top = kwargs.get('top', None) self.skip = kwargs.get('skip', None) - self.result_format = kwargs.get('result_format', None) + self.result_format = kwargs.get('result_format', "objectArray") + self.allow_partial_scopes = kwargs.get('allow_partial_scopes', False) class QueryResponse(Model): @@ -468,10 +480,10 @@ class QueryResponse(Model): :type result_truncated: str or ~azure.mgmt.resourcegraph.models.ResultTruncated :param skip_token: When present, the value can be passed to a subsequent - query call (together with the same query and subscriptions used in the - current request) to retrieve the next page of data. + query call (together with the same query and scopes used in the current + request) to retrieve the next page of data. :type skip_token: str - :param data: Required. Query output in tabular format. + :param data: Required. Query output in JObject array or Table format. :type data: object :param facets: Query facets. :type facets: list[~azure.mgmt.resourcegraph.models.Facet] 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..d03bd601d0c6 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 @@ -296,8 +296,8 @@ class FacetResult(Facet): :type total_records: long :param count: Required. Number of records returned in the facet response. :type count: int - :param data: Required. A table containing the desired facets. Only present - if the facet is valid. + :param data: Required. A JObject array or Table containing the desired + facets. Only present if the facet is valid. :type data: object """ @@ -382,9 +382,12 @@ 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_groups: Azure management groups against which to execute + the query. Example: [ 'mg1', 'mg2' ] + :type management_groups: list[str] :param query: Required. The resources query. :type query: str :param options: The query evaluation options @@ -395,20 +398,21 @@ class QueryRequest(Model): """ _validation = { - 'subscriptions': {'required': True}, 'query': {'required': True}, } _attribute_map = { 'subscriptions': {'key': 'subscriptions', 'type': '[str]'}, + 'management_groups': {'key': 'managementGroups', '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_groups=None, options=None, facets=None, **kwargs) -> None: super(QueryRequest, self).__init__(**kwargs) self.subscriptions = subscriptions + self.management_groups = management_groups self.query = query self.options = options self.facets = facets @@ -427,8 +431,14 @@ class QueryRequestOptions(Model): Overrides the next page offset when ```$skipToken``` property is present. :type skip: int :param result_format: Defines in which format query result returned. - Possible values include: 'table', 'objectArray' + Possible values include: 'table', 'objectArray'. Default value: + "objectArray" . :type result_format: str or ~azure.mgmt.resourcegraph.models.ResultFormat + :param allow_partial_scopes: Only applicable for tenant and management + group level queries to decide whether to allow partial scopes for result + in case the number of subscriptions exceed allowed limits. Default value: + False . + :type allow_partial_scopes: bool """ _validation = { @@ -441,14 +451,16 @@ class QueryRequestOptions(Model): 'top': {'key': '$top', 'type': 'int'}, 'skip': {'key': '$skip', 'type': 'int'}, 'result_format': {'key': 'resultFormat', 'type': 'ResultFormat'}, + 'allow_partial_scopes': {'key': 'allowPartialScopes', 'type': 'bool'}, } - def __init__(self, *, skip_token: str=None, top: int=None, skip: int=None, result_format=None, **kwargs) -> None: + def __init__(self, *, skip_token: str=None, top: int=None, skip: int=None, result_format="objectArray", allow_partial_scopes: bool=False, **kwargs) -> None: super(QueryRequestOptions, self).__init__(**kwargs) self.skip_token = skip_token self.top = top self.skip = skip self.result_format = result_format + self.allow_partial_scopes = allow_partial_scopes class QueryResponse(Model): @@ -468,10 +480,10 @@ class QueryResponse(Model): :type result_truncated: str or ~azure.mgmt.resourcegraph.models.ResultTruncated :param skip_token: When present, the value can be passed to a subsequent - query call (together with the same query and subscriptions used in the - current request) to retrieve the next page of data. + query call (together with the same query and scopes used in the current + request) to retrieve the next page of data. :type skip_token: str - :param data: Required. Query output in tabular format. + :param data: Required. Query output in JObject array or Table format. :type data: object :param facets: Query facets. :type facets: list[~azure.mgmt.resourcegraph.models.Facet] 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..672df29bde41 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 @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -25,7 +24,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: "2021-03-01". """ models = models @@ -35,7 +34,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 = "2021-03-01" self.config = config @@ -51,7 +50,8 @@ def list( :return: An iterator like instance of Operation :rtype: ~azure.mgmt.resourcegraph.models.OperationPaged[~azure.mgmt.resourcegraph.models.Operation] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -86,9 +86,7 @@ def internal_paging(next_link=None): response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) return response 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..049aa5d67583 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 @@ -10,7 +10,6 @@ # -------------------------------------------------------------------------- from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models import uuid @@ -19,8 +18,8 @@ class ResourceGraphClientOperationsMixin(object): def resources( self, query, custom_headers=None, raw=False, **operation_config): - """Queries the resources managed by Azure Resource Manager for all - subscriptions specified in the request. + """Queries the resources managed by Azure Resource Manager for scopes + specified in the request. :param query: Request specifying query and its options. :type query: ~azure.mgmt.resourcegraph.models.QueryRequest