glance.common.glare package

Submodules

glance.common.glare.declarative module

class glance.common.glare.declarative.ArtifactAttributes[source]

Bases: object

A container class storing description of Artifact Type attributes

add(attribute)[source]
default_blob[source]

Returns the default blob object for an artifact type

default_dependency[source]

Returns the default dependency relation for an artifact type

default_properties_dict[source]

Returns a default properties dict for an artifact type

tags[source]

Returns tags property for an artifact type

class glance.common.glare.declarative.ArtifactPropertyDescriptor(prop, collection_wrapper_class=None)[source]

Bases: object

A descriptor object for working with artifact attributes

class glance.common.glare.declarative.ArtifactTypeMetaclass(class_name, bases, attributes)[source]

Bases: type

A metaclass to build Artifact Types. Not intended to be used directly

Use get_declarative_base to get the base class instead

class glance.common.glare.declarative.ArtifactTypeMetadata(type_name, type_display_name, type_version, type_description, endpoint)[source]

Bases: object

A container to store the meta-information about an artifact type

class glance.common.glare.declarative.AttributeDefinition(display_name=None, description=None, readonly=False, mutable=True, required=False, default=None)[source]

Bases: object

A base class for the attribute definitions which may be added to declaratively defined artifact types

ALLOWED_TYPES = (<type 'object'>,)
get_value(obj)[source]
set_value(obj, value)[source]
validate(value, name=None)[source]
class glance.common.glare.declarative.BlobDefinition(display_name=None, description=None, readonly=False, mutable=True, required=False, default=None)[source]

Bases: glance.common.glare.declarative.AttributeDefinition

A base class for Attributes defining binary objects

class glance.common.glare.declarative.DictAttributeDefinition(properties, min_properties=0, max_properties=0, **kwargs)[source]

Bases: glance.common.glare.declarative.AttributeDefinition

A base class for Attribute definitions having Map-semantics

Is inherited by Dict

ALLOWED_PROPERTY_TYPES = (<class 'glance.common.glare.declarative.AttributeDefinition'>,)
ALLOWED_TYPES = (<type 'dict'>,)
get_prop_definition_at_key(key)[source]
max_properties(value)[source]
min_properties(value)[source]
validate(value, name=None)[source]
class glance.common.glare.declarative.ListAttributeDefinition(item_type, min_size=0, max_size=None, unique=False, **kwargs)[source]

Bases: glance.common.glare.declarative.AttributeDefinition

A base class for Attribute definitions having List-semantics

Is inherited by Array, ArtifactReferenceList and BinaryObjectList

ALLOWED_ITEM_TYPES = (<class 'glance.common.glare.declarative.AttributeDefinition'>,)
ALLOWED_TYPES = (<type 'list'>,)
get_item_definition_at_index(index)[source]
max_size(value)[source]
min_size(value)[source]
unique(value=True)[source]
validate(value, name=None)[source]
class glance.common.glare.declarative.PropertyDefinition(internal=False, allowed_values=None, validators=None, **kwargs)[source]

Bases: glance.common.glare.declarative.AttributeDefinition

A base class for Attributes defining generic or type-specific metadata properties

DB_TYPE = None
allowed_values(values)[source]
class glance.common.glare.declarative.RelationDefinition(internal=False, **kwargs)[source]

Bases: glance.common.glare.declarative.AttributeDefinition

A base class for Attributes defining cross-artifact relations

glance.common.glare.declarative.get_declarative_base(name='base', base_class=<type 'object'>)[source]

Returns a base class which should be inherited to construct Artifact Type object using the declarative syntax of attribute definition

glance.common.glare.definitions module

class glance.common.glare.definitions.Array(item_type=<glance.common.glare.definitions.String object at 0x7f2d8f795650>, min_size=0, max_size=None, unique=False, extra_items=True, **kwargs)[source]

Bases: glance.common.glare.declarative.ListAttributeDefinition, glance.common.glare.declarative.PropertyDefinition, list

An array metadata property

