Policy Query Python Module

This is the module for quering the Policy service.

This module exports classes and methods for interacting with the designated Pacifica Policy server.

class pacifica.uploader.metadata.policyquery.PolicyQuery(user, *args, **kwargs)[source]

Handle quering the policy server.

Instances of this class represent queries to the designated Pacifica Policy server.

__init__(user, *args, **kwargs)[source]

Set the policy server url and define any data for the query.

The HTTP end-point for the policy server is automatically pulled either from the system environment or from the keyword arguments, **kwargs.

_addr = None
_auth = None
_ingest_path = None
_ingest_url = None
_port = None
_proto = None
_set_url_from_parts()[source]

Set the url from the parts in self.

_uploader_path = None
_uploader_url = None
static fromjson(json_str)[source]

Import json string to self.

get_results()[source]

Get results from the Policy server for the query.

This method returns a JSON object that is the result set for a query to the Pacifica Policy server, i.e., the entities that match the criteria that is represented by the associated instance of the pacifica.uploader.metadata.PolicyQuery.PolicyQueryData class.

get_user()[source]

Get the user id.

pq_data = None
set_user(user)[source]

Set the user for the current PolicyQuery.

tojson()[source]

Export self to json.

user_id = None
valid_metadata(md_obj)[source]

Check the metadata object against the ingest API.

This method validates the given instance of pacifica.uploader.metadata.MetaData, md_obj, against the Pacifica Policy server endpoint.

class pacifica.uploader.metadata.policyquery.PolicyQueryData[source]

Policy query data elements for policy query requests.

This class is a sub-class of the collections.namedtuple class. This class is used directly against the Pacifica Uploader Policy endpoint.

pacifica.uploader.metadata.policyquery._PolicyQueryData

alias of pacifica.uploader.metadata.policyquery.PolicyQueryData

pacifica.uploader.metadata.policyquery._mangle_decode(**json_data)[source]

Mangle the decode of the policy query object.

pacifica.uploader.metadata.policyquery._mangle_encode(obj)[source]

Move the from_table to just from.