Beispiel #1
0
class KDSResponse(CloudServiceResponse):
    resource = PolyModelType(StreamResource)
Beispiel #2
0
 class Container(Model):
     item = PolyModelType([IntType(), StringType()])
class HostedZoneResponse(CloudServiceResponse):
    resource = PolyModelType(HostedZoneResource)
Beispiel #4
0
class LaunchConfigurationResponse(CloudServiceResponse):
    resource = PolyModelType(LaunchConfigurationResource)
Beispiel #5
0
 class TestModel(XMLModel):
     items = ListType(PolyModelType([Item, Package]))
Beispiel #6
0
class DictDyField(BaseDynamicField):
    type = StringType(default="dict")
    options = PolyModelType(FieldViewOption, serialize_when_none=False)
Beispiel #7
0
class EnumDyField(BaseDynamicField):
    type = StringType(default="enum")
    options = DictType(PolyModelType([
        StateItemDyField, BadgeItemDyField, ImageItemDyField,
        DatetimeItemDyField
    ]),
                       serialize_when_none=False,
                       default={})

    @classmethod
    def data_source(cls, name, key, **kwargs):
        _data_source = {'key': key, 'name': name}
        _default_badge = kwargs.get('default_badge', {})
        _default_state = kwargs.get('default_state', {})
        _default_outline_badge = kwargs.get('default_outline_badge', [])

        _options_dic = {}

        for _key in _default_outline_badge:
            _round_index = len(TYPE_BADGE)
            _index = _default_outline_badge.index(_key)
            _num = math.floor(_index / len(TYPE_BADGE))

            if _num > 0:
                _round_index = len(TYPE_BADGE) * _num

            if _round_index - 1 < _index:
                _index = _index - _round_index

            _options_dic[_key] = BadgeItemDyField.set(
                {'outline_color': TYPE_BADGE[_index]})

        for _key in _default_badge:
            for _badge in _default_badge[_key]:
                _options_dic[_badge] = BadgeItemDyField.set(
                    {'background_color': _key})

        for _key in _default_state:
            for _state in _default_state[_key]:
                _state_options = {'icon': {'color': 'gray.400'}}

                if _key == 'safe':
                    _state_options = {'icon': {'color': 'green.500'}}
                elif _key == 'disable':
                    _state_options.update({'text_color': 'gray.400'})
                elif _key == 'warning':
                    _state_options = {'icon': {'color': 'yellow.500'}}
                elif _key == 'available':
                    _state_options = {'icon': {'color': 'blue.400'}}
                elif _key == 'alert':
                    _state_options = {
                        'text_color': 'red.500',
                        'icon': {
                            'color': 'red.500'
                        }
                    }

                _options_dic[_state] = StateItemDyField.set(_state_options)

        _data_source.update({'options': _options_dic})

        if 'options' in kwargs:
            _data_source.update({'options': kwargs.get('options')})

        if 'reference' in kwargs:
            _data_source.update({'reference': kwargs.get('reference')})

        return cls(_data_source)
Beispiel #8
0
class MetaDataViewTable(Model):
    layout = PolyModelType(BaseLayoutField)
Beispiel #9
0
class CloudServiceTypeResponse(BaseResponse):
    resource_type = StringType(default='inventory.CloudServiceType')
    match_rules = DictType(ListType(StringType),
                           default={'1': ['name', 'group', 'provider']})
    resource = PolyModelType(CloudServiceTypeResource)
Beispiel #10
0
class DatabaseSoftwareImagesResponse(CloudServiceResponse):
    resource = PolyModelType(DatabaseSoftwareImagesResource)
Beispiel #11
0
class BackupResponse(CloudServiceResponse):
    resource = PolyModelType(BackupResource)
Beispiel #12
0
class DatabaseResponse(CloudServiceResponse):
    resource = PolyModelType(DatabaseResource)
Beispiel #13
0
class DBSystemResponse(CloudServiceResponse):
    resource = PolyModelType(DBSystemsResource)
