class AppCopyLSerializer(serializers.Serializer):
    build_source = serializers.SerializerMethodField()
    update_time = DateCharField(max_length=64, help_text="更新日期", allow_null=True)
    deploy_version = serializers.CharField(max_length=32, help_text="构建版本", allow_null=True)
    create_status = serializers.CharField(max_length=32, allow_null=True, help_text="创建状态")
    service_alias = serializers.CharField(max_length=64, allow_null=True, help_text="组件昵称")
    service_cname = serializers.CharField(max_length=128, allow_null=True, help_text="组件中文名称")
    version = serializers.CharField(max_length=32, allow_null=True, help_text="版本")
    service_type = serializers.CharField(max_length=64, allow_null=True, help_text="组件类型")
    service_id = serializers.CharField(max_length=32, allow_null=True, help_text="id")
    app_name = serializers.CharField(max_length=64, allow_null=True, help_text="应用名称")
    min_memory = serializers.CharField(max_length=32, allow_null=True, help_text="组件运行内存")

    def to_internal_value(self, data):
        return data

    def get_build_source(self, instance):
        build_source = instance.get("build_source")
        service_source = build_source.get("service_source")
        if service_source == "docker_image":
            serializer = CompomentDockerImageBuildSourceSerializer(data=build_source)
            serializer.is_valid(raise_exception=True)
        elif service_source == "market":
            serializer = CompomentMarketBuildSourceSerializer(data=build_source)
            serializer.is_valid(raise_exception=True)
        elif service_source == "source_code":
            serializer = CompomentCodeBuildSourceSerializer(data=build_source)
            serializer.is_valid(raise_exception=True)
        else:
            serializer = CompomentBuildSourceSerializer(data=build_source)
            serializer.is_valid(raise_exception=True)
        return serializer.data
Ejemplo n.º 2
0
class UserInfoSerializer(serializers.Serializer):
    user_id = serializers.IntegerField()
    email = serializers.CharField(required=False,
                                  allow_blank=True,
                                  allow_null=True,
                                  max_length=35,
                                  help_text="邮件地址")
    nick_name = serializers.CharField(required=False,
                                      max_length=24,
                                      help_text="用户昵称")
    phone = serializers.CharField(required=False,
                                  allow_blank=True,
                                  allow_null=True,
                                  max_length=11,
                                  help_text="手机号码")
    is_active = serializers.BooleanField(required=False, help_text="激活状态")
    origion = serializers.CharField(required=False,
                                    allow_blank=True,
                                    allow_null=True,
                                    max_length=12,
                                    help_text="用户来源")
    create_time = DateCharField(max_length=64,
                                required=False,
                                help_text="创建时间")
    client_ip = serializers.CharField(required=False,
                                      allow_blank=True,
                                      allow_null=True,
                                      max_length=20,
                                      help_text="注册ip")
    enterprise_id = serializers.CharField(required=False,
                                          max_length=32,
                                          help_text="enterprise_id")
class TeamBaseInfoSerializer(serializers.Serializer):
    tenant_id = serializers.CharField(max_length=64, help_text=u"租户id")
    tenant_name = serializers.CharField(max_length=64, help_text=u"租户名称")
    region = serializers.CharField(max_length=64,
                                   default='',
                                   help_text=u"区域中心,弃用")
    is_active = serializers.BooleanField(default=True, help_text=u"激活状态")
    create_time = DateCharField(max_length=64, help_text=u"创建时间")
    creater = serializers.IntegerField(help_text=u"租户创建者", default=0)
    limit_memory = serializers.IntegerField(help_text=u"内存大小单位(M)",
                                            default=1024)
    update_time = DateCharField(max_length=64, help_text=u"更新时间")
    expired_time = DateCharField(max_length=64, help_text=u"过期时间")
    tenant_alias = serializers.CharField(max_length=64,
                                         allow_null=True,
                                         default='',
                                         help_text=u"团队别名")
    enterprise_id = serializers.CharField(max_length=32,
                                          allow_null=True,
                                          default='',
                                          help_text=u"企业id")
