types.go 3.7 KB
Newer Older
J
jeff 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/*

 Copyright 2019 The KubeSphere Authors.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.

*/
package models

H
hongming 已提交
20 21 22 23 24 25
import (
	v12 "k8s.io/api/core/v1"
	"time"

	"k8s.io/api/rbac/v1"
)
J
jeff 已提交
26 27 28 29 30

type PageableResponse struct {
	Items      []interface{} `json:"items"`
	TotalCount int           `json:"total_count"`
}
H
hongming 已提交
31 32 33 34 35 36 37 38 39 40 41 42 43 44

type Workspace struct {
	Group          `json:",inline"`
	Admin          string   `json:"admin,omitempty"`
	Namespaces     []string `json:"namespaces"`
	DevopsProjects []string `json:"devops_projects"`
}

type WorkspaceDPBinding struct {
	Workspace     string `gorm:"primary_key"`
	DevOpsProject string `gorm:"primary_key"`
}

type DevopsProject struct {
H
hongming 已提交
45
	ProjectId   string     `json:"project_id,omitempty"`
H
hongming 已提交
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
	Name        string     `json:"name"`
	Description string     `json:"description"`
	Creator     string     `json:"creator"`
	CreateTime  *time.Time `json:"create_time,omitempty"`
	Status      *string    `json:"status"`
	Visibility  *string    `json:"visibility,omitempty"`
}

type Action struct {
	Name  string          `json:"name"`
	Rules []v1.PolicyRule `json:"rules"`
}

type Rule struct {
	Name    string   `json:"name"`
	Actions []Action `json:"actions"`
}

type SimpleRule struct {
	Name    string   `json:"name"`
	Actions []string `json:"actions"`
}

type User struct {
H
hongming 已提交
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
	Username        string            `json:"username"`
	Email           string            `json:"email"`
	Lang            string            `json:"lang,omitempty"`
	Description     string            `json:"description"`
	CreateTime      time.Time         `json:"create_time"`
	Groups          []string          `json:"groups,omitempty"`
	Password        string            `json:"password,omitempty"`
	CurrentPassword string            `json:"current_password,omitempty"`
	AvatarUrl       string            `json:"avatar_url"`
	LastLoginTime   string            `json:"last_login_time"`
	Status          int               `json:"status"`
	ClusterRole     string            `json:"cluster_role"`
	Roles           map[string]string `json:"roles,omitempty"`
	Role            string            `json:"role,omitempty"`
	RoleBinding     string            `json:"role_binding,omitempty"`
	RoleBindTime    *time.Time        `json:"role_bind_time,omitempty"`
	WorkspaceRole   string            `json:"workspace_role,omitempty"`
H
hongming 已提交
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
}

type Group struct {
	Path        string   `json:"path"`
	Name        string   `json:"name"`
	Gid         string   `json:"gid"`
	Members     []string `json:"members"`
	Logo        string   `json:"logo"`
	ChildGroups []string `json:"child_groups"`
	Description string   `json:"description"`
}

type Component struct {
	Name            string      `json:"name"`
	Namespace       string      `json:"namespace"`
	SelfLink        string      `json:"selfLink"`
	Label           interface{} `json:"label"`
	StartedAt       time.Time   `json:"startedAt"`
	TotalBackends   int         `json:"totalBackends"`
	HealthyBackends int         `json:"healthyBackends"`
}

type PodInfo struct {
	Namespace string `json:"namespace"`
	Pod       string `json:"pod"`
	Container string `json:"container"`
}

type Token struct {
	Token string `json:"access_token"`
}

type ResourceQuota struct {
	Namespace string                  `json:"namespace"`
	Data      v12.ResourceQuotaStatus `json:"data"`
}