class EnumDyField(BaseDynamicField):
    type = StringType(default="enum")
    options = DictType(
        PolyModelType([
            StateItemDyField, BadgeItemDyField, ImageItemDyField,
            DatetimeItemDyField
        ]),
        serialize_when_none=False,
        default={},
    )

    @classmethod
    def data_source(cls, name, key, **kwargs):
        _data_source = {"key": key, "name": name}
        _default_badge = kwargs.get("default_badge", {})
        _default_state = kwargs.get("default_state", {})
        _default_outline_badge = kwargs.get("default_outline_badge", [])

        _options_dic = {}

        for _key in _default_outline_badge:
            _round_index = len(TYPE_BADGE)
            _index = _default_outline_badge.index(_key)
            _num = math.floor(_index / len(TYPE_BADGE))

            if _num > 0:
                _round_index = len(TYPE_BADGE) * _num

            if _round_index - 1 < _index:
                _index = _index - _round_index

            _options_dic[_key] = BadgeItemDyField.set(
                {"outline_color": TYPE_BADGE[_index]})

        for _key in _default_badge:
            for _badge in _default_badge[_key]:
                _options_dic[_badge] = BadgeItemDyField.set(
                    {"background_color": _key})

        for _key in _default_state:
            for _state in _default_state[_key]:
                _state_options = {"icon": {"color": "gray.400"}}

                if _key == "safe":
                    _state_options = {"icon": {"color": "green.500"}}
                elif _key == "disable":
                    _state_options.update({"text_color": "gray.400"})
                elif _key == "warning":
                    _state_options = {"icon": {"color": "yellow.500"}}
                elif _key == "available":
                    _state_options = {"icon": {"color": "blue.400"}}
                elif _key == "alert":
                    _state_options = {
                        "text_color": "red.500",
                        "icon": {
                            "color": "red.500"
                        },
                    }

                _options_dic[_state] = StateItemDyField.set(_state_options)

        _data_source.update({"options": _options_dic})

        if "options" in kwargs:
            _data_source.update({"options": kwargs.get("options")})

        if "reference" in kwargs:
            _data_source.update({"reference": kwargs.get("reference")})

        return cls(_data_source)
Beispiel #15
0
class QuerySearchTableLayoutOption(LayoutOptions):
    fields = ListType(PolyModelType(BaseDynamicField))
Beispiel #16
0
class MetaDataView(Model):
    table = PolyModelType(MetaDataViewTable, serialize_when_none=False)
    sub_data = PolyModelType(MetaDataViewSubData, serialize_when_none=False)
    search = ListType(PolyModelType(BaseDynamicSearch),
                      serialize_when_none=False)
Beispiel #17
0
class ListLayoutOption(LayoutOptions):
    layouts = ListType(PolyModelType(BaseLayoutField))
Beispiel #18
0
class RegionResponse(BaseResponse):
    resource_type = StringType(default='inventory.Region')
    match_rules = DictType(ListType(StringType),
                           default={'1': ['provider', 'region_code']})
    resource = PolyModelType(RegionResource)
Beispiel #19
0
class ListDyFieldOptions(FieldViewOption):
    item = PolyModelType(
        [BadgeItemDyField, StateDyField, DateTimeDyField, DictDyField],
        serialize_when_none=False)
    sub_key = StringType(serialize_when_none=False)
    delimiter = StringType(serialize_when_none=False)
Beispiel #20
0
class BaseResponse(Model):
    state = StringType(default='SUCCESS',
                       choices=('SUCCESS', 'FAILURE', 'TIMEOUT'))
    resource_type = StringType(required=True)
    match_rules = DictType(ListType(StringType), default={})
    resource = PolyModelType(Model, default={})
Beispiel #21
0
class AutoScalingGroupResponse(CloudServiceResponse):
    resource = PolyModelType(AutoScalingGroupResource)
Beispiel #22
0
class MetaDataViewSubData(Model):
    layouts = ListType(PolyModelType(BaseLayoutField))
Beispiel #23
0
class LaunchTemplateResponse(CloudServiceResponse):
    resource = PolyModelType(LaunchTemplateResource)
Beispiel #24
0
class AssociatedEntity(Model):
    associate_id = UUIDType(required=True)
    entity_type = EntityType(required=True)
    immediate_data = PolyModelType(EntityData, required=True)
    relationships = ListType(PolyModelType(Relationship), default=list)
Beispiel #25
0
 class RecipeItem(XMLModel):
     item = PolyModelType([self.Eggs, self.Sausage])
Beispiel #26
0
class ItemLayoutOption(LayoutOptions):
    fields = ListType(PolyModelType(BaseDynamicField))
Beispiel #27
0
 class Container(Model):  # pylint: disable=function-redefined
     item = PolyModelType([ModelType(self.TestModel), DecimalType()])
Beispiel #28
0
class SimpleTableLayoutOption(LayoutOptions):
    fields = ListType(PolyModelType(BaseDynamicField))
class DiskResponse(CloudServiceResponse):
    resource = PolyModelType(DiskResource)
Beispiel #30
0
class ECRResponse(CloudServiceResponse):
    resource = PolyModelType(ECRRepositoryResource)