本文整理汇总了Golang中github.com/cloudawan/cloudone_gui/controllers/identity.IsTokenInvalidAndRedirect函数的典型用法代码示例。如果您正苦于以下问题:Golang IsTokenInvalidAndRedirect函数的具体用法?Golang IsTokenInvalidAndRedirect怎么用?Golang IsTokenInvalidAndRedirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsTokenInvalidAndRedirect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Get
// @Title get
// @Description get the autoscaler
// @Param kind path string true "The type of target autoscaler configured for"
// @Param name path string true "The name of target autoscaler configured for"
// @Success 200 {object} guirestapi.deploy.autoscaler.ReplicationControllerAutoScaler
// @Failure 404 error reason
// @router /:kind/:name [get]
func (c *EditController) Get() {
kind := c.GetString(":kind")
name := c.GetString(":name")
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
namespace, _ := c.GetSession("namespace").(string)
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort +
"/api/v1/autoscalers/" + namespace + "/" + kind + "/" + name
replicationControllerAutoScaler := ReplicationControllerAutoScaler{}
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestGetWithStructure(url, &replicationControllerAutoScaler, tokenHeaderMap)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
// Error
c.Data["json"] = make(map[string]interface{})
c.Data["json"].(map[string]interface{})["error"] = err.Error()
c.Ctx.Output.Status = 404
c.ServeJSON()
return
} else {
c.Data["json"] = replicationControllerAutoScaler
c.ServeJSON()
}
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:42,代码来源:edit.go
示例2: Get
// @Title get
// @Description get all services
// @Success 200 {string} []Service
// @Failure 404 error reason
// @router / [get]
func (c *ListController) Get() {
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
namespace := c.GetSession("namespace").(string)
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort +
"/api/v1/services/" + namespace
serviceSlice := make([]Service, 0)
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestGetWithStructure(url, &serviceSlice, tokenHeaderMap)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
// Error
c.Data["json"] = make(map[string]interface{})
c.Data["json"].(map[string]interface{})["error"] = err.Error()
c.Ctx.Output.Status = 404
c.ServeJSON()
return
} else {
c.Data["json"] = serviceSlice
c.ServeJSON()
}
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:37,代码来源:list.go
示例3: Post
func (c *UpgradeController) Post() {
guimessage := guimessagedisplay.GetGUIMessage(c)
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
imageInformationName := c.GetString("name")
description := c.GetString("description")
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort +
"/api/v1/imageinformations/upgrade"
deployUpgradeInput := DeployUpgradeInput{imageInformationName, description}
resultJsonMap := make(map[string]interface{})
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestPutWithStructure(url, deployUpgradeInput, &resultJsonMap, tokenHeaderMap)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
guimessage.AddDanger(guimessagedisplay.GetErrorMessage(err))
} else {
guimessage.AddSuccess(imageInformationName + " is launched")
}
c.Ctx.Redirect(302, "/gui/repository/imageinformation/log?imageInformation="+imageInformationName)
guimessage.RedirectMessage(c)
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:35,代码来源:upgrade.go
示例4: Post
func (c *ResizeController) Post() {
guimessage := guimessagedisplay.GetGUIMessage(c)
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
namespace, _ := c.GetSession("namespace").(string)
name := c.GetString("name")
size, _ := c.GetInt("size")
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort +
"/api/v1/deploys/resize/" + namespace + "/" + name + "?size=" + strconv.Itoa(size)
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestPut(url, make(map[string]interface{}), tokenHeaderMap, false)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
// Error
guimessage.AddDanger(guimessagedisplay.GetErrorMessage(err))
} else {
guimessage.AddSuccess("Application " + name + " is resized")
}
c.Ctx.Redirect(302, "/gui/deploy/deploy/list")
guimessage.RedirectMessage(c)
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:34,代码来源:resize.go
示例5: Get
// @Title get
// @Description get the cluster application template
// @Param name path string true "The name of cluster application template"
// @Success 200 {object} guirestapi.repository.thirdparty.Cluster
// @Failure 404 error reason
// @router /launchinformation/:name [get]
func (c *LaunchController) Get() {
name := c.GetString("name")
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort +
"/api/v1/clusterapplications/" + name
cluster := Cluster{}
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestGetWithStructure(url, &cluster, tokenHeaderMap)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
// Error
c.Data["json"] = make(map[string]interface{})
c.Data["json"].(map[string]interface{})["error"] = err.Error()
c.Ctx.Output.Status = 404
c.ServeJSON()
return
} else {
c.Data["json"] = cluster
c.ServeJSON()
}
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:37,代码来源:launch.go
示例6: Get
func (c *PodDeleteController) Get() {
guimessage := guimessagedisplay.GetGUIMessage(c)
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
namespace := c.GetString("namespace")
pod := c.GetString("pod")
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort +
"/api/v1/pods/" + namespace + "/" + pod
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestDelete(url, nil, tokenHeaderMap, true)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
// Error
guimessage.AddDanger(guimessagedisplay.GetErrorMessage(err))
} else {
guimessage.AddSuccess("Pod " + pod + " is deleted")
}
// Redirect to list
c.Ctx.Redirect(302, "/gui/inventory/replicationcontroller/list")
guimessage.RedirectMessage(c)
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:33,代码来源:pod_delete.go
示例7: Put
// @Title acknowledge
// @Description acknowledge the event
// @Param namespace path string true "The namespace where the event is"
// @Param id path string true "The id of the event"
// @Param acknowledge query string true "acknowledge (true) or unacknowledge (false)"
// @Success 200 {string} {}
// @Failure 404 error reason
// @router /acknowledge/:namespace/:id [put]
func (c *AcknowledgeController) Put() {
namespace := c.GetString(":namespace")
id := c.GetString(":id")
acknowledge := c.GetString("acknowledge")
cloudoneAnalysisProtocol := beego.AppConfig.String("cloudoneAnalysisProtocol")
cloudoneAnalysisHost := beego.AppConfig.String("cloudoneAnalysisHost")
cloudoneAnalysisPort := beego.AppConfig.String("cloudoneAnalysisPort")
url := cloudoneAnalysisProtocol + "://" + cloudoneAnalysisHost + ":" + cloudoneAnalysisPort +
"/api/v1/historicalevents/" + namespace + "/" + id + "?acknowledge=" + acknowledge
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestPutWithStructure(url, nil, nil, tokenHeaderMap)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
// Error
c.Data["json"] = make(map[string]interface{})
c.Data["json"].(map[string]interface{})["error"] = err.Error()
c.Ctx.Output.Status = 404
c.ServeJSON()
return
} else {
c.Data["json"] = make(map[string]interface{})
c.ServeJSON()
}
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:40,代码来源:acknowledge.go
示例8: Get
func (c *DeleteController) Get() {
guimessage := guimessagedisplay.GetGUIMessage(c)
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
imageInformation := c.GetString("imageInformation")
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort +
"/api/v1/deploybluegreens/" + imageInformation
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestDelete(url, nil, tokenHeaderMap, true)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
// Error
guimessage.AddDanger(guimessagedisplay.GetErrorMessage(err))
} else {
guimessage.AddSuccess("Deploy blue green deployment " + imageInformation + " is deleted")
}
// Redirect to list
c.Ctx.Redirect(302, "/gui/deploy/deploybluegreen/list")
guimessage.RedirectMessage(c)
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:32,代码来源:delete.go
示例9: Get
func (c *DeleteController) Get() {
guimessage := guimessagedisplay.GetGUIMessage(c)
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
name := c.GetString("name")
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort +
"/api/v1/notifiers/emailserversmtp/" + name
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestDelete(url, nil, tokenHeaderMap, true)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
// Error
guimessage.AddDanger(guimessagedisplay.GetErrorMessage(err))
} else {
guimessage.AddSuccess("Email server configuration " + name + " is deleted")
}
// Redirect to list
c.Ctx.Redirect(302, "/gui/system/notification/emailserver/list")
guimessage.RedirectMessage(c)
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:32,代码来源:delete.go
示例10: Get
func (c *ConfigureController) Get() {
guimessage := guimessagedisplay.GetGUIMessage(c)
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
name := c.GetString("name")
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort +
"/api/v1/slbs/daemons/" + name + "/configure"
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestPut(url, make(map[string]interface{}), tokenHeaderMap, true)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
// Error
guimessage.AddDanger(guimessagedisplay.GetErrorMessage(err))
} else {
guimessage.AddSuccess("SLB daemon " + name + " is configured")
}
// Redirect to list
c.Ctx.Redirect(302, "/gui/system/slb/daemon/list")
guimessage.RedirectMessage(c)
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:32,代码来源:configure.go
示例11: Get
func (c *DeleteController) Get() {
guimessage := guimessagedisplay.GetGUIMessage(c)
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
serverName := c.GetString("serverName")
repositoryName := c.GetString("repositoryName")
tag := c.GetString("tag")
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort +
"/api/v1/privateregistries/servers/" + serverName + "/repositories/" + repositoryName + "/tags/" + tag
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestDelete(url, nil, tokenHeaderMap, true)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
// Error
guimessage.AddDanger(guimessagedisplay.GetErrorMessage(err))
} else {
guimessage.AddSuccess("Image labeled with the tag " + tag + " is deleted")
}
// Redirect to list
c.Ctx.Redirect(302, "/gui/system/privateregistry/image/list?serverName="+serverName+"&repositoryName="+repositoryName)
guimessage.RedirectMessage(c)
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:34,代码来源:delete.go
示例12: Get
func (c *EditController) Get() {
c.TplName = "system/host/credential/edit.html"
guimessage := guimessagedisplay.GetGUIMessage(c)
// Authorization for web page display
c.Data["layoutMenu"] = c.GetSession("layoutMenu")
ip := c.GetString("ip")
if ip == "" {
c.Data["actionButtonValue"] = "Create"
c.Data["pageHeader"] = "Create Host Credential"
c.Data["createOrUpdate"] = "create"
c.Data["fieldDisabledChecked"] = ""
c.Data["sshPort"] = 22
} else {
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort +
"/api/v1/hosts/credentials/" + ip
credential := Credential{}
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestGetWithStructure(url, &credential, tokenHeaderMap)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
// Error
guimessage.AddDanger(guimessagedisplay.GetErrorMessage(err))
guimessage.OutputMessage(c.Data)
return
}
c.Data["actionButtonValue"] = "Update"
c.Data["pageHeader"] = "Update Host Credential"
c.Data["createOrUpdate"] = "update"
c.Data["ip"] = credential.IP
c.Data["sshPort"] = credential.SSH.Port
c.Data["sshUser"] = credential.SSH.User
c.Data["sshPassword"] = credential.SSH.Password
if credential.Disabled {
c.Data["fieldDisabledChecked"] = "checked"
} else {
c.Data["fieldDisabledChecked"] = ""
}
c.Data["ipFieldReadOnly"] = "readonly"
}
guimessage.OutputMessage(c.Data)
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:60,代码来源:edit.go
示例13: Get
func (c *DeleteController) Get() {
guimessage := guimessagedisplay.GetGUIMessage(c)
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
imageInformationName := c.GetString("name")
imageRecordVersion := c.GetString("version")
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort +
"/api/v1/imagerecords/" + imageInformationName + "/" + imageRecordVersion
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestDelete(url, nil, tokenHeaderMap, true)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
// Error
guimessage.AddDanger(guimessagedisplay.GetErrorMessage(err))
} else {
guimessage.AddSuccess("Image record " + imageRecordVersion + " belonging to " + imageInformationName + " is deleted")
}
// Redirect to list
c.Ctx.Redirect(302, "/gui/repository/imagerecord/list?name="+imageInformationName)
guimessage.RedirectMessage(c)
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:33,代码来源:delete.go
示例14: Post
func (c *EditController) Post() {
guimessage := guimessagedisplay.GetGUIMessage(c)
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
name := c.GetString("name")
namespace := Namespace{name, false, false, "", "", "", ""}
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort + "/api/v1/namespaces"
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestPostWithStructure(url, namespace, nil, tokenHeaderMap)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
// Error
guimessage.AddDanger(guimessagedisplay.GetErrorMessage(err))
} else {
guimessage.AddSuccess("Namespace " + name + " is edited")
}
c.Ctx.Redirect(302, "/gui/system/namespace/list")
guimessage.RedirectMessage(c)
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:32,代码来源:edit.go
示例15: Get
func (c *ResetController) Get() {
guimessage := guimessagedisplay.GetGUIMessage(c)
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
clusterName := c.GetString("clusterName")
glusterfsVolume := c.GetString("glusterfsVolume")
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort +
"/api/v1/glusterfs/clusters/" + clusterName + "/volumes/" + glusterfsVolume
jsonMap := make(map[string]interface{})
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestPut(url, jsonMap, tokenHeaderMap, true)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
// Error
guimessage.AddDanger(guimessagedisplay.GetErrorMessage(err))
} else {
guimessage.AddSuccess("Glusterfs volume " + glusterfsVolume + " is reset")
}
// Redirect to list
c.Ctx.Redirect(302, "/gui/filesystem/glusterfs/volume/list?clusterName="+clusterName)
guimessage.RedirectMessage(c)
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:35,代码来源:reset.go
示例16: Get
// @Title get
// @Description get container log in the pod
// @Param namespace path string true "The name of namespace"
// @Param pod path string true "The name of pod"
// @Success 200 {string} {}
// @Failure 404 error reason
// @router /podlog/:namespace/:pod [get]
func (c *PodLogController) Get() {
namespace := c.GetString(":namespace")
pod := c.GetString(":pod")
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort +
"/api/v1/podlogs/" + namespace + "/" + pod
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
result, err := restclient.RequestGet(url, tokenHeaderMap, true)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
jsonMap, _ := result.(map[string]interface{})
if err != nil {
// Error
c.Data["json"] = make(map[string]interface{})
c.Data["json"].(map[string]interface{})["error"] = err.Error()
c.Ctx.Output.Status = 404
c.ServeJSON()
return
} else {
c.Data["json"] = make(map[string]interface{})
c.Data["json"].(map[string]interface{})["logJsonMap"] = jsonMap
c.ServeJSON()
}
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:41,代码来源:pod_log.go
示例17: Get
func (c *DeleteController) Get() {
guimessage := guimessagedisplay.GetGUIMessage(c)
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
ip := c.GetString("ip")
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort +
"/api/v1/hosts/credentials/" + ip
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestDelete(url, nil, tokenHeaderMap, true)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
// Error
guimessage.AddDanger(guimessagedisplay.GetErrorMessage(err))
} else {
guimessage.AddSuccess("Credential " + ip + " is deleted")
}
// Redirect to list
c.Ctx.Redirect(302, "/gui/system/host/credential/list")
guimessage.RedirectMessage(c)
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:32,代码来源:delete.go
示例18: Delete
// @Title delete
// @Description delete the cluster application deployment
// @Param clusterApplicationName path string true "The name of cluster application deployment"
// @Success 200 {string} {}
// @Failure 404 error reason
// @router /:clusterApplicationName [delete]
func (c *DeleteController) Delete() {
clusterApplicationName := c.GetString(":clusterApplicationName")
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
namespace := c.GetSession("namespace").(string)
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort +
"/api/v1/deployclusterapplications/" + namespace + "/" + clusterApplicationName
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestDelete(url, nil, tokenHeaderMap, true)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
// Error
c.Data["json"] = make(map[string]interface{})
c.Data["json"].(map[string]interface{})["error"] = err.Error()
c.Ctx.Output.Status = 404
c.ServeJSON()
return
} else {
c.Data["json"] = make(map[string]interface{})
c.ServeJSON()
}
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:38,代码来源:delete.go
示例19: Get
func (c *ListController) Get() {
c.TplName = "repository/thirdparty/list.html"
guimessage := guimessagedisplay.GetGUIMessage(c)
// Authorization for web page display
c.Data["layoutMenu"] = c.GetSession("layoutMenu")
// Authorization for Button
user, _ := c.GetSession("user").(*rbac.User)
identity.SetPrivilegeHiddenTag(c.Data, "hiddenTagGuiRepositoryThirdPartyEdit", user, "GET", "/gui/repository/thirdparty/edit")
// Tag won't work in loop so need to be placed in data
hasGuiRepositoryThirdPartyLaunch := user.HasPermission(identity.GetConponentName(), "GET", "/gui/repository/thirdparty/launch")
hasGuiRepositoryThirdPartyEdit := user.HasPermission(identity.GetConponentName(), "GET", "/gui/repository/thirdparty/edit")
hasGuiRepositoryThirdPartyDelete := user.HasPermission(identity.GetConponentName(), "GET", "/gui/repository/thirdparty/delete")
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort +
"/api/v1/clusterapplications/"
thirdPartyApplicationSlice := make([]ThirdPartyApplication, 0)
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestGetWithStructure(url, &thirdPartyApplicationSlice, tokenHeaderMap)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
// Error
guimessage.AddDanger(guimessagedisplay.GetErrorMessage(err))
} else {
for i := 0; i < len(thirdPartyApplicationSlice); i++ {
if hasGuiRepositoryThirdPartyLaunch {
thirdPartyApplicationSlice[i].HiddenTagGuiRepositoryThirdPartyLaunch = "<div class='btn-group'>"
} else {
thirdPartyApplicationSlice[i].HiddenTagGuiRepositoryThirdPartyLaunch = "<div hidden>"
}
if hasGuiRepositoryThirdPartyEdit {
thirdPartyApplicationSlice[i].HiddenTagGuiRepositoryThirdPartyEdit = "<div class='btn-group'>"
} else {
thirdPartyApplicationSlice[i].HiddenTagGuiRepositoryThirdPartyEdit = "<div hidden>"
}
if hasGuiRepositoryThirdPartyDelete {
thirdPartyApplicationSlice[i].HiddenTagGuiRepositoryThirdPartyDelete = "<div class='btn-group'>"
} else {
thirdPartyApplicationSlice[i].HiddenTagGuiRepositoryThirdPartyDelete = "<div hidden>"
}
}
sort.Sort(ByThirdPartyApplication(thirdPartyApplicationSlice))
c.Data["thirdPartyApplicationSlice"] = thirdPartyApplicationSlice
}
guimessage.OutputMessage(c.Data)
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:59,代码来源:list.go
示例20: Post
func (c *UpdateController) Post() {
guimessage := guimessagedisplay.GetGUIMessage(c)
cloudoneProtocol := beego.AppConfig.String("cloudoneProtocol")
cloudoneHost := beego.AppConfig.String("cloudoneHost")
cloudonePort := beego.AppConfig.String("cloudonePort")
namespaces, _ := c.GetSession("namespace").(string)
imageInformationName := c.GetString("name")
version := c.GetString("version")
description := c.GetString("description")
keySlice := make([]string, 0)
inputMap := c.Input()
if inputMap != nil {
for key, _ := range inputMap {
// Only collect environment belonging to this version
if strings.HasPrefix(key, version) {
keySlice = append(keySlice, key)
}
}
}
environmentSlice := make([]ReplicationControllerContainerEnvironment, 0)
length := len(version) + 1 // + 1 for _
for _, key := range keySlice {
value := c.GetString(key)
if len(value) > 0 {
environmentSlice = append(environmentSlice,
ReplicationControllerContainerEnvironment{key[length:], value})
}
}
url := cloudoneProtocol + "://" + cloudoneHost + ":" + cloudonePort +
"/api/v1/deploys/update/" + namespaces
deployUpdateInput := DeployUpdateInput{imageInformationName, version, description, environmentSlice}
tokenHeaderMap, _ := c.GetSession("tokenHeaderMap").(map[string]string)
_, err := restclient.RequestPutWithStructure(url, deployUpdateInput, nil, tokenHeaderMap)
if identity.IsTokenInvalidAndRedirect(c, c.Ctx, err) {
return
}
if err != nil {
// Error
guimessage.AddDanger(guimessagedisplay.GetErrorMessage(err))
} else {
guimessage.AddSuccess("Update deploy " + imageInformationName + " to version " + version + " success")
}
// Redirect to list
c.Ctx.Redirect(302, "/gui/deploy/deploy/list")
guimessage.RedirectMessage(c)
}
开发者ID:cloudawan,项目名称:cloudone_gui,代码行数:59,代码来源:update.go
注:本文中的github.com/cloudawan/cloudone_gui/controllers/identity.IsTokenInvalidAndRedirect函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论