Best Python code snippet using slash
policy_states_operations.py
Source:policy_states_operations.py
1# coding=utf-82# --------------------------------------------------------------------------3# Copyright (c) Microsoft Corporation. All rights reserved.4# Licensed under the MIT License. See License.txt in the project root for5# license information.6#7# Code generated by Microsoft (R) AutoRest Code Generator.8# Changes may cause incorrect behavior and will be lost if the code is9# regenerated.10# --------------------------------------------------------------------------11import uuid12from msrest.pipeline import ClientRawResponse13from .. import models14class PolicyStatesOperations(object):15 """PolicyStatesOperations operations.16 :param client: Client for service requests.17 :param config: Configuration of service client.18 :param serializer: An object model serializer.19 :param deserializer: An object model deserializer.20 :ivar management_groups_namespace: The namespace for Microsoft Management RP; only "Microsoft.Management" is allowed. Constant value: "Microsoft.Management".21 :ivar api_version: Client Api Version. Constant value: "2018-07-01-preview".22 :ivar policy_states_summary_resource: The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. Constant value: "latest".23 :ivar authorization_namespace: The namespace for Microsoft Authorization resource provider; only "Microsoft.Authorization" is allowed. Constant value: "Microsoft.Authorization".24 """25 models = models26 def __init__(self, client, config, serializer, deserializer):27 self._client = client28 self._serialize = serializer29 self._deserialize = deserializer30 self.management_groups_namespace = "Microsoft.Management"31 self.api_version = "2018-07-01-preview"32 self.policy_states_summary_resource = "latest"33 self.authorization_namespace = "Microsoft.Authorization"34 self.config = config35 def list_query_results_for_management_group(36 self, policy_states_resource, management_group_name, query_options=None, custom_headers=None, raw=False, **operation_config):37 """Queries policy states for the resources under the management group.38 :param policy_states_resource: The virtual resource under PolicyStates39 resource type. In a given time range, 'latest' represents the latest40 policy state(s), whereas 'default' represents all policy state(s).41 Possible values include: 'default', 'latest'42 :type policy_states_resource: str or43 ~azure.mgmt.policyinsights.models.PolicyStatesResource44 :param management_group_name: Management group name.45 :type management_group_name: str46 :param query_options: Additional parameters for the operation47 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions48 :param dict custom_headers: headers that will be added to the request49 :param bool raw: returns the direct response alongside the50 deserialized response51 :param operation_config: :ref:`Operation configuration52 overrides<msrest:optionsforoperations>`.53 :return: PolicyStatesQueryResults or ClientRawResponse if raw=true54 :rtype: ~azure.mgmt.policyinsights.models.PolicyStatesQueryResults or55 ~msrest.pipeline.ClientRawResponse56 :raises:57 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`58 """59 top = None60 if query_options is not None:61 top = query_options.top62 order_by = None63 if query_options is not None:64 order_by = query_options.order_by65 select = None66 if query_options is not None:67 select = query_options.select68 from_parameter = None69 if query_options is not None:70 from_parameter = query_options.from_property71 to = None72 if query_options is not None:73 to = query_options.to74 filter = None75 if query_options is not None:76 filter = query_options.filter77 apply = None78 if query_options is not None:79 apply = query_options.apply80 # Construct URL81 url = self.list_query_results_for_management_group.metadata['url']82 path_format_arguments = {83 'policyStatesResource': self._serialize.url("policy_states_resource", policy_states_resource, 'str'),84 'managementGroupsNamespace': self._serialize.url("self.management_groups_namespace", self.management_groups_namespace, 'str'),85 'managementGroupName': self._serialize.url("management_group_name", management_group_name, 'str')86 }87 url = self._client.format_url(url, **path_format_arguments)88 # Construct parameters89 query_parameters = {}90 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')91 if top is not None:92 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)93 if order_by is not None:94 query_parameters['$orderby'] = self._serialize.query("order_by", order_by, 'str')95 if select is not None:96 query_parameters['$select'] = self._serialize.query("select", select, 'str')97 if from_parameter is not None:98 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')99 if to is not None:100 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')101 if filter is not None:102 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')103 if apply is not None:104 query_parameters['$apply'] = self._serialize.query("apply", apply, 'str')105 # Construct headers106 header_parameters = {}107 header_parameters['Accept'] = 'application/json'108 if self.config.generate_client_request_id:109 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())110 if custom_headers:111 header_parameters.update(custom_headers)112 if self.config.accept_language is not None:113 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')114 # Construct and send request115 request = self._client.post(url, query_parameters, header_parameters)116 response = self._client.send(request, stream=False, **operation_config)117 if response.status_code not in [200]:118 raise models.QueryFailureException(self._deserialize, response)119 deserialized = None120 if response.status_code == 200:121 deserialized = self._deserialize('PolicyStatesQueryResults', response)122 if raw:123 client_raw_response = ClientRawResponse(deserialized, response)124 return client_raw_response125 return deserialized126 list_query_results_for_management_group.metadata = {'url': '/providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'}127 def summarize_for_management_group(128 self, management_group_name, query_options=None, custom_headers=None, raw=False, **operation_config):129 """Summarizes policy states for the resources under the management group.130 :param management_group_name: Management group name.131 :type management_group_name: str132 :param query_options: Additional parameters for the operation133 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions134 :param dict custom_headers: headers that will be added to the request135 :param bool raw: returns the direct response alongside the136 deserialized response137 :param operation_config: :ref:`Operation configuration138 overrides<msrest:optionsforoperations>`.139 :return: SummarizeResults or ClientRawResponse if raw=true140 :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults or141 ~msrest.pipeline.ClientRawResponse142 :raises:143 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`144 """145 top = None146 if query_options is not None:147 top = query_options.top148 from_parameter = None149 if query_options is not None:150 from_parameter = query_options.from_property151 to = None152 if query_options is not None:153 to = query_options.to154 filter = None155 if query_options is not None:156 filter = query_options.filter157 # Construct URL158 url = self.summarize_for_management_group.metadata['url']159 path_format_arguments = {160 'policyStatesSummaryResource': self._serialize.url("self.policy_states_summary_resource", self.policy_states_summary_resource, 'str'),161 'managementGroupsNamespace': self._serialize.url("self.management_groups_namespace", self.management_groups_namespace, 'str'),162 'managementGroupName': self._serialize.url("management_group_name", management_group_name, 'str')163 }164 url = self._client.format_url(url, **path_format_arguments)165 # Construct parameters166 query_parameters = {}167 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')168 if top is not None:169 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)170 if from_parameter is not None:171 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')172 if to is not None:173 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')174 if filter is not None:175 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')176 # Construct headers177 header_parameters = {}178 header_parameters['Accept'] = 'application/json'179 if self.config.generate_client_request_id:180 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())181 if custom_headers:182 header_parameters.update(custom_headers)183 if self.config.accept_language is not None:184 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')185 # Construct and send request186 request = self._client.post(url, query_parameters, header_parameters)187 response = self._client.send(request, stream=False, **operation_config)188 if response.status_code not in [200]:189 raise models.QueryFailureException(self._deserialize, response)190 deserialized = None191 if response.status_code == 200:192 deserialized = self._deserialize('SummarizeResults', response)193 if raw:194 client_raw_response = ClientRawResponse(deserialized, response)195 return client_raw_response196 return deserialized197 summarize_for_management_group.metadata = {'url': '/providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'}198 def list_query_results_for_subscription(199 self, policy_states_resource, subscription_id, query_options=None, custom_headers=None, raw=False, **operation_config):200 """Queries policy states for the resources under the subscription.201 :param policy_states_resource: The virtual resource under PolicyStates202 resource type. In a given time range, 'latest' represents the latest203 policy state(s), whereas 'default' represents all policy state(s).204 Possible values include: 'default', 'latest'205 :type policy_states_resource: str or206 ~azure.mgmt.policyinsights.models.PolicyStatesResource207 :param subscription_id: Microsoft Azure subscription ID.208 :type subscription_id: str209 :param query_options: Additional parameters for the operation210 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions211 :param dict custom_headers: headers that will be added to the request212 :param bool raw: returns the direct response alongside the213 deserialized response214 :param operation_config: :ref:`Operation configuration215 overrides<msrest:optionsforoperations>`.216 :return: PolicyStatesQueryResults or ClientRawResponse if raw=true217 :rtype: ~azure.mgmt.policyinsights.models.PolicyStatesQueryResults or218 ~msrest.pipeline.ClientRawResponse219 :raises:220 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`221 """222 top = None223 if query_options is not None:224 top = query_options.top225 order_by = None226 if query_options is not None:227 order_by = query_options.order_by228 select = None229 if query_options is not None:230 select = query_options.select231 from_parameter = None232 if query_options is not None:233 from_parameter = query_options.from_property234 to = None235 if query_options is not None:236 to = query_options.to237 filter = None238 if query_options is not None:239 filter = query_options.filter240 apply = None241 if query_options is not None:242 apply = query_options.apply243 # Construct URL244 url = self.list_query_results_for_subscription.metadata['url']245 path_format_arguments = {246 'policyStatesResource': self._serialize.url("policy_states_resource", policy_states_resource, 'str'),247 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str')248 }249 url = self._client.format_url(url, **path_format_arguments)250 # Construct parameters251 query_parameters = {}252 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')253 if top is not None:254 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)255 if order_by is not None:256 query_parameters['$orderby'] = self._serialize.query("order_by", order_by, 'str')257 if select is not None:258 query_parameters['$select'] = self._serialize.query("select", select, 'str')259 if from_parameter is not None:260 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')261 if to is not None:262 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')263 if filter is not None:264 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')265 if apply is not None:266 query_parameters['$apply'] = self._serialize.query("apply", apply, 'str')267 # Construct headers268 header_parameters = {}269 header_parameters['Accept'] = 'application/json'270 if self.config.generate_client_request_id:271 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())272 if custom_headers:273 header_parameters.update(custom_headers)274 if self.config.accept_language is not None:275 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')276 # Construct and send request277 request = self._client.post(url, query_parameters, header_parameters)278 response = self._client.send(request, stream=False, **operation_config)279 if response.status_code not in [200]:280 raise models.QueryFailureException(self._deserialize, response)281 deserialized = None282 if response.status_code == 200:283 deserialized = self._deserialize('PolicyStatesQueryResults', response)284 if raw:285 client_raw_response = ClientRawResponse(deserialized, response)286 return client_raw_response287 return deserialized288 list_query_results_for_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'}289 def summarize_for_subscription(290 self, subscription_id, query_options=None, custom_headers=None, raw=False, **operation_config):291 """Summarizes policy states for the resources under the subscription.292 :param subscription_id: Microsoft Azure subscription ID.293 :type subscription_id: str294 :param query_options: Additional parameters for the operation295 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions296 :param dict custom_headers: headers that will be added to the request297 :param bool raw: returns the direct response alongside the298 deserialized response299 :param operation_config: :ref:`Operation configuration300 overrides<msrest:optionsforoperations>`.301 :return: SummarizeResults or ClientRawResponse if raw=true302 :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults or303 ~msrest.pipeline.ClientRawResponse304 :raises:305 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`306 """307 top = None308 if query_options is not None:309 top = query_options.top310 from_parameter = None311 if query_options is not None:312 from_parameter = query_options.from_property313 to = None314 if query_options is not None:315 to = query_options.to316 filter = None317 if query_options is not None:318 filter = query_options.filter319 # Construct URL320 url = self.summarize_for_subscription.metadata['url']321 path_format_arguments = {322 'policyStatesSummaryResource': self._serialize.url("self.policy_states_summary_resource", self.policy_states_summary_resource, 'str'),323 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str')324 }325 url = self._client.format_url(url, **path_format_arguments)326 # Construct parameters327 query_parameters = {}328 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')329 if top is not None:330 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)331 if from_parameter is not None:332 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')333 if to is not None:334 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')335 if filter is not None:336 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')337 # Construct headers338 header_parameters = {}339 header_parameters['Accept'] = 'application/json'340 if self.config.generate_client_request_id:341 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())342 if custom_headers:343 header_parameters.update(custom_headers)344 if self.config.accept_language is not None:345 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')346 # Construct and send request347 request = self._client.post(url, query_parameters, header_parameters)348 response = self._client.send(request, stream=False, **operation_config)349 if response.status_code not in [200]:350 raise models.QueryFailureException(self._deserialize, response)351 deserialized = None352 if response.status_code == 200:353 deserialized = self._deserialize('SummarizeResults', response)354 if raw:355 client_raw_response = ClientRawResponse(deserialized, response)356 return client_raw_response357 return deserialized358 summarize_for_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'}359 def list_query_results_for_resource_group(360 self, policy_states_resource, subscription_id, resource_group_name, query_options=None, custom_headers=None, raw=False, **operation_config):361 """Queries policy states for the resources under the resource group.362 :param policy_states_resource: The virtual resource under PolicyStates363 resource type. In a given time range, 'latest' represents the latest364 policy state(s), whereas 'default' represents all policy state(s).365 Possible values include: 'default', 'latest'366 :type policy_states_resource: str or367 ~azure.mgmt.policyinsights.models.PolicyStatesResource368 :param subscription_id: Microsoft Azure subscription ID.369 :type subscription_id: str370 :param resource_group_name: Resource group name.371 :type resource_group_name: str372 :param query_options: Additional parameters for the operation373 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions374 :param dict custom_headers: headers that will be added to the request375 :param bool raw: returns the direct response alongside the376 deserialized response377 :param operation_config: :ref:`Operation configuration378 overrides<msrest:optionsforoperations>`.379 :return: PolicyStatesQueryResults or ClientRawResponse if raw=true380 :rtype: ~azure.mgmt.policyinsights.models.PolicyStatesQueryResults or381 ~msrest.pipeline.ClientRawResponse382 :raises:383 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`384 """385 top = None386 if query_options is not None:387 top = query_options.top388 order_by = None389 if query_options is not None:390 order_by = query_options.order_by391 select = None392 if query_options is not None:393 select = query_options.select394 from_parameter = None395 if query_options is not None:396 from_parameter = query_options.from_property397 to = None398 if query_options is not None:399 to = query_options.to400 filter = None401 if query_options is not None:402 filter = query_options.filter403 apply = None404 if query_options is not None:405 apply = query_options.apply406 # Construct URL407 url = self.list_query_results_for_resource_group.metadata['url']408 path_format_arguments = {409 'policyStatesResource': self._serialize.url("policy_states_resource", policy_states_resource, 'str'),410 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),411 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str')412 }413 url = self._client.format_url(url, **path_format_arguments)414 # Construct parameters415 query_parameters = {}416 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')417 if top is not None:418 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)419 if order_by is not None:420 query_parameters['$orderby'] = self._serialize.query("order_by", order_by, 'str')421 if select is not None:422 query_parameters['$select'] = self._serialize.query("select", select, 'str')423 if from_parameter is not None:424 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')425 if to is not None:426 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')427 if filter is not None:428 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')429 if apply is not None:430 query_parameters['$apply'] = self._serialize.query("apply", apply, 'str')431 # Construct headers432 header_parameters = {}433 header_parameters['Accept'] = 'application/json'434 if self.config.generate_client_request_id:435 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())436 if custom_headers:437 header_parameters.update(custom_headers)438 if self.config.accept_language is not None:439 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')440 # Construct and send request441 request = self._client.post(url, query_parameters, header_parameters)442 response = self._client.send(request, stream=False, **operation_config)443 if response.status_code not in [200]:444 raise models.QueryFailureException(self._deserialize, response)445 deserialized = None446 if response.status_code == 200:447 deserialized = self._deserialize('PolicyStatesQueryResults', response)448 if raw:449 client_raw_response = ClientRawResponse(deserialized, response)450 return client_raw_response451 return deserialized452 list_query_results_for_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'}453 def summarize_for_resource_group(454 self, subscription_id, resource_group_name, query_options=None, custom_headers=None, raw=False, **operation_config):455 """Summarizes policy states for the resources under the resource group.456 :param subscription_id: Microsoft Azure subscription ID.457 :type subscription_id: str458 :param resource_group_name: Resource group name.459 :type resource_group_name: str460 :param query_options: Additional parameters for the operation461 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions462 :param dict custom_headers: headers that will be added to the request463 :param bool raw: returns the direct response alongside the464 deserialized response465 :param operation_config: :ref:`Operation configuration466 overrides<msrest:optionsforoperations>`.467 :return: SummarizeResults or ClientRawResponse if raw=true468 :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults or469 ~msrest.pipeline.ClientRawResponse470 :raises:471 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`472 """473 top = None474 if query_options is not None:475 top = query_options.top476 from_parameter = None477 if query_options is not None:478 from_parameter = query_options.from_property479 to = None480 if query_options is not None:481 to = query_options.to482 filter = None483 if query_options is not None:484 filter = query_options.filter485 # Construct URL486 url = self.summarize_for_resource_group.metadata['url']487 path_format_arguments = {488 'policyStatesSummaryResource': self._serialize.url("self.policy_states_summary_resource", self.policy_states_summary_resource, 'str'),489 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),490 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str')491 }492 url = self._client.format_url(url, **path_format_arguments)493 # Construct parameters494 query_parameters = {}495 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')496 if top is not None:497 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)498 if from_parameter is not None:499 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')500 if to is not None:501 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')502 if filter is not None:503 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')504 # Construct headers505 header_parameters = {}506 header_parameters['Accept'] = 'application/json'507 if self.config.generate_client_request_id:508 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())509 if custom_headers:510 header_parameters.update(custom_headers)511 if self.config.accept_language is not None:512 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')513 # Construct and send request514 request = self._client.post(url, query_parameters, header_parameters)515 response = self._client.send(request, stream=False, **operation_config)516 if response.status_code not in [200]:517 raise models.QueryFailureException(self._deserialize, response)518 deserialized = None519 if response.status_code == 200:520 deserialized = self._deserialize('SummarizeResults', response)521 if raw:522 client_raw_response = ClientRawResponse(deserialized, response)523 return client_raw_response524 return deserialized525 summarize_for_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'}526 def list_query_results_for_resource(527 self, policy_states_resource, resource_id, query_options=None, custom_headers=None, raw=False, **operation_config):528 """Queries policy states for the resource.529 :param policy_states_resource: The virtual resource under PolicyStates530 resource type. In a given time range, 'latest' represents the latest531 policy state(s), whereas 'default' represents all policy state(s).532 Possible values include: 'default', 'latest'533 :type policy_states_resource: str or534 ~azure.mgmt.policyinsights.models.PolicyStatesResource535 :param resource_id: Resource ID.536 :type resource_id: str537 :param query_options: Additional parameters for the operation538 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions539 :param dict custom_headers: headers that will be added to the request540 :param bool raw: returns the direct response alongside the541 deserialized response542 :param operation_config: :ref:`Operation configuration543 overrides<msrest:optionsforoperations>`.544 :return: PolicyStatesQueryResults or ClientRawResponse if raw=true545 :rtype: ~azure.mgmt.policyinsights.models.PolicyStatesQueryResults or546 ~msrest.pipeline.ClientRawResponse547 :raises:548 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`549 """550 top = None551 if query_options is not None:552 top = query_options.top553 order_by = None554 if query_options is not None:555 order_by = query_options.order_by556 select = None557 if query_options is not None:558 select = query_options.select559 from_parameter = None560 if query_options is not None:561 from_parameter = query_options.from_property562 to = None563 if query_options is not None:564 to = query_options.to565 filter = None566 if query_options is not None:567 filter = query_options.filter568 apply = None569 if query_options is not None:570 apply = query_options.apply571 expand = None572 if query_options is not None:573 expand = query_options.expand574 # Construct URL575 url = self.list_query_results_for_resource.metadata['url']576 path_format_arguments = {577 'policyStatesResource': self._serialize.url("policy_states_resource", policy_states_resource, 'str'),578 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True)579 }580 url = self._client.format_url(url, **path_format_arguments)581 # Construct parameters582 query_parameters = {}583 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')584 if top is not None:585 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)586 if order_by is not None:587 query_parameters['$orderby'] = self._serialize.query("order_by", order_by, 'str')588 if select is not None:589 query_parameters['$select'] = self._serialize.query("select", select, 'str')590 if from_parameter is not None:591 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')592 if to is not None:593 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')594 if filter is not None:595 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')596 if apply is not None:597 query_parameters['$apply'] = self._serialize.query("apply", apply, 'str')598 if expand is not None:599 query_parameters['$expand'] = self._serialize.query("expand", expand, 'str')600 # Construct headers601 header_parameters = {}602 header_parameters['Accept'] = 'application/json'603 if self.config.generate_client_request_id:604 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())605 if custom_headers:606 header_parameters.update(custom_headers)607 if self.config.accept_language is not None:608 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')609 # Construct and send request610 request = self._client.post(url, query_parameters, header_parameters)611 response = self._client.send(request, stream=False, **operation_config)612 if response.status_code not in [200]:613 raise models.QueryFailureException(self._deserialize, response)614 deserialized = None615 if response.status_code == 200:616 deserialized = self._deserialize('PolicyStatesQueryResults', response)617 if raw:618 client_raw_response = ClientRawResponse(deserialized, response)619 return client_raw_response620 return deserialized621 list_query_results_for_resource.metadata = {'url': '/{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'}622 def summarize_for_resource(623 self, resource_id, query_options=None, custom_headers=None, raw=False, **operation_config):624 """Summarizes policy states for the resource.625 :param resource_id: Resource ID.626 :type resource_id: str627 :param query_options: Additional parameters for the operation628 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions629 :param dict custom_headers: headers that will be added to the request630 :param bool raw: returns the direct response alongside the631 deserialized response632 :param operation_config: :ref:`Operation configuration633 overrides<msrest:optionsforoperations>`.634 :return: SummarizeResults or ClientRawResponse if raw=true635 :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults or636 ~msrest.pipeline.ClientRawResponse637 :raises:638 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`639 """640 top = None641 if query_options is not None:642 top = query_options.top643 from_parameter = None644 if query_options is not None:645 from_parameter = query_options.from_property646 to = None647 if query_options is not None:648 to = query_options.to649 filter = None650 if query_options is not None:651 filter = query_options.filter652 # Construct URL653 url = self.summarize_for_resource.metadata['url']654 path_format_arguments = {655 'policyStatesSummaryResource': self._serialize.url("self.policy_states_summary_resource", self.policy_states_summary_resource, 'str'),656 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True)657 }658 url = self._client.format_url(url, **path_format_arguments)659 # Construct parameters660 query_parameters = {}661 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')662 if top is not None:663 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)664 if from_parameter is not None:665 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')666 if to is not None:667 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')668 if filter is not None:669 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')670 # Construct headers671 header_parameters = {}672 header_parameters['Accept'] = 'application/json'673 if self.config.generate_client_request_id:674 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())675 if custom_headers:676 header_parameters.update(custom_headers)677 if self.config.accept_language is not None:678 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')679 # Construct and send request680 request = self._client.post(url, query_parameters, header_parameters)681 response = self._client.send(request, stream=False, **operation_config)682 if response.status_code not in [200]:683 raise models.QueryFailureException(self._deserialize, response)684 deserialized = None685 if response.status_code == 200:686 deserialized = self._deserialize('SummarizeResults', response)687 if raw:688 client_raw_response = ClientRawResponse(deserialized, response)689 return client_raw_response690 return deserialized691 summarize_for_resource.metadata = {'url': '/{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'}692 def list_query_results_for_policy_set_definition(693 self, policy_states_resource, subscription_id, policy_set_definition_name, query_options=None, custom_headers=None, raw=False, **operation_config):694 """Queries policy states for the subscription level policy set definition.695 :param policy_states_resource: The virtual resource under PolicyStates696 resource type. In a given time range, 'latest' represents the latest697 policy state(s), whereas 'default' represents all policy state(s).698 Possible values include: 'default', 'latest'699 :type policy_states_resource: str or700 ~azure.mgmt.policyinsights.models.PolicyStatesResource701 :param subscription_id: Microsoft Azure subscription ID.702 :type subscription_id: str703 :param policy_set_definition_name: Policy set definition name.704 :type policy_set_definition_name: str705 :param query_options: Additional parameters for the operation706 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions707 :param dict custom_headers: headers that will be added to the request708 :param bool raw: returns the direct response alongside the709 deserialized response710 :param operation_config: :ref:`Operation configuration711 overrides<msrest:optionsforoperations>`.712 :return: PolicyStatesQueryResults or ClientRawResponse if raw=true713 :rtype: ~azure.mgmt.policyinsights.models.PolicyStatesQueryResults or714 ~msrest.pipeline.ClientRawResponse715 :raises:716 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`717 """718 top = None719 if query_options is not None:720 top = query_options.top721 order_by = None722 if query_options is not None:723 order_by = query_options.order_by724 select = None725 if query_options is not None:726 select = query_options.select727 from_parameter = None728 if query_options is not None:729 from_parameter = query_options.from_property730 to = None731 if query_options is not None:732 to = query_options.to733 filter = None734 if query_options is not None:735 filter = query_options.filter736 apply = None737 if query_options is not None:738 apply = query_options.apply739 # Construct URL740 url = self.list_query_results_for_policy_set_definition.metadata['url']741 path_format_arguments = {742 'policyStatesResource': self._serialize.url("policy_states_resource", policy_states_resource, 'str'),743 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),744 'authorizationNamespace': self._serialize.url("self.authorization_namespace", self.authorization_namespace, 'str'),745 'policySetDefinitionName': self._serialize.url("policy_set_definition_name", policy_set_definition_name, 'str')746 }747 url = self._client.format_url(url, **path_format_arguments)748 # Construct parameters749 query_parameters = {}750 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')751 if top is not None:752 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)753 if order_by is not None:754 query_parameters['$orderby'] = self._serialize.query("order_by", order_by, 'str')755 if select is not None:756 query_parameters['$select'] = self._serialize.query("select", select, 'str')757 if from_parameter is not None:758 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')759 if to is not None:760 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')761 if filter is not None:762 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')763 if apply is not None:764 query_parameters['$apply'] = self._serialize.query("apply", apply, 'str')765 # Construct headers766 header_parameters = {}767 header_parameters['Accept'] = 'application/json'768 if self.config.generate_client_request_id:769 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())770 if custom_headers:771 header_parameters.update(custom_headers)772 if self.config.accept_language is not None:773 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')774 # Construct and send request775 request = self._client.post(url, query_parameters, header_parameters)776 response = self._client.send(request, stream=False, **operation_config)777 if response.status_code not in [200]:778 raise models.QueryFailureException(self._deserialize, response)779 deserialized = None780 if response.status_code == 200:781 deserialized = self._deserialize('PolicyStatesQueryResults', response)782 if raw:783 client_raw_response = ClientRawResponse(deserialized, response)784 return client_raw_response785 return deserialized786 list_query_results_for_policy_set_definition.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'}787 def summarize_for_policy_set_definition(788 self, subscription_id, policy_set_definition_name, query_options=None, custom_headers=None, raw=False, **operation_config):789 """Summarizes policy states for the subscription level policy set790 definition.791 :param subscription_id: Microsoft Azure subscription ID.792 :type subscription_id: str793 :param policy_set_definition_name: Policy set definition name.794 :type policy_set_definition_name: str795 :param query_options: Additional parameters for the operation796 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions797 :param dict custom_headers: headers that will be added to the request798 :param bool raw: returns the direct response alongside the799 deserialized response800 :param operation_config: :ref:`Operation configuration801 overrides<msrest:optionsforoperations>`.802 :return: SummarizeResults or ClientRawResponse if raw=true803 :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults or804 ~msrest.pipeline.ClientRawResponse805 :raises:806 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`807 """808 top = None809 if query_options is not None:810 top = query_options.top811 from_parameter = None812 if query_options is not None:813 from_parameter = query_options.from_property814 to = None815 if query_options is not None:816 to = query_options.to817 filter = None818 if query_options is not None:819 filter = query_options.filter820 # Construct URL821 url = self.summarize_for_policy_set_definition.metadata['url']822 path_format_arguments = {823 'policyStatesSummaryResource': self._serialize.url("self.policy_states_summary_resource", self.policy_states_summary_resource, 'str'),824 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),825 'authorizationNamespace': self._serialize.url("self.authorization_namespace", self.authorization_namespace, 'str'),826 'policySetDefinitionName': self._serialize.url("policy_set_definition_name", policy_set_definition_name, 'str')827 }828 url = self._client.format_url(url, **path_format_arguments)829 # Construct parameters830 query_parameters = {}831 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')832 if top is not None:833 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)834 if from_parameter is not None:835 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')836 if to is not None:837 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')838 if filter is not None:839 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')840 # Construct headers841 header_parameters = {}842 header_parameters['Accept'] = 'application/json'843 if self.config.generate_client_request_id:844 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())845 if custom_headers:846 header_parameters.update(custom_headers)847 if self.config.accept_language is not None:848 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')849 # Construct and send request850 request = self._client.post(url, query_parameters, header_parameters)851 response = self._client.send(request, stream=False, **operation_config)852 if response.status_code not in [200]:853 raise models.QueryFailureException(self._deserialize, response)854 deserialized = None855 if response.status_code == 200:856 deserialized = self._deserialize('SummarizeResults', response)857 if raw:858 client_raw_response = ClientRawResponse(deserialized, response)859 return client_raw_response860 return deserialized861 summarize_for_policy_set_definition.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'}862 def list_query_results_for_policy_definition(863 self, policy_states_resource, subscription_id, policy_definition_name, query_options=None, custom_headers=None, raw=False, **operation_config):864 """Queries policy states for the subscription level policy definition.865 :param policy_states_resource: The virtual resource under PolicyStates866 resource type. In a given time range, 'latest' represents the latest867 policy state(s), whereas 'default' represents all policy state(s).868 Possible values include: 'default', 'latest'869 :type policy_states_resource: str or870 ~azure.mgmt.policyinsights.models.PolicyStatesResource871 :param subscription_id: Microsoft Azure subscription ID.872 :type subscription_id: str873 :param policy_definition_name: Policy definition name.874 :type policy_definition_name: str875 :param query_options: Additional parameters for the operation876 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions877 :param dict custom_headers: headers that will be added to the request878 :param bool raw: returns the direct response alongside the879 deserialized response880 :param operation_config: :ref:`Operation configuration881 overrides<msrest:optionsforoperations>`.882 :return: PolicyStatesQueryResults or ClientRawResponse if raw=true883 :rtype: ~azure.mgmt.policyinsights.models.PolicyStatesQueryResults or884 ~msrest.pipeline.ClientRawResponse885 :raises:886 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`887 """888 top = None889 if query_options is not None:890 top = query_options.top891 order_by = None892 if query_options is not None:893 order_by = query_options.order_by894 select = None895 if query_options is not None:896 select = query_options.select897 from_parameter = None898 if query_options is not None:899 from_parameter = query_options.from_property900 to = None901 if query_options is not None:902 to = query_options.to903 filter = None904 if query_options is not None:905 filter = query_options.filter906 apply = None907 if query_options is not None:908 apply = query_options.apply909 # Construct URL910 url = self.list_query_results_for_policy_definition.metadata['url']911 path_format_arguments = {912 'policyStatesResource': self._serialize.url("policy_states_resource", policy_states_resource, 'str'),913 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),914 'authorizationNamespace': self._serialize.url("self.authorization_namespace", self.authorization_namespace, 'str'),915 'policyDefinitionName': self._serialize.url("policy_definition_name", policy_definition_name, 'str')916 }917 url = self._client.format_url(url, **path_format_arguments)918 # Construct parameters919 query_parameters = {}920 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')921 if top is not None:922 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)923 if order_by is not None:924 query_parameters['$orderby'] = self._serialize.query("order_by", order_by, 'str')925 if select is not None:926 query_parameters['$select'] = self._serialize.query("select", select, 'str')927 if from_parameter is not None:928 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')929 if to is not None:930 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')931 if filter is not None:932 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')933 if apply is not None:934 query_parameters['$apply'] = self._serialize.query("apply", apply, 'str')935 # Construct headers936 header_parameters = {}937 header_parameters['Accept'] = 'application/json'938 if self.config.generate_client_request_id:939 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())940 if custom_headers:941 header_parameters.update(custom_headers)942 if self.config.accept_language is not None:943 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')944 # Construct and send request945 request = self._client.post(url, query_parameters, header_parameters)946 response = self._client.send(request, stream=False, **operation_config)947 if response.status_code not in [200]:948 raise models.QueryFailureException(self._deserialize, response)949 deserialized = None950 if response.status_code == 200:951 deserialized = self._deserialize('PolicyStatesQueryResults', response)952 if raw:953 client_raw_response = ClientRawResponse(deserialized, response)954 return client_raw_response955 return deserialized956 list_query_results_for_policy_definition.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'}957 def summarize_for_policy_definition(958 self, subscription_id, policy_definition_name, query_options=None, custom_headers=None, raw=False, **operation_config):959 """Summarizes policy states for the subscription level policy definition.960 :param subscription_id: Microsoft Azure subscription ID.961 :type subscription_id: str962 :param policy_definition_name: Policy definition name.963 :type policy_definition_name: str964 :param query_options: Additional parameters for the operation965 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions966 :param dict custom_headers: headers that will be added to the request967 :param bool raw: returns the direct response alongside the968 deserialized response969 :param operation_config: :ref:`Operation configuration970 overrides<msrest:optionsforoperations>`.971 :return: SummarizeResults or ClientRawResponse if raw=true972 :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults or973 ~msrest.pipeline.ClientRawResponse974 :raises:975 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`976 """977 top = None978 if query_options is not None:979 top = query_options.top980 from_parameter = None981 if query_options is not None:982 from_parameter = query_options.from_property983 to = None984 if query_options is not None:985 to = query_options.to986 filter = None987 if query_options is not None:988 filter = query_options.filter989 # Construct URL990 url = self.summarize_for_policy_definition.metadata['url']991 path_format_arguments = {992 'policyStatesSummaryResource': self._serialize.url("self.policy_states_summary_resource", self.policy_states_summary_resource, 'str'),993 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),994 'authorizationNamespace': self._serialize.url("self.authorization_namespace", self.authorization_namespace, 'str'),995 'policyDefinitionName': self._serialize.url("policy_definition_name", policy_definition_name, 'str')996 }997 url = self._client.format_url(url, **path_format_arguments)998 # Construct parameters999 query_parameters = {}1000 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')1001 if top is not None:1002 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)1003 if from_parameter is not None:1004 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')1005 if to is not None:1006 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')1007 if filter is not None:1008 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')1009 # Construct headers1010 header_parameters = {}1011 header_parameters['Accept'] = 'application/json'1012 if self.config.generate_client_request_id:1013 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())1014 if custom_headers:1015 header_parameters.update(custom_headers)1016 if self.config.accept_language is not None:1017 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')1018 # Construct and send request1019 request = self._client.post(url, query_parameters, header_parameters)1020 response = self._client.send(request, stream=False, **operation_config)1021 if response.status_code not in [200]:1022 raise models.QueryFailureException(self._deserialize, response)1023 deserialized = None1024 if response.status_code == 200:1025 deserialized = self._deserialize('SummarizeResults', response)1026 if raw:1027 client_raw_response = ClientRawResponse(deserialized, response)1028 return client_raw_response1029 return deserialized1030 summarize_for_policy_definition.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'}1031 def list_query_results_for_subscription_level_policy_assignment(1032 self, policy_states_resource, subscription_id, policy_assignment_name, query_options=None, custom_headers=None, raw=False, **operation_config):1033 """Queries policy states for the subscription level policy assignment.1034 :param policy_states_resource: The virtual resource under PolicyStates1035 resource type. In a given time range, 'latest' represents the latest1036 policy state(s), whereas 'default' represents all policy state(s).1037 Possible values include: 'default', 'latest'1038 :type policy_states_resource: str or1039 ~azure.mgmt.policyinsights.models.PolicyStatesResource1040 :param subscription_id: Microsoft Azure subscription ID.1041 :type subscription_id: str1042 :param policy_assignment_name: Policy assignment name.1043 :type policy_assignment_name: str1044 :param query_options: Additional parameters for the operation1045 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions1046 :param dict custom_headers: headers that will be added to the request1047 :param bool raw: returns the direct response alongside the1048 deserialized response1049 :param operation_config: :ref:`Operation configuration1050 overrides<msrest:optionsforoperations>`.1051 :return: PolicyStatesQueryResults or ClientRawResponse if raw=true1052 :rtype: ~azure.mgmt.policyinsights.models.PolicyStatesQueryResults or1053 ~msrest.pipeline.ClientRawResponse1054 :raises:1055 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`1056 """1057 top = None1058 if query_options is not None:1059 top = query_options.top1060 order_by = None1061 if query_options is not None:1062 order_by = query_options.order_by1063 select = None1064 if query_options is not None:1065 select = query_options.select1066 from_parameter = None1067 if query_options is not None:1068 from_parameter = query_options.from_property1069 to = None1070 if query_options is not None:1071 to = query_options.to1072 filter = None1073 if query_options is not None:1074 filter = query_options.filter1075 apply = None1076 if query_options is not None:1077 apply = query_options.apply1078 # Construct URL1079 url = self.list_query_results_for_subscription_level_policy_assignment.metadata['url']1080 path_format_arguments = {1081 'policyStatesResource': self._serialize.url("policy_states_resource", policy_states_resource, 'str'),1082 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),1083 'authorizationNamespace': self._serialize.url("self.authorization_namespace", self.authorization_namespace, 'str'),1084 'policyAssignmentName': self._serialize.url("policy_assignment_name", policy_assignment_name, 'str')1085 }1086 url = self._client.format_url(url, **path_format_arguments)1087 # Construct parameters1088 query_parameters = {}1089 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')1090 if top is not None:1091 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)1092 if order_by is not None:1093 query_parameters['$orderby'] = self._serialize.query("order_by", order_by, 'str')1094 if select is not None:1095 query_parameters['$select'] = self._serialize.query("select", select, 'str')1096 if from_parameter is not None:1097 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')1098 if to is not None:1099 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')1100 if filter is not None:1101 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')1102 if apply is not None:1103 query_parameters['$apply'] = self._serialize.query("apply", apply, 'str')1104 # Construct headers1105 header_parameters = {}1106 header_parameters['Accept'] = 'application/json'1107 if self.config.generate_client_request_id:1108 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())1109 if custom_headers:1110 header_parameters.update(custom_headers)1111 if self.config.accept_language is not None:1112 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')1113 # Construct and send request1114 request = self._client.post(url, query_parameters, header_parameters)1115 response = self._client.send(request, stream=False, **operation_config)1116 if response.status_code not in [200]:1117 raise models.QueryFailureException(self._deserialize, response)1118 deserialized = None1119 if response.status_code == 200:1120 deserialized = self._deserialize('PolicyStatesQueryResults', response)1121 if raw:1122 client_raw_response = ClientRawResponse(deserialized, response)1123 return client_raw_response1124 return deserialized1125 list_query_results_for_subscription_level_policy_assignment.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'}1126 def summarize_for_subscription_level_policy_assignment(1127 self, subscription_id, policy_assignment_name, query_options=None, custom_headers=None, raw=False, **operation_config):1128 """Summarizes policy states for the subscription level policy assignment.1129 :param subscription_id: Microsoft Azure subscription ID.1130 :type subscription_id: str1131 :param policy_assignment_name: Policy assignment name.1132 :type policy_assignment_name: str1133 :param query_options: Additional parameters for the operation1134 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions1135 :param dict custom_headers: headers that will be added to the request1136 :param bool raw: returns the direct response alongside the1137 deserialized response1138 :param operation_config: :ref:`Operation configuration1139 overrides<msrest:optionsforoperations>`.1140 :return: SummarizeResults or ClientRawResponse if raw=true1141 :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults or1142 ~msrest.pipeline.ClientRawResponse1143 :raises:1144 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`1145 """1146 top = None1147 if query_options is not None:1148 top = query_options.top1149 from_parameter = None1150 if query_options is not None:1151 from_parameter = query_options.from_property1152 to = None1153 if query_options is not None:1154 to = query_options.to1155 filter = None1156 if query_options is not None:1157 filter = query_options.filter1158 # Construct URL1159 url = self.summarize_for_subscription_level_policy_assignment.metadata['url']1160 path_format_arguments = {1161 'policyStatesSummaryResource': self._serialize.url("self.policy_states_summary_resource", self.policy_states_summary_resource, 'str'),1162 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),1163 'authorizationNamespace': self._serialize.url("self.authorization_namespace", self.authorization_namespace, 'str'),1164 'policyAssignmentName': self._serialize.url("policy_assignment_name", policy_assignment_name, 'str')1165 }1166 url = self._client.format_url(url, **path_format_arguments)1167 # Construct parameters1168 query_parameters = {}1169 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')1170 if top is not None:1171 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)1172 if from_parameter is not None:1173 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')1174 if to is not None:1175 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')1176 if filter is not None:1177 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')1178 # Construct headers1179 header_parameters = {}1180 header_parameters['Accept'] = 'application/json'1181 if self.config.generate_client_request_id:1182 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())1183 if custom_headers:1184 header_parameters.update(custom_headers)1185 if self.config.accept_language is not None:1186 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')1187 # Construct and send request1188 request = self._client.post(url, query_parameters, header_parameters)1189 response = self._client.send(request, stream=False, **operation_config)1190 if response.status_code not in [200]:1191 raise models.QueryFailureException(self._deserialize, response)1192 deserialized = None1193 if response.status_code == 200:1194 deserialized = self._deserialize('SummarizeResults', response)1195 if raw:1196 client_raw_response = ClientRawResponse(deserialized, response)1197 return client_raw_response1198 return deserialized1199 summarize_for_subscription_level_policy_assignment.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'}1200 def list_query_results_for_resource_group_level_policy_assignment(1201 self, policy_states_resource, subscription_id, resource_group_name, policy_assignment_name, query_options=None, custom_headers=None, raw=False, **operation_config):1202 """Queries policy states for the resource group level policy assignment.1203 :param policy_states_resource: The virtual resource under PolicyStates1204 resource type. In a given time range, 'latest' represents the latest1205 policy state(s), whereas 'default' represents all policy state(s).1206 Possible values include: 'default', 'latest'1207 :type policy_states_resource: str or1208 ~azure.mgmt.policyinsights.models.PolicyStatesResource1209 :param subscription_id: Microsoft Azure subscription ID.1210 :type subscription_id: str1211 :param resource_group_name: Resource group name.1212 :type resource_group_name: str1213 :param policy_assignment_name: Policy assignment name.1214 :type policy_assignment_name: str1215 :param query_options: Additional parameters for the operation1216 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions1217 :param dict custom_headers: headers that will be added to the request1218 :param bool raw: returns the direct response alongside the1219 deserialized response1220 :param operation_config: :ref:`Operation configuration1221 overrides<msrest:optionsforoperations>`.1222 :return: PolicyStatesQueryResults or ClientRawResponse if raw=true1223 :rtype: ~azure.mgmt.policyinsights.models.PolicyStatesQueryResults or1224 ~msrest.pipeline.ClientRawResponse1225 :raises:1226 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`1227 """1228 top = None1229 if query_options is not None:1230 top = query_options.top1231 order_by = None1232 if query_options is not None:1233 order_by = query_options.order_by1234 select = None1235 if query_options is not None:1236 select = query_options.select1237 from_parameter = None1238 if query_options is not None:1239 from_parameter = query_options.from_property1240 to = None1241 if query_options is not None:1242 to = query_options.to1243 filter = None1244 if query_options is not None:1245 filter = query_options.filter1246 apply = None1247 if query_options is not None:1248 apply = query_options.apply1249 # Construct URL1250 url = self.list_query_results_for_resource_group_level_policy_assignment.metadata['url']1251 path_format_arguments = {1252 'policyStatesResource': self._serialize.url("policy_states_resource", policy_states_resource, 'str'),1253 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),1254 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),1255 'authorizationNamespace': self._serialize.url("self.authorization_namespace", self.authorization_namespace, 'str'),1256 'policyAssignmentName': self._serialize.url("policy_assignment_name", policy_assignment_name, 'str')1257 }1258 url = self._client.format_url(url, **path_format_arguments)1259 # Construct parameters1260 query_parameters = {}1261 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')1262 if top is not None:1263 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)1264 if order_by is not None:1265 query_parameters['$orderby'] = self._serialize.query("order_by", order_by, 'str')1266 if select is not None:1267 query_parameters['$select'] = self._serialize.query("select", select, 'str')1268 if from_parameter is not None:1269 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')1270 if to is not None:1271 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')1272 if filter is not None:1273 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')1274 if apply is not None:1275 query_parameters['$apply'] = self._serialize.query("apply", apply, 'str')1276 # Construct headers1277 header_parameters = {}1278 header_parameters['Accept'] = 'application/json'1279 if self.config.generate_client_request_id:1280 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())1281 if custom_headers:1282 header_parameters.update(custom_headers)1283 if self.config.accept_language is not None:1284 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')1285 # Construct and send request1286 request = self._client.post(url, query_parameters, header_parameters)1287 response = self._client.send(request, stream=False, **operation_config)1288 if response.status_code not in [200]:1289 raise models.QueryFailureException(self._deserialize, response)1290 deserialized = None1291 if response.status_code == 200:1292 deserialized = self._deserialize('PolicyStatesQueryResults', response)1293 if raw:1294 client_raw_response = ClientRawResponse(deserialized, response)1295 return client_raw_response1296 return deserialized1297 list_query_results_for_resource_group_level_policy_assignment.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults'}1298 def summarize_for_resource_group_level_policy_assignment(1299 self, subscription_id, resource_group_name, policy_assignment_name, query_options=None, custom_headers=None, raw=False, **operation_config):1300 """Summarizes policy states for the resource group level policy1301 assignment.1302 :param subscription_id: Microsoft Azure subscription ID.1303 :type subscription_id: str1304 :param resource_group_name: Resource group name.1305 :type resource_group_name: str1306 :param policy_assignment_name: Policy assignment name.1307 :type policy_assignment_name: str1308 :param query_options: Additional parameters for the operation1309 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions1310 :param dict custom_headers: headers that will be added to the request1311 :param bool raw: returns the direct response alongside the1312 deserialized response1313 :param operation_config: :ref:`Operation configuration1314 overrides<msrest:optionsforoperations>`.1315 :return: SummarizeResults or ClientRawResponse if raw=true1316 :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults or1317 ~msrest.pipeline.ClientRawResponse1318 :raises:1319 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`1320 """1321 top = None1322 if query_options is not None:1323 top = query_options.top1324 from_parameter = None1325 if query_options is not None:1326 from_parameter = query_options.from_property1327 to = None1328 if query_options is not None:1329 to = query_options.to1330 filter = None1331 if query_options is not None:1332 filter = query_options.filter1333 # Construct URL1334 url = self.summarize_for_resource_group_level_policy_assignment.metadata['url']1335 path_format_arguments = {1336 'policyStatesSummaryResource': self._serialize.url("self.policy_states_summary_resource", self.policy_states_summary_resource, 'str'),1337 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),1338 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),1339 'authorizationNamespace': self._serialize.url("self.authorization_namespace", self.authorization_namespace, 'str'),1340 'policyAssignmentName': self._serialize.url("policy_assignment_name", policy_assignment_name, 'str')1341 }1342 url = self._client.format_url(url, **path_format_arguments)1343 # Construct parameters1344 query_parameters = {}1345 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')1346 if top is not None:1347 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)1348 if from_parameter is not None:1349 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')1350 if to is not None:1351 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')1352 if filter is not None:1353 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')1354 # Construct headers1355 header_parameters = {}1356 header_parameters['Accept'] = 'application/json'1357 if self.config.generate_client_request_id:1358 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())1359 if custom_headers:1360 header_parameters.update(custom_headers)1361 if self.config.accept_language is not None:1362 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')1363 # Construct and send request1364 request = self._client.post(url, query_parameters, header_parameters)1365 response = self._client.send(request, stream=False, **operation_config)1366 if response.status_code not in [200]:1367 raise models.QueryFailureException(self._deserialize, response)1368 deserialized = None1369 if response.status_code == 200:1370 deserialized = self._deserialize('SummarizeResults', response)1371 if raw:1372 client_raw_response = ClientRawResponse(deserialized, response)1373 return client_raw_response1374 return deserialized1375 summarize_for_resource_group_level_policy_assignment.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize'}1376 def get_metadata(1377 self, scope, custom_headers=None, raw=False, **operation_config):1378 """Gets OData metadata XML document.1379 :param scope: A valid scope, i.e. management group, subscription,1380 resource group, or resource ID. Scope used has no effect on metadata1381 returned.1382 :type scope: str1383 :param dict custom_headers: headers that will be added to the request1384 :param bool raw: returns the direct response alongside the1385 deserialized response1386 :param operation_config: :ref:`Operation configuration1387 overrides<msrest:optionsforoperations>`.1388 :return: str or ClientRawResponse if raw=true1389 :rtype: str or ~msrest.pipeline.ClientRawResponse1390 :raises:1391 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`1392 """1393 # Construct URL1394 url = self.get_metadata.metadata['url']1395 path_format_arguments = {1396 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True)1397 }1398 url = self._client.format_url(url, **path_format_arguments)1399 # Construct parameters1400 query_parameters = {}1401 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')1402 # Construct headers1403 header_parameters = {}1404 header_parameters['Accept'] = 'application/xml'1405 if self.config.generate_client_request_id:1406 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())1407 if custom_headers:1408 header_parameters.update(custom_headers)1409 if self.config.accept_language is not None:1410 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')1411 # Construct and send request1412 request = self._client.get(url, query_parameters, header_parameters)1413 response = self._client.send(request, stream=False, **operation_config)1414 if response.status_code not in [200]:1415 raise models.QueryFailureException(self._deserialize, response)1416 deserialized = None1417 if response.status_code == 200:1418 deserialized = self._deserialize('str', response)1419 if raw:1420 client_raw_response = ClientRawResponse(deserialized, response)1421 return client_raw_response1422 return deserialized...
policy_events_operations.py
Source:policy_events_operations.py
1# coding=utf-82# --------------------------------------------------------------------------3# Copyright (c) Microsoft Corporation. All rights reserved.4# Licensed under the MIT License. See License.txt in the project root for5# license information.6#7# Code generated by Microsoft (R) AutoRest Code Generator.8# Changes may cause incorrect behavior and will be lost if the code is9# regenerated.10# --------------------------------------------------------------------------11import uuid12from msrest.pipeline import ClientRawResponse13from .. import models14class PolicyEventsOperations(object):15 """PolicyEventsOperations operations.16 :param client: Client for service requests.17 :param config: Configuration of service client.18 :param serializer: An object model serializer.19 :param deserializer: An object model deserializer.20 :ivar policy_events_resource: The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. Constant value: "default".21 :ivar management_groups_namespace: The namespace for Microsoft Management RP; only "Microsoft.Management" is allowed. Constant value: "Microsoft.Management".22 :ivar api_version: API version to use with the client requests. Constant value: "2018-04-04".23 :ivar authorization_namespace: The namespace for Microsoft Authorization resource provider; only "Microsoft.Authorization" is allowed. Constant value: "Microsoft.Authorization".24 """25 models = models26 def __init__(self, client, config, serializer, deserializer):27 self._client = client28 self._serialize = serializer29 self._deserialize = deserializer30 self.policy_events_resource = "default"31 self.management_groups_namespace = "Microsoft.Management"32 self.api_version = "2018-04-04"33 self.authorization_namespace = "Microsoft.Authorization"34 self.config = config35 def list_query_results_for_management_group(36 self, management_group_name, query_options=None, custom_headers=None, raw=False, **operation_config):37 """Queries policy events for the resources under the management group.38 :param management_group_name: Management group name.39 :type management_group_name: str40 :param query_options: Additional parameters for the operation41 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions42 :param dict custom_headers: headers that will be added to the request43 :param bool raw: returns the direct response alongside the44 deserialized response45 :param operation_config: :ref:`Operation configuration46 overrides<msrest:optionsforoperations>`.47 :return: PolicyEventsQueryResults or ClientRawResponse if raw=true48 :rtype: ~azure.mgmt.policyinsights.models.PolicyEventsQueryResults or49 ~msrest.pipeline.ClientRawResponse50 :raises:51 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`52 """53 top = None54 if query_options is not None:55 top = query_options.top56 order_by = None57 if query_options is not None:58 order_by = query_options.order_by59 select = None60 if query_options is not None:61 select = query_options.select62 from_parameter = None63 if query_options is not None:64 from_parameter = query_options.from_property65 to = None66 if query_options is not None:67 to = query_options.to68 filter = None69 if query_options is not None:70 filter = query_options.filter71 apply = None72 if query_options is not None:73 apply = query_options.apply74 # Construct URL75 url = self.list_query_results_for_management_group.metadata['url']76 path_format_arguments = {77 'policyEventsResource': self._serialize.url("self.policy_events_resource", self.policy_events_resource, 'str'),78 'managementGroupsNamespace': self._serialize.url("self.management_groups_namespace", self.management_groups_namespace, 'str'),79 'managementGroupName': self._serialize.url("management_group_name", management_group_name, 'str')80 }81 url = self._client.format_url(url, **path_format_arguments)82 # Construct parameters83 query_parameters = {}84 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')85 if top is not None:86 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)87 if order_by is not None:88 query_parameters['$orderby'] = self._serialize.query("order_by", order_by, 'str')89 if select is not None:90 query_parameters['$select'] = self._serialize.query("select", select, 'str')91 if from_parameter is not None:92 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')93 if to is not None:94 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')95 if filter is not None:96 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')97 if apply is not None:98 query_parameters['$apply'] = self._serialize.query("apply", apply, 'str')99 # Construct headers100 header_parameters = {}101 header_parameters['Accept'] = 'application/json'102 if self.config.generate_client_request_id:103 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())104 if custom_headers:105 header_parameters.update(custom_headers)106 if self.config.accept_language is not None:107 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')108 # Construct and send request109 request = self._client.post(url, query_parameters, header_parameters)110 response = self._client.send(request, stream=False, **operation_config)111 if response.status_code not in [200]:112 raise models.QueryFailureException(self._deserialize, response)113 deserialized = None114 if response.status_code == 200:115 deserialized = self._deserialize('PolicyEventsQueryResults', response)116 if raw:117 client_raw_response = ClientRawResponse(deserialized, response)118 return client_raw_response119 return deserialized120 list_query_results_for_management_group.metadata = {'url': '/providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'}121 def list_query_results_for_subscription(122 self, subscription_id, query_options=None, custom_headers=None, raw=False, **operation_config):123 """Queries policy events for the resources under the subscription.124 :param subscription_id: Microsoft Azure subscription ID.125 :type subscription_id: str126 :param query_options: Additional parameters for the operation127 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions128 :param dict custom_headers: headers that will be added to the request129 :param bool raw: returns the direct response alongside the130 deserialized response131 :param operation_config: :ref:`Operation configuration132 overrides<msrest:optionsforoperations>`.133 :return: PolicyEventsQueryResults or ClientRawResponse if raw=true134 :rtype: ~azure.mgmt.policyinsights.models.PolicyEventsQueryResults or135 ~msrest.pipeline.ClientRawResponse136 :raises:137 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`138 """139 top = None140 if query_options is not None:141 top = query_options.top142 order_by = None143 if query_options is not None:144 order_by = query_options.order_by145 select = None146 if query_options is not None:147 select = query_options.select148 from_parameter = None149 if query_options is not None:150 from_parameter = query_options.from_property151 to = None152 if query_options is not None:153 to = query_options.to154 filter = None155 if query_options is not None:156 filter = query_options.filter157 apply = None158 if query_options is not None:159 apply = query_options.apply160 # Construct URL161 url = self.list_query_results_for_subscription.metadata['url']162 path_format_arguments = {163 'policyEventsResource': self._serialize.url("self.policy_events_resource", self.policy_events_resource, 'str'),164 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str')165 }166 url = self._client.format_url(url, **path_format_arguments)167 # Construct parameters168 query_parameters = {}169 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')170 if top is not None:171 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)172 if order_by is not None:173 query_parameters['$orderby'] = self._serialize.query("order_by", order_by, 'str')174 if select is not None:175 query_parameters['$select'] = self._serialize.query("select", select, 'str')176 if from_parameter is not None:177 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')178 if to is not None:179 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')180 if filter is not None:181 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')182 if apply is not None:183 query_parameters['$apply'] = self._serialize.query("apply", apply, 'str')184 # Construct headers185 header_parameters = {}186 header_parameters['Accept'] = 'application/json'187 if self.config.generate_client_request_id:188 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())189 if custom_headers:190 header_parameters.update(custom_headers)191 if self.config.accept_language is not None:192 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')193 # Construct and send request194 request = self._client.post(url, query_parameters, header_parameters)195 response = self._client.send(request, stream=False, **operation_config)196 if response.status_code not in [200]:197 raise models.QueryFailureException(self._deserialize, response)198 deserialized = None199 if response.status_code == 200:200 deserialized = self._deserialize('PolicyEventsQueryResults', response)201 if raw:202 client_raw_response = ClientRawResponse(deserialized, response)203 return client_raw_response204 return deserialized205 list_query_results_for_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'}206 def list_query_results_for_resource_group(207 self, subscription_id, resource_group_name, query_options=None, custom_headers=None, raw=False, **operation_config):208 """Queries policy events for the resources under the resource group.209 :param subscription_id: Microsoft Azure subscription ID.210 :type subscription_id: str211 :param resource_group_name: Resource group name.212 :type resource_group_name: str213 :param query_options: Additional parameters for the operation214 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions215 :param dict custom_headers: headers that will be added to the request216 :param bool raw: returns the direct response alongside the217 deserialized response218 :param operation_config: :ref:`Operation configuration219 overrides<msrest:optionsforoperations>`.220 :return: PolicyEventsQueryResults or ClientRawResponse if raw=true221 :rtype: ~azure.mgmt.policyinsights.models.PolicyEventsQueryResults or222 ~msrest.pipeline.ClientRawResponse223 :raises:224 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`225 """226 top = None227 if query_options is not None:228 top = query_options.top229 order_by = None230 if query_options is not None:231 order_by = query_options.order_by232 select = None233 if query_options is not None:234 select = query_options.select235 from_parameter = None236 if query_options is not None:237 from_parameter = query_options.from_property238 to = None239 if query_options is not None:240 to = query_options.to241 filter = None242 if query_options is not None:243 filter = query_options.filter244 apply = None245 if query_options is not None:246 apply = query_options.apply247 # Construct URL248 url = self.list_query_results_for_resource_group.metadata['url']249 path_format_arguments = {250 'policyEventsResource': self._serialize.url("self.policy_events_resource", self.policy_events_resource, 'str'),251 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),252 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str')253 }254 url = self._client.format_url(url, **path_format_arguments)255 # Construct parameters256 query_parameters = {}257 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')258 if top is not None:259 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)260 if order_by is not None:261 query_parameters['$orderby'] = self._serialize.query("order_by", order_by, 'str')262 if select is not None:263 query_parameters['$select'] = self._serialize.query("select", select, 'str')264 if from_parameter is not None:265 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')266 if to is not None:267 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')268 if filter is not None:269 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')270 if apply is not None:271 query_parameters['$apply'] = self._serialize.query("apply", apply, 'str')272 # Construct headers273 header_parameters = {}274 header_parameters['Accept'] = 'application/json'275 if self.config.generate_client_request_id:276 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())277 if custom_headers:278 header_parameters.update(custom_headers)279 if self.config.accept_language is not None:280 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')281 # Construct and send request282 request = self._client.post(url, query_parameters, header_parameters)283 response = self._client.send(request, stream=False, **operation_config)284 if response.status_code not in [200]:285 raise models.QueryFailureException(self._deserialize, response)286 deserialized = None287 if response.status_code == 200:288 deserialized = self._deserialize('PolicyEventsQueryResults', response)289 if raw:290 client_raw_response = ClientRawResponse(deserialized, response)291 return client_raw_response292 return deserialized293 list_query_results_for_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'}294 def list_query_results_for_resource(295 self, resource_id, query_options=None, custom_headers=None, raw=False, **operation_config):296 """Queries policy events for the resource.297 :param resource_id: Resource ID.298 :type resource_id: str299 :param query_options: Additional parameters for the operation300 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions301 :param dict custom_headers: headers that will be added to the request302 :param bool raw: returns the direct response alongside the303 deserialized response304 :param operation_config: :ref:`Operation configuration305 overrides<msrest:optionsforoperations>`.306 :return: PolicyEventsQueryResults or ClientRawResponse if raw=true307 :rtype: ~azure.mgmt.policyinsights.models.PolicyEventsQueryResults or308 ~msrest.pipeline.ClientRawResponse309 :raises:310 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`311 """312 top = None313 if query_options is not None:314 top = query_options.top315 order_by = None316 if query_options is not None:317 order_by = query_options.order_by318 select = None319 if query_options is not None:320 select = query_options.select321 from_parameter = None322 if query_options is not None:323 from_parameter = query_options.from_property324 to = None325 if query_options is not None:326 to = query_options.to327 filter = None328 if query_options is not None:329 filter = query_options.filter330 apply = None331 if query_options is not None:332 apply = query_options.apply333 # Construct URL334 url = self.list_query_results_for_resource.metadata['url']335 path_format_arguments = {336 'policyEventsResource': self._serialize.url("self.policy_events_resource", self.policy_events_resource, 'str'),337 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True)338 }339 url = self._client.format_url(url, **path_format_arguments)340 # Construct parameters341 query_parameters = {}342 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')343 if top is not None:344 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)345 if order_by is not None:346 query_parameters['$orderby'] = self._serialize.query("order_by", order_by, 'str')347 if select is not None:348 query_parameters['$select'] = self._serialize.query("select", select, 'str')349 if from_parameter is not None:350 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')351 if to is not None:352 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')353 if filter is not None:354 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')355 if apply is not None:356 query_parameters['$apply'] = self._serialize.query("apply", apply, 'str')357 # Construct headers358 header_parameters = {}359 header_parameters['Accept'] = 'application/json'360 if self.config.generate_client_request_id:361 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())362 if custom_headers:363 header_parameters.update(custom_headers)364 if self.config.accept_language is not None:365 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')366 # Construct and send request367 request = self._client.post(url, query_parameters, header_parameters)368 response = self._client.send(request, stream=False, **operation_config)369 if response.status_code not in [200]:370 raise models.QueryFailureException(self._deserialize, response)371 deserialized = None372 if response.status_code == 200:373 deserialized = self._deserialize('PolicyEventsQueryResults', response)374 if raw:375 client_raw_response = ClientRawResponse(deserialized, response)376 return client_raw_response377 return deserialized378 list_query_results_for_resource.metadata = {'url': '/{resourceId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'}379 def list_query_results_for_policy_set_definition(380 self, subscription_id, policy_set_definition_name, query_options=None, custom_headers=None, raw=False, **operation_config):381 """Queries policy events for the subscription level policy set definition.382 :param subscription_id: Microsoft Azure subscription ID.383 :type subscription_id: str384 :param policy_set_definition_name: Policy set definition name.385 :type policy_set_definition_name: str386 :param query_options: Additional parameters for the operation387 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions388 :param dict custom_headers: headers that will be added to the request389 :param bool raw: returns the direct response alongside the390 deserialized response391 :param operation_config: :ref:`Operation configuration392 overrides<msrest:optionsforoperations>`.393 :return: PolicyEventsQueryResults or ClientRawResponse if raw=true394 :rtype: ~azure.mgmt.policyinsights.models.PolicyEventsQueryResults or395 ~msrest.pipeline.ClientRawResponse396 :raises:397 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`398 """399 top = None400 if query_options is not None:401 top = query_options.top402 order_by = None403 if query_options is not None:404 order_by = query_options.order_by405 select = None406 if query_options is not None:407 select = query_options.select408 from_parameter = None409 if query_options is not None:410 from_parameter = query_options.from_property411 to = None412 if query_options is not None:413 to = query_options.to414 filter = None415 if query_options is not None:416 filter = query_options.filter417 apply = None418 if query_options is not None:419 apply = query_options.apply420 # Construct URL421 url = self.list_query_results_for_policy_set_definition.metadata['url']422 path_format_arguments = {423 'policyEventsResource': self._serialize.url("self.policy_events_resource", self.policy_events_resource, 'str'),424 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),425 'authorizationNamespace': self._serialize.url("self.authorization_namespace", self.authorization_namespace, 'str'),426 'policySetDefinitionName': self._serialize.url("policy_set_definition_name", policy_set_definition_name, 'str')427 }428 url = self._client.format_url(url, **path_format_arguments)429 # Construct parameters430 query_parameters = {}431 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')432 if top is not None:433 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)434 if order_by is not None:435 query_parameters['$orderby'] = self._serialize.query("order_by", order_by, 'str')436 if select is not None:437 query_parameters['$select'] = self._serialize.query("select", select, 'str')438 if from_parameter is not None:439 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')440 if to is not None:441 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')442 if filter is not None:443 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')444 if apply is not None:445 query_parameters['$apply'] = self._serialize.query("apply", apply, 'str')446 # Construct headers447 header_parameters = {}448 header_parameters['Accept'] = 'application/json'449 if self.config.generate_client_request_id:450 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())451 if custom_headers:452 header_parameters.update(custom_headers)453 if self.config.accept_language is not None:454 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')455 # Construct and send request456 request = self._client.post(url, query_parameters, header_parameters)457 response = self._client.send(request, stream=False, **operation_config)458 if response.status_code not in [200]:459 raise models.QueryFailureException(self._deserialize, response)460 deserialized = None461 if response.status_code == 200:462 deserialized = self._deserialize('PolicyEventsQueryResults', response)463 if raw:464 client_raw_response = ClientRawResponse(deserialized, response)465 return client_raw_response466 return deserialized467 list_query_results_for_policy_set_definition.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'}468 def list_query_results_for_policy_definition(469 self, subscription_id, policy_definition_name, query_options=None, custom_headers=None, raw=False, **operation_config):470 """Queries policy events for the subscription level policy definition.471 :param subscription_id: Microsoft Azure subscription ID.472 :type subscription_id: str473 :param policy_definition_name: Policy definition name.474 :type policy_definition_name: str475 :param query_options: Additional parameters for the operation476 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions477 :param dict custom_headers: headers that will be added to the request478 :param bool raw: returns the direct response alongside the479 deserialized response480 :param operation_config: :ref:`Operation configuration481 overrides<msrest:optionsforoperations>`.482 :return: PolicyEventsQueryResults or ClientRawResponse if raw=true483 :rtype: ~azure.mgmt.policyinsights.models.PolicyEventsQueryResults or484 ~msrest.pipeline.ClientRawResponse485 :raises:486 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`487 """488 top = None489 if query_options is not None:490 top = query_options.top491 order_by = None492 if query_options is not None:493 order_by = query_options.order_by494 select = None495 if query_options is not None:496 select = query_options.select497 from_parameter = None498 if query_options is not None:499 from_parameter = query_options.from_property500 to = None501 if query_options is not None:502 to = query_options.to503 filter = None504 if query_options is not None:505 filter = query_options.filter506 apply = None507 if query_options is not None:508 apply = query_options.apply509 # Construct URL510 url = self.list_query_results_for_policy_definition.metadata['url']511 path_format_arguments = {512 'policyEventsResource': self._serialize.url("self.policy_events_resource", self.policy_events_resource, 'str'),513 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),514 'authorizationNamespace': self._serialize.url("self.authorization_namespace", self.authorization_namespace, 'str'),515 'policyDefinitionName': self._serialize.url("policy_definition_name", policy_definition_name, 'str')516 }517 url = self._client.format_url(url, **path_format_arguments)518 # Construct parameters519 query_parameters = {}520 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')521 if top is not None:522 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)523 if order_by is not None:524 query_parameters['$orderby'] = self._serialize.query("order_by", order_by, 'str')525 if select is not None:526 query_parameters['$select'] = self._serialize.query("select", select, 'str')527 if from_parameter is not None:528 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')529 if to is not None:530 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')531 if filter is not None:532 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')533 if apply is not None:534 query_parameters['$apply'] = self._serialize.query("apply", apply, 'str')535 # Construct headers536 header_parameters = {}537 header_parameters['Accept'] = 'application/json'538 if self.config.generate_client_request_id:539 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())540 if custom_headers:541 header_parameters.update(custom_headers)542 if self.config.accept_language is not None:543 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')544 # Construct and send request545 request = self._client.post(url, query_parameters, header_parameters)546 response = self._client.send(request, stream=False, **operation_config)547 if response.status_code not in [200]:548 raise models.QueryFailureException(self._deserialize, response)549 deserialized = None550 if response.status_code == 200:551 deserialized = self._deserialize('PolicyEventsQueryResults', response)552 if raw:553 client_raw_response = ClientRawResponse(deserialized, response)554 return client_raw_response555 return deserialized556 list_query_results_for_policy_definition.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'}557 def list_query_results_for_subscription_level_policy_assignment(558 self, subscription_id, policy_assignment_name, query_options=None, custom_headers=None, raw=False, **operation_config):559 """Queries policy events for the subscription level policy assignment.560 :param subscription_id: Microsoft Azure subscription ID.561 :type subscription_id: str562 :param policy_assignment_name: Policy assignment name.563 :type policy_assignment_name: str564 :param query_options: Additional parameters for the operation565 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions566 :param dict custom_headers: headers that will be added to the request567 :param bool raw: returns the direct response alongside the568 deserialized response569 :param operation_config: :ref:`Operation configuration570 overrides<msrest:optionsforoperations>`.571 :return: PolicyEventsQueryResults or ClientRawResponse if raw=true572 :rtype: ~azure.mgmt.policyinsights.models.PolicyEventsQueryResults or573 ~msrest.pipeline.ClientRawResponse574 :raises:575 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`576 """577 top = None578 if query_options is not None:579 top = query_options.top580 order_by = None581 if query_options is not None:582 order_by = query_options.order_by583 select = None584 if query_options is not None:585 select = query_options.select586 from_parameter = None587 if query_options is not None:588 from_parameter = query_options.from_property589 to = None590 if query_options is not None:591 to = query_options.to592 filter = None593 if query_options is not None:594 filter = query_options.filter595 apply = None596 if query_options is not None:597 apply = query_options.apply598 # Construct URL599 url = self.list_query_results_for_subscription_level_policy_assignment.metadata['url']600 path_format_arguments = {601 'policyEventsResource': self._serialize.url("self.policy_events_resource", self.policy_events_resource, 'str'),602 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),603 'authorizationNamespace': self._serialize.url("self.authorization_namespace", self.authorization_namespace, 'str'),604 'policyAssignmentName': self._serialize.url("policy_assignment_name", policy_assignment_name, 'str')605 }606 url = self._client.format_url(url, **path_format_arguments)607 # Construct parameters608 query_parameters = {}609 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')610 if top is not None:611 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)612 if order_by is not None:613 query_parameters['$orderby'] = self._serialize.query("order_by", order_by, 'str')614 if select is not None:615 query_parameters['$select'] = self._serialize.query("select", select, 'str')616 if from_parameter is not None:617 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')618 if to is not None:619 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')620 if filter is not None:621 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')622 if apply is not None:623 query_parameters['$apply'] = self._serialize.query("apply", apply, 'str')624 # Construct headers625 header_parameters = {}626 header_parameters['Accept'] = 'application/json'627 if self.config.generate_client_request_id:628 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())629 if custom_headers:630 header_parameters.update(custom_headers)631 if self.config.accept_language is not None:632 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')633 # Construct and send request634 request = self._client.post(url, query_parameters, header_parameters)635 response = self._client.send(request, stream=False, **operation_config)636 if response.status_code not in [200]:637 raise models.QueryFailureException(self._deserialize, response)638 deserialized = None639 if response.status_code == 200:640 deserialized = self._deserialize('PolicyEventsQueryResults', response)641 if raw:642 client_raw_response = ClientRawResponse(deserialized, response)643 return client_raw_response644 return deserialized645 list_query_results_for_subscription_level_policy_assignment.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'}646 def list_query_results_for_resource_group_level_policy_assignment(647 self, subscription_id, resource_group_name, policy_assignment_name, query_options=None, custom_headers=None, raw=False, **operation_config):648 """Queries policy events for the resource group level policy assignment.649 :param subscription_id: Microsoft Azure subscription ID.650 :type subscription_id: str651 :param resource_group_name: Resource group name.652 :type resource_group_name: str653 :param policy_assignment_name: Policy assignment name.654 :type policy_assignment_name: str655 :param query_options: Additional parameters for the operation656 :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions657 :param dict custom_headers: headers that will be added to the request658 :param bool raw: returns the direct response alongside the659 deserialized response660 :param operation_config: :ref:`Operation configuration661 overrides<msrest:optionsforoperations>`.662 :return: PolicyEventsQueryResults or ClientRawResponse if raw=true663 :rtype: ~azure.mgmt.policyinsights.models.PolicyEventsQueryResults or664 ~msrest.pipeline.ClientRawResponse665 :raises:666 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`667 """668 top = None669 if query_options is not None:670 top = query_options.top671 order_by = None672 if query_options is not None:673 order_by = query_options.order_by674 select = None675 if query_options is not None:676 select = query_options.select677 from_parameter = None678 if query_options is not None:679 from_parameter = query_options.from_property680 to = None681 if query_options is not None:682 to = query_options.to683 filter = None684 if query_options is not None:685 filter = query_options.filter686 apply = None687 if query_options is not None:688 apply = query_options.apply689 # Construct URL690 url = self.list_query_results_for_resource_group_level_policy_assignment.metadata['url']691 path_format_arguments = {692 'policyEventsResource': self._serialize.url("self.policy_events_resource", self.policy_events_resource, 'str'),693 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'),694 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),695 'authorizationNamespace': self._serialize.url("self.authorization_namespace", self.authorization_namespace, 'str'),696 'policyAssignmentName': self._serialize.url("policy_assignment_name", policy_assignment_name, 'str')697 }698 url = self._client.format_url(url, **path_format_arguments)699 # Construct parameters700 query_parameters = {}701 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')702 if top is not None:703 query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)704 if order_by is not None:705 query_parameters['$orderby'] = self._serialize.query("order_by", order_by, 'str')706 if select is not None:707 query_parameters['$select'] = self._serialize.query("select", select, 'str')708 if from_parameter is not None:709 query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')710 if to is not None:711 query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')712 if filter is not None:713 query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')714 if apply is not None:715 query_parameters['$apply'] = self._serialize.query("apply", apply, 'str')716 # Construct headers717 header_parameters = {}718 header_parameters['Accept'] = 'application/json'719 if self.config.generate_client_request_id:720 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())721 if custom_headers:722 header_parameters.update(custom_headers)723 if self.config.accept_language is not None:724 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')725 # Construct and send request726 request = self._client.post(url, query_parameters, header_parameters)727 response = self._client.send(request, stream=False, **operation_config)728 if response.status_code not in [200]:729 raise models.QueryFailureException(self._deserialize, response)730 deserialized = None731 if response.status_code == 200:732 deserialized = self._deserialize('PolicyEventsQueryResults', response)733 if raw:734 client_raw_response = ClientRawResponse(deserialized, response)735 return client_raw_response736 return deserialized737 list_query_results_for_resource_group_level_policy_assignment.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'}738 def get_metadata(739 self, scope, custom_headers=None, raw=False, **operation_config):740 """Gets OData metadata XML document.741 :param scope: A valid scope, i.e. management group, subscription,742 resource group, or resource ID. Scope used has no effect on metadata743 returned.744 :type scope: str745 :param dict custom_headers: headers that will be added to the request746 :param bool raw: returns the direct response alongside the747 deserialized response748 :param operation_config: :ref:`Operation configuration749 overrides<msrest:optionsforoperations>`.750 :return: str or ClientRawResponse if raw=true751 :rtype: str or ~msrest.pipeline.ClientRawResponse752 :raises:753 :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`754 """755 # Construct URL756 url = self.get_metadata.metadata['url']757 path_format_arguments = {758 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True)759 }760 url = self._client.format_url(url, **path_format_arguments)761 # Construct parameters762 query_parameters = {}763 query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')764 # Construct headers765 header_parameters = {}766 header_parameters['Accept'] = 'application/xml'767 if self.config.generate_client_request_id:768 header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())769 if custom_headers:770 header_parameters.update(custom_headers)771 if self.config.accept_language is not None:772 header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')773 # Construct and send request774 request = self._client.get(url, query_parameters, header_parameters)775 response = self._client.send(request, stream=False, **operation_config)776 if response.status_code not in [200]:777 raise models.QueryFailureException(self._deserialize, response)778 deserialized = None779 if response.status_code == 200:780 deserialized = self._deserialize('str', response)781 if raw:782 client_raw_response = ClientRawResponse(deserialized, response)783 return client_raw_response784 return deserialized...
test_01_from_func.py
Source:test_01_from_func.py
...51 sig = inspect.signature(func)52 from_parameter = SignatureBuilder.__normalizer__.from_parameter53 if name := "self":54 param = sig.parameters[name]55 field = from_parameter(param)56 must_be(param, field)57 if name := "name":58 param = sig.parameters[name]59 field = from_parameter(param)60 must_be(param, field)61 if name := "data":62 param = sig.parameters[name]63 field = from_parameter(param)64 must_be(param, field)65 if name := "db":66 param = sig.parameters[name]67 field = from_parameter(param)68 must_be(param, field)69 if name := "current_user":70 param = sig.parameters[name]71 field = from_parameter(param)72 must_be(param, field)73 if name := "person":74 param = sig.parameters[name]75 field = from_parameter(param)76 must_be(param, field)77 if name := "person2":78 param = sig.parameters[name]79 field = from_parameter(param)80 must_be(param, field)81 if name := "args":82 param = sig.parameters[name]83 field = from_parameter(param)84 must_be(param, field)85 if name := "kwargs":86 param = sig.parameters[name]87 field = from_parameter(param)88 must_be(param, field)89 sb = SignatureBuilder.from_func(func, normalizer=from_parameter)90 fields = {x.name: x for x in sb.get_fields()}91 assert sb.return_annotation == sig.return_annotation92 assert [x for x in fields.keys()] == [93 "self",94 "name",95 "data",96 "db",97 "current_user",98 "person",99 "person2",100 "args",101 "kwargs",...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!