class ClusterQuery(PageQuerySerializer):
    consensus_plugin = serializers.ChoiceField(
        required=False,
        allow_null=True,
        help_text=ConsensusPlugin.get_info("Consensus Plugin:", list_str=True),
        choices=ConsensusPlugin.to_choices(True),
    )
    name = serializers.CharField(
        required=False,
        allow_null=True,
        min_length=NAME_MIN_LEN,
        max_length=NAME_MAX_LEN,
        help_text=NAME_HELP_TEXT,
    )
    host_id = serializers.CharField(help_text="Host ID",
                                    required=False,
                                    allow_null=True)
    network_type = serializers.ChoiceField(
        required=False,
        allow_null=True,
        help_text=NetworkType.get_info("Network Types:", list_str=True),
        choices=NetworkType.to_choices(),
    )
    size = serializers.IntegerField(
        required=False,
        allow_null=True,
        min_value=SIZE_MIN_VALUE,
        max_value=SIZE_MAX_VALUE,
        help_text="Size of cluster",
    )
Ejemplo n.º 2
0
class NodeCreateBody(serializers.Serializer):
    network_type = serializers.ChoiceField(
        help_text=NetworkType.get_info("Network types:", list_str=True),
        choices=NetworkType.to_choices(True),
    )
    type = serializers.ChoiceField(
        help_text=FabricNodeType.get_info("Node Types:", list_str=True),
        choices=FabricNodeType.to_choices(True),
    )
class ClusterCreateBody(serializers.Serializer):
    name = serializers.CharField(
        min_length=NAME_MIN_LEN,
        max_length=NAME_MAX_LEN,
        help_text=NAME_HELP_TEXT,
    )
    host_id = serializers.CharField(help_text="Host ID")
    network_type = serializers.ChoiceField(
        help_text=NetworkType.get_info("Network Types:", list_str=True),
        choices=NetworkType.to_choices(),
    )
    size = serializers.IntegerField(
        min_value=SIZE_MIN_VALUE,
        max_value=SIZE_MAX_VALUE,
        help_text="Size of cluster",
    )
    consensus_plugin = serializers.ChoiceField(
        help_text=ConsensusPlugin.get_info("Consensus Plugin:", list_str=True),
        choices=ConsensusPlugin.to_choices(True),
    )