feat: kubesphere 4.0 (#6115)
* feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> * feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> --------- Signed-off-by: ci-bot <ci-bot@kubesphere.io> Co-authored-by: ks-ci-bot <ks-ci-bot@example.com> Co-authored-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
committed by
GitHub
parent
b5015ec7b9
commit
447a51f08b
93
pkg/controller/openapi/config.go
Normal file
93
pkg/controller/openapi/config.go
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Please refer to the LICENSE file in the root directory of the project.
|
||||
* https://github.com/kubesphere/kubesphere/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/spec"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/api"
|
||||
ksVersion "kubesphere.io/kubesphere/pkg/version"
|
||||
)
|
||||
|
||||
func EnrichSwaggerObject(swo *spec.Swagger) {
|
||||
swo.Info = &spec.Info{
|
||||
InfoProps: spec.InfoProps{
|
||||
Title: "KubeSphere API",
|
||||
Description: "KubeSphere Enterprise OpenAPI",
|
||||
Version: ksVersion.Get().GitVersion,
|
||||
Contact: &spec.ContactInfo{
|
||||
ContactInfoProps: spec.ContactInfoProps{
|
||||
Name: "KubeSphere",
|
||||
URL: "https://kubesphere.com.cn",
|
||||
Email: "support@kubesphere.cloud",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
// setup security definitions
|
||||
swo.SecurityDefinitions = map[string]*spec.SecurityScheme{
|
||||
"BearerToken": {SecuritySchemeProps: spec.SecuritySchemeProps{
|
||||
Type: "apiKey",
|
||||
Name: "Authorization",
|
||||
In: "header",
|
||||
Description: "Bearer Token Authentication",
|
||||
}},
|
||||
}
|
||||
swo.Security = []map[string][]string{{"BearerToken": []string{}}}
|
||||
swo.Tags = []spec.Tag{
|
||||
|
||||
{
|
||||
TagProps: spec.TagProps{
|
||||
Name: api.TagAuthentication,
|
||||
},
|
||||
},
|
||||
{
|
||||
TagProps: spec.TagProps{
|
||||
Name: api.TagMultiCluster,
|
||||
},
|
||||
},
|
||||
{
|
||||
TagProps: spec.TagProps{
|
||||
Name: api.TagIdentityManagement,
|
||||
},
|
||||
},
|
||||
{
|
||||
TagProps: spec.TagProps{
|
||||
Name: api.TagAccessManagement,
|
||||
},
|
||||
},
|
||||
{
|
||||
TagProps: spec.TagProps{
|
||||
Name: api.TagClusterResources,
|
||||
},
|
||||
},
|
||||
{
|
||||
TagProps: spec.TagProps{
|
||||
Name: api.TagNamespacedResources,
|
||||
},
|
||||
},
|
||||
{
|
||||
TagProps: spec.TagProps{
|
||||
Name: api.TagComponentStatus,
|
||||
},
|
||||
},
|
||||
{
|
||||
TagProps: spec.TagProps{
|
||||
Name: api.TagUserRelatedResources,
|
||||
},
|
||||
},
|
||||
{
|
||||
TagProps: spec.TagProps{
|
||||
Name: api.TagTerminal,
|
||||
},
|
||||
},
|
||||
{
|
||||
TagProps: spec.TagProps{
|
||||
Name: api.TagNonResourceAPI,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user