def list_for_resource(<EOL>self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter=None, custom_headers=None, raw=False, **operation_config):
def internal_paging(next_link=None, raw=False):<EOL><INDENT>if not next_link:<EOL><INDENT>url = self.list_for_resource.metadata['<STR_LIT:url>']<EOL>path_format_arguments = {<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", resource_group_name, '<STR_LIT:str>', max_length=<NUM_LIT>, min_length=<NUM_LIT:1>, pattern=r'<STR_LIT>'),<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", resource_provider_namespace, '<STR_LIT:str>'),<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", parent_resource_path, '<STR_LIT:str>', skip_quote=True),<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", resource_type, '<STR_LIT:str>', skip_quote=True),<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", resource_name, '<STR_LIT:str>'),<EOL>'<STR_LIT>': self._serialize.url("<STR_LIT>", self.config.subscription_id, '<STR_LIT:str>')<EOL>}<EOL>url = self._client.format_url(url, **path_format_arguments)<EOL>query_parameters = {}<EOL>if filter is not None:<EOL><INDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", filter, '<STR_LIT:str>')<EOL><DEDENT>query_parameters['<STR_LIT>'] = self._serialize.query("<STR_LIT>", self.api_version, '<STR_LIT:str>')<EOL><DEDENT>else:<EOL><INDENT>url = next_link<EOL>query_parameters = {}<EOL><DEDENT>header_parameters = {}<EOL>header_parameters['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>if self.config.generate_client_request_id:<EOL><INDENT>header_parameters['<STR_LIT>'] = str(uuid.uuid1())<EOL><DEDENT>if custom_headers:<EOL><INDENT>header_parameters.update(custom_headers)<EOL><DEDENT>if self.config.accept_language is not None:<EOL><INDENT>header_parameters['<STR_LIT>'] = self._serialize.header("<STR_LIT>", self.config.accept_language, '<STR_LIT:str>')<EOL><DEDENT>request = self._client.get(url, query_parameters, header_parameters)<EOL>response = self._client.send(request, stream=False, **operation_config)<EOL>if response.status_code not in [<NUM_LIT:200>]:<EOL><INDENT>raise models.ErrorResponseException(self._deserialize, response)<EOL><DEDENT>return response<EOL><DEDENT>deserialized = models.PolicyAssignmentPaged(internal_paging, self._deserialize.dependencies)<EOL>if raw:<EOL><INDENT>header_dict = {}<EOL>client_raw_response = models.PolicyAssignmentPaged(internal_paging, self._deserialize.dependencies, header_dict)<EOL>return client_raw_response<EOL><DEDENT>return deserialized<EOL>
Retrieves all policy assignments that apply to a resource.

        This operation retrieves the list of all policy assignments associated
        with the specified resource in the given resource group and
        subscription that match the optional given $filter. Valid values for
        $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If
        $filter is not provided, the unfiltered list includes all policy
        assignments associated with the resource, including those that apply
        directly or from all containing scopes, as well as any applied to
        resources contained within the resource. If $filter=atScope() is
        provided, the returned list includes all policy assignments that apply
        to the resource, which is everything in the unfiltered list except
        those applied to resources contained within the resource. If
        $filter=policyDefinitionId eq '{value}' is provided, the returned list
        includes only policy assignments that apply to the resource and assign
        the policy definition whose id is {value}. Three parameters plus the
        resource name are used to identify a specific resource. If the resource
        is not part of a parent resource (the more common case), the parent
        resource path should not be provided (or provided as ''). For example a
        web app could be specified as ({resourceProviderNamespace} ==
        'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites',
        {resourceName} == 'MyWebApp'). If the resource is part of a parent
        resource, then all parameters should be provided. For example a virtual
        machine DNS name could be specified as ({resourceProviderNamespace} ==
        'Microsoft.Compute', {parentResourcePath} ==
        'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames',
        {resourceName} == 'MyComputerName'). A convenient alternative to
        providing the namespace and type name separately is to provide both in
        the {resourceType} parameter, format: ({resourceProviderNamespace} ==
        '', {parentResourcePath} == '', {resourceType} ==
        'Microsoft.Web/sites', {resourceName} == 'MyWebApp').

        :param resource_group_name: The name of the resource group containing
         the resource.
        :type resource_group_name: str
        :param resource_provider_namespace: The namespace of the resource
         provider. For example, the namespace of a virtual machine is
         Microsoft.Compute (from Microsoft.Compute/virtualMachines)
        :type resource_provider_namespace: str
        :param parent_resource_path: The parent resource path. Use empty
         string if there is none.
        :type parent_resource_path: str
        :param resource_type: The resource type name. For example the type
         name of a web app is 'sites' (from Microsoft.Web/sites).
        :type resource_type: str
        :param resource_name: The name of the resource.
        :type resource_name: str
        :param filter: The filter to apply on the operation. Valid values for
         $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If
         $filter is not provided, no filtering is performed.
        :type filter: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: An iterator like instance of PolicyAssignment
        :rtype:
         ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignmentPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment]
        :raises:
         :class:`ErrorResponseException<azure.mgmt.resource.policy.v2018_05_01.models.ErrorResponseException>`