Exemplo n.º 1
0
class BaseArtifact(definitions.ArtifactType):
    __type_version__ = "1.0"
    prop1 = definitions.String()
    prop2 = definitions.Integer()
    int_list = definitions.Array(
        item_type=definitions.Integer(max_value=10, min_value=1))
    depends_on = definitions.ArtifactReference(type_name='MyArtifact')
    references = definitions.ArtifactReferenceList()

    image_file = definitions.BinaryObject()
    screenshots = definitions.BinaryObjectList()
Exemplo n.º 2
0
class ImageAsAnArtifact(definitions.ArtifactType):
    __type_name__ = 'Image'
    __endpoint__ = 'images'

    file = definitions.BinaryObject(required=True)
    disk_format = definitions.String(allowed_values=[
        'ami', 'ari', 'aki', 'vhd', 'vmdk', 'raw', 'qcow2', 'vdi', 'iso'
    ],
                                     required=True,
                                     mutable=False)
    container_format = definitions.String(
        allowed_values=['ami', 'ari', 'aki', 'bare', 'ovf', 'ova', 'docker'],
        required=True,
        mutable=False)
    min_disk = definitions.Integer(min_value=0, default=0)
    min_ram = definitions.Integer(min_value=0, default=0)

    virtual_size = definitions.Integer(min_value=0)
 class TestType(BASE):
     props = defs.Dict(properties={
         "foo": defs.String(),
         "bar": defs.Boolean()
     })
     fixed = defs.Dict(
         properties={
             "name": defs.String(min_length=2),
             "age": defs.Integer(min_value=0, max_value=99)
         })
class SerTestType(defs.ArtifactType):
    some_string = defs.String()
    some_text = defs.Text()
    some_version = defs.SemVerString()
    some_int = defs.Integer()
    some_numeric = defs.Numeric()
    some_bool = defs.Boolean()
    some_array = defs.Array()
    another_array = defs.Array(
        item_type=[defs.Integer(
        ), defs.Numeric(), defs.Boolean()])
    some_dict = defs.Dict()
    another_dict = defs.Dict(properties={
        'foo': defs.Integer(),
        'bar': defs.Boolean()
    })
    some_ref = defs.ArtifactReference()
    some_ref_list = defs.ArtifactReferenceList()
    some_blob = defs.BinaryObject()
    some_blob_list = defs.BinaryObjectList()
Exemplo n.º 5
0
class TestArtifact(definitions.ArtifactType):
    prop1 = definitions.Dict()
    prop2 = definitions.Integer(min_value=10)
 class TestType(BASE):
     simple_props = defs.Dict()
     constrained_props = defs.Dict(properties=defs.Integer(
         min_value=1, allowed_values=[1, 2]),
                                   min_properties=2,
                                   max_properties=3)
 class TestType(BASE):
     address = defs.Array(item_type=[
         defs.String(20),
         defs.Integer(min_value=1),
         defs.Boolean()
     ])
 class WrongType(BASE):
     prop = defs.Integer(min_value=4,
                         max_value=10,
                         allowed_values=[1, 15])
 class WrongType(BASE):
     prop = defs.Integer(min_value=4, default=1)
 class TestType(BASE):
     simple = defs.Integer()
     constrained = defs.Integer(min_value=10, max_value=50)