pycadf package

pycadf package

Submodules

pycadf.attachment module

class pycadf.attachment.Attachment(typeURI=None, content=None, name=None)[source]

Bases: pycadf.cadftype.CADFAbstractType

content
is_valid()[source]

Validation to ensure Attachment required attributes are set.

name
typeURI

pycadf.cadftaxonomy module

pycadf.cadftaxonomy.is_valid_action(value)[source]
pycadf.cadftaxonomy.is_valid_outcome(value)[source]
pycadf.cadftaxonomy.is_valid_resource(value)[source]

pycadf.cadftype module

class pycadf.cadftype.CADFAbstractType[source]

Bases: object

The abstract base class for all CADF (complex) data types (classes).

as_dict()[source]

Return dict representation of Event.

is_valid(value)[source]
class pycadf.cadftype.ValidatorDescriptor(name, func=None)[source]

Bases: object

pycadf.cadftype.is_valid_eventType(value)[source]
pycadf.cadftype.is_valid_reporter_role(value)[source]

pycadf.credential module

class pycadf.credential.Credential(token, type=None)[source]

Bases: pycadf.cadftype.CADFAbstractType

is_valid()[source]

Validation to ensure Credential required attributes are set.

token
type
class pycadf.credential.FederatedCredential(token, type, identity_provider, user, groups)[source]

Bases: pycadf.credential.Credential

groups
identity_provider
is_valid()[source]

Validation to ensure Credential required attributes are set.

user

pycadf.endpoint module

class pycadf.endpoint.Endpoint(url, name=None, port=None)[source]

Bases: pycadf.cadftype.CADFAbstractType

is_valid()[source]

Validation to ensure Endpoint required attributes are set.

name
port
url

pycadf.event module

class pycadf.event.Event(eventType='activity', id=None, eventTime=None, action='unknown', outcome='unknown', initiator=None, initiatorId=None, target=None, targetId=None, severity=None, reason=None, observer=None, observerId=None, name=None)[source]

Bases: pycadf.cadftype.CADFAbstractType

action
add_attachment(attachment_val)[source]

Add Attachment to Event

Parameters:attachment_val – Attachment to add to Event
add_measurement(measure_val)[source]

Add a measurement value

Parameters:measure_val – Measurement data type to be added to Event
add_reporterstep(step)[source]

Add a Reporterstep

Parameters:step – Reporterstep to be added to reporterchain
add_tag(tag_val)[source]

Add Tag to Event

Parameters:tag_val – Tag to add to event
eventTime
eventType
id
initiator
initiatorId
is_valid()[source]

Validation to ensure Event required attributes are set.

name
observer
observerId
outcome
reason
severity
target
targetId

pycadf.eventfactory module

class pycadf.eventfactory.EventFactory[source]

Bases: object

Factory class to create different required attributes for the following CADF event types: ‘activity’: for tracking any interesting system activities for audit ‘monitor’: Events that carry Metrics and Measurements and support standards such as NIST ‘control’: For audit events that are based upon (security) policies and reflect some policy decision.

new_event(eventType='activity', **kwargs)[source]

Create new event

Parameters:eventType – eventType of event. Defaults to ‘activity’

pycadf.geolocation module

class pycadf.geolocation.Geolocation(id=None, latitude=None, longitude=None, elevation=None, accuracy=None, city=None, state=None, regionICANN=None)[source]

Bases: pycadf.cadftype.CADFAbstractType

accuracy
city
elevation
id
is_valid()[source]
latitude
longitude
regionICANN
set_annotations(value)[source]
state

pycadf.host module

class pycadf.host.Host(id=None, address=None, agent=None, platform=None)[source]

Bases: pycadf.cadftype.CADFAbstractType

address
agent
id
is_valid()[source]

Validation to ensure Host required attributes are set.

platform

pycadf.identifier module

pycadf.identifier.generate_uuid()[source]

Generate a CADF identifier.

pycadf.identifier.is_valid(value)[source]

Validation to ensure Identifier is correct.

If the Identifier value is a string type but not a valid UUID string, warn against interoperability issues and return True. This relaxes the requirement of having strict UUID checking.

pycadf.measurement module

class pycadf.measurement.Measurement(result=None, metric=None, metricId=None, calculatedBy=None)[source]

Bases: pycadf.cadftype.CADFAbstractType

calculatedBy
is_valid()[source]

Validation to ensure Measurement required attributes are set.

metric
metricId
result

pycadf.metric module

class pycadf.metric.Metric(metricId=None, unit=None, name=None)[source]

Bases: pycadf.cadftype.CADFAbstractType

is_valid()[source]

Validation to ensure Metric required attributes are set.

metricId
name
set_annotations(value)[source]
unit

pycadf.path module

class pycadf.path.Path[source]

Bases: pycadf.cadftype.CADFAbstractType

static is_valid(value)[source]
set_path_absolute()[source]
set_path_relative()[source]

pycadf.reason module

class pycadf.reason.Reason(reasonType=None, reasonCode=None, policyType=None, policyId=None)[source]

Bases: pycadf.cadftype.CADFAbstractType

is_valid()[source]

Validation to ensure Reason required attributes are set.

policyId
policyType
reasonCode
reasonType

pycadf.reporterstep module

class pycadf.reporterstep.Reporterstep(role='modifier', reporterTime=None, reporter=None, reporterId=None)[source]

Bases: pycadf.cadftype.CADFAbstractType

is_valid()[source]

Validation to ensure Reporterstep required attributes are set.

reporter
reporterId
reporterTime
role

pycadf.resource module

class pycadf.resource.Resource(id=None, typeURI='unknown', name=None, ref=None, domain=None, credential=None, host=None, geolocation=None, geolocationId=None)[source]

Bases: pycadf.cadftype.CADFAbstractType

add_address(addr)[source]

Add CADF endpoints to Resource

Parameters:addr – CADF Endpoint to add to Resource
add_attachment(attach_val)[source]

Add CADF attachment to Resource

Parameters:attach_val – CADF Attachment to add to Resource
credential
domain
geolocation
geolocationId
host
id
is_valid()[source]

Validation to ensure Resource required attributes are set

name
ref
typeURI

pycadf.tag module

pycadf.tag.generate_name_value_tag(name, value)[source]

Generate a CADF tag in the format name?value=<value>

Parameters:
  • name – name of tag
  • valuue – optional value tag
pycadf.tag.is_valid(value)[source]

Validation check to ensure proper Tag format

pycadf.timestamp module

pycadf.timestamp.get_utc_now(timezone=None)[source]

Return the current UTC time.

Parameters:timezone – an optional timezone param to offset time to.
pycadf.timestamp.is_valid(value)[source]

Validation to ensure timestamp is a string.

pycadf.utils module

pycadf.utils.mask_value(value, s_percent=0.125)[source]

Obfuscate a given string to show only a percentage of leading and trailing characters.

Parameters:s_percent – The percentage (in decimal) of characters to replace

Module contents

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.