May contain elements of any other PropertyDefinition types except Dict and Array. Each elements maps to appropriate type of columns in database. Preserves order. Allows filtering based on “Array contains Value” semantics

May specify constrains on types of elements, their amount and uniqueness.

ALLOWED_ITEM_TYPES = (<class 'glance.common.glare.declarative.PropertyDefinition'>,)
class glance.common.glare.definitions.ArtifactReference(type_name=None, type_version=None, **kwargs)[source]

Bases: glance.common.glare.declarative.RelationDefinition

An artifact reference definition

Allows to define constraints by the name and version of target artifact

ALLOWED_TYPES

alias of ArtifactType

class glance.common.glare.definitions.ArtifactReferenceList(references=<glance.common.glare.definitions.ArtifactReference object at 0x7f2d8f7a1a90>, min_size=0, max_size=None, **kwargs)[source]

Bases: glance.common.glare.declarative.ListAttributeDefinition, glance.common.glare.declarative.RelationDefinition, list

A list of Artifact References

Allows to define a collection of references to other artifacts, each optionally constrained by type name and type version

ALLOWED_ITEM_TYPES = (<class 'glance.common.glare.definitions.ArtifactReference'>,)
class glance.common.glare.definitions.ArtifactType(**kwargs)[source]

Bases: glance.common.glare.declarative.base

A base class for all the Artifact Type definitions

Defines the Generic metadata properties as attributes.

created_at = <glance.common.glare.definitions.DateTime object at 0x7f2d8f7a1350>
deleted_at = <glance.common.glare.definitions.DateTime object at 0x7f2d8f7a1550>
description = <glance.common.glare.definitions.Text object at 0x7f2d8f795ed0>
id = <glance.common.glare.definitions.String object at 0x7f2d8f795910>
metadata = <glance.common.glare.declarative.ArtifactTypeMetadata object at 0x7f2d8f7a15d0>
name = <glance.common.glare.definitions.String object at 0x7f2d8f795cd0>
owner = <glance.common.glare.definitions.String object at 0x7f2d8f7a1250>
published_at = <glance.common.glare.definitions.DateTime object at 0x7f2d8f7a14d0>
state = <glance.common.glare.definitions.String object at 0x7f2d8f7a1110>
tags = []
type_name = <glance.common.glare.definitions.String object at 0x7f2d8f795a90>
type_version = <glance.common.glare.definitions.SemVerString object at 0x7f2d8f795b90>
updated_at = <glance.common.glare.definitions.DateTime object at 0x7f2d8f7a1450>
version = <glance.common.glare.definitions.SemVerString object at 0x7f2d8f795d90>
visibility = <glance.common.glare.definitions.String object at 0x7f2d8f7a1050>
class glance.common.glare.definitions.BinaryObject(max_file_size=None, min_file_size=None, min_locations=None, max_locations=None, **kwargs)[source]

Bases: glance.common.glare.declarative.BlobDefinition, glance.common.glare.definitions.Blob

A definition of BinaryObject binding

Adds a BinaryObject to an Artifact Type, optionally constrained by file size and amount of locations

ALLOWED_TYPES = (<class 'glance.common.glare.definitions.Blob'>,)
class glance.common.glare.definitions.BinaryObjectList(objects=<glance.common.glare.definitions.BinaryObject object at 0x7f2d8f7a1c10>, min_count=0, max_count=None, **kwargs)[source]

Bases: glance.common.glare.declarative.ListAttributeDefinition, glance.common.glare.declarative.BlobDefinition, list

A definition of binding to the list of BinaryObject

Adds a list of BinaryObject’s to an artifact type, optionally constrained by the number of objects in the list and their uniqueness

ALLOWED_ITEM_TYPES = (<class 'glance.common.glare.definitions.BinaryObject'>,)
class glance.common.glare.definitions.Blob(size=0, locations=None, checksum=None, item_key=None)[source]

Bases: object

A Binary object being part of the Artifact

to_dict()[source]
class glance.common.glare.definitions.Boolean(internal=False, allowed_values=None, validators=None, **kwargs)[source]

