update api doc

Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
hongming
2019-06-06 18:35:57 +08:00
committed by zryfish
parent dd87197de3
commit 468ef322d1
12 changed files with 190 additions and 110 deletions

View File

@@ -38,28 +38,28 @@ import (
)
type Application struct {
Name string `json:"name"`
RepoName string `json:"repoName"`
Runtime string `json:"namespace"`
RuntimeId string `json:"runtime_id"`
Version string `json:"version"`
VersionId string `json:"version_id"`
Status string `json:"status"`
UpdateTime time.Time `json:"updateTime"`
CreateTime time.Time `json:"createTime"`
App string `json:"app"`
AppId string `json:"app_id"`
Description string `json:"description,omitempty"`
WorkLoads *workLoads `json:"workloads,omitempty"`
Services []v1.Service `json:"services,omitempty"`
Ingresses []v1beta1.Ingress `json:"ingresses,omitempty"`
ClusterID string `json:"cluster_id"`
Name string `json:"name" description:"application name"`
RepoName string `json:"repoName" description:"repo name"`
Runtime string `json:"namespace" description:"namespace"`
RuntimeId string `json:"runtime_id" description:"runtime id"`
Version string `json:"version" description:"application version"`
VersionId string `json:"version_id" description:"application version id"`
Status string `json:"status" description:"application status"`
UpdateTime time.Time `json:"updateTime" description:"update time"`
CreateTime time.Time `json:"createTime" description:"create name"`
App string `json:"app" description:"application template name"`
AppId string `json:"app_id" description:"application template id"`
Description string `json:"description,omitempty" description:"application description"`
WorkLoads *workLoads `json:"workloads,omitempty" description:"application workloads"`
Services []v1.Service `json:"services,omitempty" description:"application services"`
Ingresses []v1beta1.Ingress `json:"ingresses,omitempty" description:"application ingresses"`
ClusterID string `json:"cluster_id" description:"application id"`
}
type workLoads struct {
Deployments []appsv1.Deployment `json:"deployments,omitempty"`
Statefulsets []appsv1.StatefulSet `json:"statefulsets,omitempty"`
Daemonsets []appsv1.DaemonSet `json:"daemonsets,omitempty"`
Deployments []appsv1.Deployment `json:"deployments,omitempty" description:"deployment list"`
Statefulsets []appsv1.StatefulSet `json:"statefulsets,omitempty" description:"statefulset list"`
Daemonsets []appsv1.DaemonSet `json:"daemonsets,omitempty" description:"daemonset list"`
}
func ListApplication(runtimeId string, conditions *params.Conditions, limit, offset int) (*models.PageableResponse, error) {

View File

@@ -11,8 +11,8 @@ import (
)
type AuthInfo struct {
RemoteUrl string `json:"remoteUrl"`
SecretRef *corev1.SecretReference `json:"secretRef,omitempty"`
RemoteUrl string `json:"remoteUrl" description:"git server url"`
SecretRef *corev1.SecretReference `json:"secretRef,omitempty" description:"auth secret reference"`
}
func GitReadVerify(namespace string, authInfo AuthInfo) error {

View File

@@ -28,9 +28,9 @@ import (
)
type AuthInfo struct {
Username string `json:"username"`
Password string `json:"password"`
ServerHost string `json:"serverhost"`
Username string `json:"username" description:"username"`
Password string `json:"password" description:"password"`
ServerHost string `json:"serverhost" description:"registry server host"`
}
const loginSuccess = "Login Succeeded"

View File

@@ -26,14 +26,14 @@ import (
"kubesphere.io/kubesphere/pkg/models/resources"
)
type workLoadStatus struct {
Namespace string `json:"namespace"`
Count map[string]int `json:"data"`
Items map[string]interface{} `json:"items,omitempty"`
type WorkLoadStatus struct {
Namespace string `json:"namespace" description:"namespace"`
Count map[string]int `json:"data" description:"unhealthy workload count"`
Items map[string]interface{} `json:"items,omitempty" description:"unhealthy workloads"`
}
func GetNamespacesResourceStatus(namespace string) (*workLoadStatus, error) {
res := workLoadStatus{Count: make(map[string]int), Namespace: namespace, Items: make(map[string]interface{})}
func GetNamespacesResourceStatus(namespace string) (*WorkLoadStatus, error) {
res := WorkLoadStatus{Count: make(map[string]int), Namespace: namespace, Items: make(map[string]interface{})}
var notReadyList *models.PageableResponse
var err error
for _, resource := range []string{resources.Deployments, resources.StatefulSets, resources.DaemonSets, resources.PersistentVolumeClaims, resources.Jobs} {
@@ -61,7 +61,7 @@ func GetNamespacesResourceStatus(namespace string) (*workLoadStatus, error) {
return &res, nil
}
func GetClusterResourceStatus() (*workLoadStatus, error) {
func GetClusterResourceStatus() (*WorkLoadStatus, error) {
return GetNamespacesResourceStatus("")
}

View File

@@ -25,8 +25,8 @@ import (
)
type PageableResponse struct {
Items []interface{} `json:"items"`
TotalCount int `json:"total_count"`
Items []interface{} `json:"items" description:"paging data"`
TotalCount int `json:"total_count" description:"total count"`
}
type Workspace struct {
@@ -47,8 +47,8 @@ type Rule struct {
}
type SimpleRule struct {
Name string `json:"name"`
Actions []string `json:"actions"`
Name string `json:"name" description:"rule name"`
Actions []string `json:"actions" description:"actions"`
}
type User struct {
@@ -82,26 +82,26 @@ type Group struct {
}
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"`
Name string `json:"name" description:"component name"`
Namespace string `json:"namespace" description:"namespace"`
SelfLink string `json:"selfLink" description:"self link"`
Label interface{} `json:"label" description:"labels"`
StartedAt time.Time `json:"startedAt" description:"started time"`
TotalBackends int `json:"totalBackends" description:"total backends"`
HealthyBackends int `json:"healthyBackends" description:"healthy backends"`
}
type PodInfo struct {
Namespace string `json:"namespace"`
Pod string `json:"pod"`
Container string `json:"container"`
Namespace string `json:"namespace" description:"namespace"`
Pod string `json:"pod" description:"pod name"`
Container string `json:"container" description:"container name"`
}
type Token struct {
Token string `json:"access_token"`
Token string `json:"access_token" description:"access token"`
}
type ResourceQuota struct {
Namespace string `json:"namespace"`
Data corev1.ResourceQuotaStatus `json:"data"`
Namespace string `json:"namespace" description:"namespace"`
Data corev1.ResourceQuotaStatus `json:"data" description:"resource quota status"`
}