Ejemplo n.º 4
0
class TeamInfoSerializer(serializers.Serializer):
    tenant_id = serializers.CharField(max_length=32, help_text="团队ID")
    tenant_name = serializers.CharField(max_length=24, help_text="团队名称")
    tenant_alias = serializers.CharField(max_length=24, help_text="团队别名")
    enterprise_id = serializers.CharField(max_length=32, help_text="企业ID")
    is_active = serializers.BooleanField(help_text="是否激活", required=False)
    create_time = DateCharField(help_text="创建时间", required=False)
    creater = serializers.CharField(help_text="团队拥有者用户", required=False)
    service_num = serializers.IntegerField(help_text="团队的组件数量", required=False)
    region_num = serializers.IntegerField(help_text="团队开通的数据中心数量",
                                          required=False)
    role_infos = RoleInfoSerializer(many=True,
                                    help_text="用户在团队中拥有的角色",
                                    required=False)
Ejemplo n.º 5
0
class AppServiceEventsSerializer(serializers.Serializer):
    EventID = serializers.CharField(max_length=64, help_text="事件id")
    UserName = serializers.CharField(max_length=64, help_text="操作人")
    EndTime = serializers.CharField(max_length=64, help_text="结束事件")
    Target = serializers.CharField(max_length=64, help_text="操作目标类型")
    OptType = serializers.CharField(max_length=64, help_text="事件类型")
    TargetID = serializers.CharField(max_length=64, help_text="操作目标id")
    ServiceID = serializers.CharField(max_length=64, help_text="服务id")
    Status = serializers.CharField(max_length=64, help_text="状态")
    RequestBody = serializers.CharField(max_length=64, help_text="请求参数")
    create_time = DateCharField(max_length=64, help_text="创建时间")
    FinalStatus = serializers.CharField(max_length=64, help_text="最终状态")
    StartTime = serializers.CharField(max_length=64, help_text="开始时间")
    SynType = serializers.CharField(max_length=64, help_text="同步状态")
    Message = serializers.CharField(max_length=64, help_text="日志")
    TenantID = serializers.CharField(max_length=64, help_text="团队id")
    ID = serializers.CharField(max_length=64, help_text="记录id")
class TeamServicesRespSerializer(serializers.Serializer):
    update_time = DateCharField(max_length=64, help_text=u"更新日期")
    deploy_version = serializers.CharField(max_length=32,
                                           allow_blank=True,
                                           allow_null=True,
                                           help_text=u"组件版本")
    service_alias = serializers.CharField(max_length=32,
                                          allow_blank=True,
                                          allow_null=True,
                                          help_text=u"组件昵称")
    service_cname = serializers.CharField(max_length=255,
                                          allow_blank=True,
                                          allow_null=True,
                                          help_text=u"组件名称")
    group_name = serializers.CharField(max_length=255,
                                       allow_blank=True,
                                       allow_null=True,
                                       help_text=u"应用名称")
    service_type = serializers.CharField(max_length=255,
                                         allow_blank=True,
                                         allow_null=True,
                                         help_text=u"组件类型")
    service_id = serializers.CharField(max_length=64,
                                       allow_blank=True,
                                       allow_null=True,
                                       help_text=u"组件id")
    group_id = serializers.CharField(max_length=32,
                                     allow_blank=True,
                                     allow_null=True,
                                     help_text=u"组id")
    tenant_name = serializers.CharField(max_length=32,
                                        allow_blank=True,
                                        allow_null=True,
                                        help_text=u"租户名称")
    region_id = serializers.CharField(max_length=36,
                                      allow_blank=True,
                                      allow_null=True,
                                      help_text=u"数据中心id")
class EnterpriseInfoSerializer(serializers.Serializer):
    enterprise_id = serializers.CharField(max_length=32,
                                          help_text=u"企业ID(联合云ID)")
    enterprise_name = serializers.CharField(max_length=64, help_text=u"企业名称")
    enterprise_alias = serializers.CharField(max_length=64, help_text=u"企业别名")
    create_time = DateCharField(max_length=64, help_text=u"创建时间")