azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/policy_states_operations.py
def summarize_for_management_group(
            self, management_group_name, query_options=None, custom_headers=None, raw=False, **operation_config):
        """Summarizes policy states for the resources under the management group.

        :param management_group_name: Management group name.
        :type management_group_name: str
        :param query_options: Additional parameters for the operation
        :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: SummarizeResults or ClientRawResponse if raw=true
        :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`
        """
        top = None
        if query_options is not None:
            top = query_options.top
        from_parameter = None
        if query_options is not None:
            from_parameter = query_options.from_property
        to = None
        if query_options is not None:
            to = query_options.to
        filter = None
        if query_options is not None:
            filter = query_options.filter

        # Construct URL
        url = self.summarize_for_management_group.metadata['url']
        path_format_arguments = {
            'policyStatesSummaryResource': self._serialize.url("self.policy_states_summary_resource", self.policy_states_summary_resource, 'str'),
            'managementGroupsNamespace': self._serialize.url("self.management_groups_namespace", self.management_groups_namespace, 'str'),
            'managementGroupName': self._serialize.url("management_group_name", management_group_name, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
        if top is not None:
            query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)
        if from_parameter is not None:
            query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')
        if to is not None:
            query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')
        if filter is not None:
            query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')

        # Construct headers
        header_parameters = {}
        header_parameters['Accept'] = 'application/json'
        if self.config.generate_client_request_id:
            header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

        # Construct and send request
        request = self._client.post(url, query_parameters, header_parameters)
        response = self._client.send(request, stream=False, **operation_config)

        if response.status_code not in [200]:
            raise models.QueryFailureException(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('SummarizeResults', response)

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            return client_raw_response

        return deserialized
def summarize_for_management_group(
            self, management_group_name, query_options=None, custom_headers=None, raw=False, **operation_config):
        """Summarizes policy states for the resources under the management group.

        :param management_group_name: Management group name.
        :type management_group_name: str
        :param query_options: Additional parameters for the operation
        :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: SummarizeResults or ClientRawResponse if raw=true
        :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`
        """
        top = None
        if query_options is not None:
            top = query_options.top
        from_parameter = None
        if query_options is not None:
            from_parameter = query_options.from_property
        to = None
        if query_options is not None:
            to = query_options.to
        filter = None
        if query_options is not None:
            filter = query_options.filter

        # Construct URL
        url = self.summarize_for_management_group.metadata['url']
        path_format_arguments = {
            'policyStatesSummaryResource': self._serialize.url("self.policy_states_summary_resource", self.policy_states_summary_resource, 'str'),
            'managementGroupsNamespace': self._serialize.url("self.management_groups_namespace", self.management_groups_namespace, 'str'),
            'managementGroupName': self._serialize.url("management_group_name", management_group_name, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
        if top is not None:
            query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=0)
        if from_parameter is not None:
            query_parameters['$from'] = self._serialize.query("from_parameter", from_parameter, 'iso-8601')
        if to is not None:
            query_parameters['$to'] = self._serialize.query("to", to, 'iso-8601')
        if filter is not None:
            query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')

        # Construct headers
        header_parameters = {}
        header_parameters['Accept'] = 'application/json'
        if self.config.generate_client_request_id:
            header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

        # Construct and send request
        request = self._client.post(url, query_parameters, header_parameters)
        response = self._client.send(request, stream=False, **operation_config)

        if response.status_code not in [200]:
            raise models.QueryFailureException(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('SummarizeResults', response)

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            return client_raw_response

        return deserialized
Summarizes policy states for the resources under the management group.

        :param management_group_name: Management group name.
        :type management_group_name: str
        :param query_options: Additional parameters for the operation
        :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: SummarizeResults or ClientRawResponse if raw=true
        :rtype: ~azure.mgmt.policyinsights.models.SummarizeResults or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`QueryFailureException<azure.mgmt.policyinsights.models.QueryFailureException>`