mirror of
https://github.com/LamGC/oracle-manager.git
synced 2025-04-29 22:27:33 +00:00
refactor: 添加 Json 字段常量.
使用常量有助于防止弄混属性意义.
This commit is contained in:
parent
0540c538eb
commit
42210ccf06
@ -251,33 +251,33 @@ class OracleServerExtension(private val bot: BaseAbilityBot) : AbilityExtension
|
|||||||
.rowButton {
|
.rowButton {
|
||||||
text("开机")
|
text("开机")
|
||||||
callbackData(upd.callbackQuery.callbackData.next("oc_server_power_query", jsonObjectOf {
|
callbackData(upd.callbackQuery.callbackData.next("oc_server_power_query", jsonObjectOf {
|
||||||
"power_action" += InstanceAction.START.actionValue
|
JsonFields.PowerAction += InstanceAction.START.actionValue
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
.newRow()
|
.newRow()
|
||||||
.addButton {
|
.addButton {
|
||||||
text("重启(软重启)")
|
text("重启(软重启)")
|
||||||
callbackData(upd.callbackQuery.callbackData.next("oc_server_power_query", jsonObjectOf {
|
callbackData(upd.callbackQuery.callbackData.next("oc_server_power_query", jsonObjectOf {
|
||||||
"power_action" += InstanceAction.SOFT_RESET.actionValue
|
JsonFields.PowerAction += InstanceAction.SOFT_RESET.actionValue
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
.addButton {
|
.addButton {
|
||||||
text("强制重启")
|
text("强制重启")
|
||||||
callbackData(upd.callbackQuery.callbackData.next("oc_server_power_query", jsonObjectOf {
|
callbackData(upd.callbackQuery.callbackData.next("oc_server_power_query", jsonObjectOf {
|
||||||
"power_action" += InstanceAction.RESET.actionValue
|
JsonFields.PowerAction += InstanceAction.RESET.actionValue
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
.newRow()
|
.newRow()
|
||||||
.addButton {
|
.addButton {
|
||||||
text("关机(软关机)")
|
text("关机(软关机)")
|
||||||
callbackData(upd.callbackQuery.callbackData.next("oc_server_power_query", jsonObjectOf {
|
callbackData(upd.callbackQuery.callbackData.next("oc_server_power_query", jsonObjectOf {
|
||||||
"power_action" += InstanceAction.SOFT_STOP.actionValue
|
JsonFields.PowerAction += InstanceAction.SOFT_STOP.actionValue
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
.addButton {
|
.addButton {
|
||||||
text("强制关机")
|
text("强制关机")
|
||||||
callbackData(upd.callbackQuery.callbackData.next("oc_server_power_query", jsonObjectOf {
|
callbackData(upd.callbackQuery.callbackData.next("oc_server_power_query", jsonObjectOf {
|
||||||
"power_action" += InstanceAction.STOP.actionValue
|
JsonFields.PowerAction += InstanceAction.STOP.actionValue
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
.then()
|
.then()
|
||||||
|
@ -443,12 +443,32 @@ fun jsonObjectOf(jsonObject: JsonObject = JsonObject(), block: JsonObjectBuilder
|
|||||||
object JsonFields {
|
object JsonFields {
|
||||||
/**
|
/**
|
||||||
* [OracleAccountProfile] 字段
|
* [OracleAccountProfile] 字段
|
||||||
|
* 类型为 [JsonObject]
|
||||||
*/
|
*/
|
||||||
const val AccountProfile = "account_profile"
|
const val AccountProfile = "account_profile"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [ServerInstance]
|
* [ServerInstance]
|
||||||
|
* 类型为 [JsonObject]
|
||||||
*/
|
*/
|
||||||
const val ServerInstance = "server_instance"
|
const val ServerInstance = "server_instance"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VCN 的 [OCID]
|
||||||
|
* 类型为 [String]
|
||||||
|
*/
|
||||||
|
const val VcnId = "vcnId"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VCN 信息.
|
||||||
|
* 类型为 [JsonObject] => BMC.Vcn
|
||||||
|
*/
|
||||||
|
const val VcnInfo = "vcn_info"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [InstanceAction] 的操作值
|
||||||
|
* 类型为 [String]
|
||||||
|
*/
|
||||||
|
const val PowerAction = "power_action"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user