Bases: glance.common.glare.declarative.PropertyDefinition

A Boolean metadata property

Maps to Boolean columns in database. Supports filtering and sorting.

ALLOWED_TYPES = (<type 'bool'>,)
DB_TYPE = 'bool'
class glance.common.glare.definitions.DateTime(min_value=None, max_value=None, **kwargs)[source]

Bases: glance.common.glare.declarative.PropertyDefinition

A DateTime metadata property

Maps to a DATETIME columns in database. Is not supported as Type Specific property, may be used only as Generic one

May have constraints on value

ALLOWED_TYPES = (<type 'datetime.datetime'>,)
DB_TYPE = 'datetime'
max_value(value)[source]

Sets the maximum allowed value

min_value(value)[source]

Sets the minimum allowed value

class glance.common.glare.definitions.Dict(properties=<glance.common.glare.definitions.String object at 0x7f2d8f7957d0>, min_properties=0, max_properties=None, **kwargs)[source]

Bases: glance.common.glare.declarative.DictAttributeDefinition, glance.common.glare.declarative.PropertyDefinition, dict

A dictionary metadata property

May contain elements of any other PropertyDefinition types except Dict. Each elements maps to appropriate type of columns in database. Allows filtering and sorting by values of each key except the ones mapping the Text fields.

May specify constrains on types of elements and their amount.

ALLOWED_PROPERTY_TYPES = (<class 'glance.common.glare.declarative.PropertyDefinition'>,)
class glance.common.glare.definitions.Integer(min_value=None, max_value=None, **kwargs)[source]

Bases: glance.common.glare.declarative.PropertyDefinition

An Integer metadata property

Maps to INT columns in Database, supports filtering and sorting. May have constraints on value

ALLOWED_TYPES = ((<type 'int'>, <type 'long'>),)
DB_TYPE = 'int'
max_value(value)[source]

Sets the maximum allowed value

min_value(value)[source]

Sets the minimum allowed value

class glance.common.glare.definitions.Numeric(min_value=None, max_value=None, **kwargs)[source]

Bases: glance.common.glare.declarative.PropertyDefinition

A Numeric metadata property

Maps to floating point number columns in Database, supports filtering and sorting. May have constraints on value

ALLOWED_TYPES

alias of Number

DB_TYPE = 'numeric'
max_value(value)[source]

Sets the maximum allowed value

min_value(value)[source]

Sets the minimum allowed value

class glance.common.glare.definitions.SemVerString(**kwargs)[source]

Bases: glance.common.glare.definitions.String

A String metadata property matching semver pattern

class glance.common.glare.definitions.String(max_length=255, min_length=0, pattern=None, **kwargs)[source]

Bases: glance.common.glare.definitions.Text

A string metadata property of limited length

Maps to VARCHAR columns in database, supports filtering and sorting. May have constrains on length and regexp patterns.

The maximum length is limited to 255 characters

DB_TYPE = 'string'
max_length(value)[source]

Sets the maximum value length

min_length(value)[source]

Sets the minimum value length

pattern(value)[source]

Sets the regexp pattern to match

class glance.common.glare.definitions.Text(internal=False, allowed_values=None, validators=None, **kwargs)[source]

Bases: glance.common.glare.declarative.PropertyDefinition

A text metadata property of arbitrary length

Maps to TEXT columns in database, does not support sorting or filtering

ALLOWED_TYPES = ((<type 'basestring'>,),)
DB_TYPE = 'text'

glance.common.glare.loader module

class glance.common.glare.loader.ArtifactsPluginLoader(namespace)[source]

Bases: object

get_class_by_endpoint(name, version=None)[source]
get_class_by_typename(name, version=None)[source]

glance.common.glare.serialization module

glance.common.glare.serialization.deserialize_from_db(db_dict, plugins)[source]
glance.common.glare.serialization.serialize_for_client(artifact, show_level=0)[source]
glance.common.glare.serialization.serialize_for_db(artifact)[source]

Module contents