Merge pull request 'Add virtual machine interfaces' (#40) from qiwang/pcm-coordinator:master into master
Former-commit-id: 7ec6c07728d706c94340d1d6df1c4774416c33b6
This commit is contained in:
commit
ab25d152cb
228
api/desc/pcm.api
228
api/desc/pcm.api
|
@ -398,6 +398,54 @@ service pcm {
|
|||
@handler PauseServerHandler
|
||||
post /vm/pauseServer (PauseServerReq) returns (PauseServerResp)
|
||||
|
||||
@doc "取消暂停虚拟机"
|
||||
@handler UnpauseServerHandler
|
||||
post /vm/unpauseServer (UnpauseServerReq) returns (UnpauseServerResp)
|
||||
|
||||
@doc "调整大小"
|
||||
@handler ResizeServerHandler
|
||||
post /vm/resizeServer (ResizeServerReq) returns (ResizeServerResp)
|
||||
|
||||
@doc "迁移"
|
||||
@handler MigrateServerHandler
|
||||
post /vm/migrateServer (MigrateServerReq) returns (MigrateServerResp)
|
||||
|
||||
@doc "搁置"
|
||||
@handler ShelveServerHandler
|
||||
post /vm/shelveServer (ShelveServerReq) returns (ShelveServerResp)
|
||||
|
||||
@doc "设置密码"
|
||||
@handler ChangeAdministrativePasswordHandler
|
||||
post /vm/changeAdministrativePassword (ChangeAdministrativePasswordReq) returns (ChangeAdministrativePasswordResp)
|
||||
|
||||
@doc "救援"
|
||||
@handler RescueServerHandler
|
||||
post /vm/rescueServer (RescueServerReq) returns (RescueServerResp)
|
||||
|
||||
@doc "取消救援"
|
||||
@handler UnRescueHandler
|
||||
post /vm/unRescueServer (UnRescueServerReq) returns (UnRescueServerResp)
|
||||
|
||||
@doc "中止"
|
||||
@handler SuspendServerHandler
|
||||
post /vm/suspendServer (SuspendServerReq) returns (SuspendServerResp)
|
||||
|
||||
@doc "将安全组添加到服务器"
|
||||
@handler AddSecurityGroupToServerHandler
|
||||
post /vm/addSecurityGroupToServer (AddSecurityGroupToServerReq) returns (AddSecurityGroupToServerResp)
|
||||
|
||||
@doc "从服务器中删除安全"
|
||||
@handler removeSecurityGroupHandler
|
||||
post /vm/removeSecurityGroup (removeSecurityGroupReq) returns (removeSecurityGroupResp)
|
||||
|
||||
@doc "创建规格"
|
||||
@handler CreateFlavorHandler
|
||||
post /vm/createFlavor (CreateFlavorReq) returns (CreateFlavorResp)
|
||||
|
||||
@doc "创建规格"
|
||||
@handler DeleteFlavorHandler
|
||||
post /vm/deleteFlavor (DeleteFlavorReq) returns (DeleteFlavorResp)
|
||||
|
||||
@doc "查询镜像列表"
|
||||
@handler ListImagesHandler
|
||||
get /vm/listImages (ListImagesReq) returns (ListImagesResp)
|
||||
|
@ -442,6 +490,186 @@ service pcm {
|
|||
@handler BulkCreateNetworksHandler
|
||||
post /vm/bulkCreateNetworks (BulkCreateNetworksReq) returns (BulkCreateNetworksResp)
|
||||
|
||||
@doc "查询子网列表"
|
||||
@handler ListSubnetsHandler
|
||||
get /vm/listSubnets (ListSubnetsReq) returns (ListSubnetsResp)
|
||||
|
||||
@doc "删除子网"
|
||||
@handler DeleteSubnetHandler
|
||||
delete /vm/deleteSubnet (DeleteSubnetReq) returns (DeleteSubnetResp)
|
||||
|
||||
@doc "修改子网"
|
||||
@handler UpdateSubnetHandler
|
||||
put /vm/updateSubnet (UpdateSubnetReq) returns (UpdateSubnetResp)
|
||||
|
||||
@doc "查询网络列表"
|
||||
@handler ListNetworkSegmentRangesRangeHandler
|
||||
get /vm/listNetworkSegmentRanges (ListNetworkSegmentRangesReq) returns (ListNetworkSegmentRangesResp)
|
||||
|
||||
@doc "创建网段"
|
||||
@handler CreateNetworkSegmentRangeHandler
|
||||
post /vm/createNetworkSegmentRange (CreateNetworkSegmentRangeReq) returns (CreateNetworkSegmentRangeResp)
|
||||
|
||||
@doc "删除网段"
|
||||
@handler DeleteNetworkSegmentRangesHandler
|
||||
delete /vm/deleteNetworkSegmentRanges (DeleteNetworkSegmentRangesReq) returns (DeleteNetworkSegmentRangesResp)
|
||||
|
||||
@doc "修改网段"
|
||||
@handler UpdateNetworkSegmentRangesHandler
|
||||
put /vm/updateNetworkSegmentRanges (UpdateNetworkSegmentRangesReq) returns (UpdateNetworkSegmentRangesResp)
|
||||
|
||||
@doc "显示网段详情"
|
||||
@handler ShowNetworkSegmentRangeDetailsHandler
|
||||
get /vm/showNetworkSegmentRangeDetails (ShowNetworkSegmentRangeDetailsReq) returns (ShowNetworkSegmentRangeDetailsResp)
|
||||
|
||||
@doc "创建端口"
|
||||
@handler CreatePortHandler
|
||||
post /vm/createPort (CreatePortReq) returns (CreatePortResp)
|
||||
|
||||
@doc "查询端口列表"
|
||||
@handler ListPortsHandler
|
||||
get /vm/listPortsReq (ListPortsReq) returns (ListPortsResp)
|
||||
|
||||
@doc "删除端口"
|
||||
@handler DeletePortHandler
|
||||
delete /vm/deletePort (DeletePortReq) returns (DeletePortResp)
|
||||
|
||||
@doc "修改端口"
|
||||
@handler UpdatePortHandler
|
||||
put /vm/updatePort (UpdatePortReq) returns (UpdatePortResp)
|
||||
|
||||
@doc "查询端口详情"
|
||||
@handler ShowPortDetailsHandler
|
||||
get /vm/showPortDetails (ShowPortDetailsReq) returns (ShowPortDetailsResp)
|
||||
|
||||
@doc "创建路由"
|
||||
@handler CreateRouterHandler
|
||||
post /vm/createRouter (CreateRouterReq) returns (CreateRouterResp)
|
||||
|
||||
@doc "查询路由列表"
|
||||
@handler ListRoutersHandler
|
||||
get /vm/listRouters (ListRoutersReq) returns (ListRoutersResp)
|
||||
|
||||
@doc "删除路由"
|
||||
@handler DeleteRouterHandler
|
||||
delete /vm/deleteRouter (DeleteRouterReq) returns (DeleteRouterResp)
|
||||
|
||||
@doc "修改路由"
|
||||
@handler UpdateRouterHandler
|
||||
put /vm/updateRouter (UpdateRouterReq) returns (UpdateRouterResp)
|
||||
|
||||
@doc "查询路由详情"
|
||||
@handler ShowRouterDetailsHandler
|
||||
get /vm/showRouterDetails (ShowRouterDetailsReq) returns (ShowRouterDetailsResp)
|
||||
|
||||
@doc "创建浮动ip"
|
||||
@handler CreateFloatingIPHandler
|
||||
post /vm/createFloatingIP (CreateFloatingIPReq) returns (CreateFloatingIPResp)
|
||||
|
||||
@doc "查询浮动ip列表"
|
||||
@handler ListFloatingIPsHandler
|
||||
get /vm/listFloatingIPs (ListFloatingIPsReq) returns (ListFloatingIPsResp)
|
||||
|
||||
@doc "删除浮动ip"
|
||||
@handler DeleteFloatingIPHandler
|
||||
delete /vm/deleteFloatingIP (DeleteFloatingIPReq) returns (DeleteFloatingIPResp)
|
||||
|
||||
@doc "修改浮动ip"
|
||||
@handler UpdateFloatingIPHandler
|
||||
put /vm/updateFloatingIP (UpdateFloatingIPReq) returns (UpdateFloatingIPResp)
|
||||
|
||||
@doc "查询浮动ip详情"
|
||||
@handler ShowFloatingIPDetailsHandler
|
||||
get /vm/showFloatingIPDetails (ShowFloatingIPDetailsReq) returns (ShowFloatingIPDetailsResp)
|
||||
|
||||
@doc "创建防火墙"
|
||||
@handler CreateFirewallGroupHandler
|
||||
post /vm/createFirewallGroup (CreateFirewallGroupReq) returns (CreateFirewallGroupResp)
|
||||
|
||||
@doc "查询防火墙列表"
|
||||
@handler ListFirewallGroupsHandler
|
||||
get /vm/listFirewallGroups (ListFirewallGroupsReq) returns (ListFirewallGroupsResp)
|
||||
|
||||
@doc "删除防火墙"
|
||||
@handler DeleteFirewallGroupHandler
|
||||
delete /vm/deleteFirewallGroup (DeleteFirewallGroupReq) returns (DeleteFirewallGroupResp)
|
||||
|
||||
@doc "修改防火墙"
|
||||
@handler UpdateFirewallGroupHandler
|
||||
put /vm/updateFirewallGroup (UpdateFirewallGroupReq) returns (UpdateFirewallGroupResp)
|
||||
|
||||
@doc "查询防火墙详情"
|
||||
@handler ShowFirewallGroupDetailsHandler
|
||||
get /vm/showFirewallGroupDetails (ShowFirewallGroupDetailsReq) returns (ShowFirewallGroupDetailsResp)
|
||||
|
||||
@doc "创建防火墙策略"
|
||||
@handler CreateFirewallPolicyHandler
|
||||
post /vm/createFirewallPolicy (CreateFirewallPolicyReq) returns (CreateFirewallPolicyResp)
|
||||
|
||||
@doc "查询防火墙策略列表"
|
||||
@handler ListFirewallPoliciesHandler
|
||||
get /vm/listFirewallPolicies (ListFirewallPoliciesReq) returns (ListFirewallPoliciesResp)
|
||||
|
||||
@doc "删除防火墙策略"
|
||||
@handler DeleteFirewallPolicyHandler
|
||||
delete /vm/deleteFirewallPolicy (DeleteFirewallPolicyReq) returns (DeleteFirewallPolicyResp)
|
||||
|
||||
@doc "查询防火墙策略详情"
|
||||
@handler ShowFirewallRuleDetailsHandler
|
||||
get /vm/showFirewallRuleDetails (ShowFirewallRuleDetailsReq) returns (ShowFirewallRuleDetailsResp)
|
||||
|
||||
@doc "查询防火墙策略详情"
|
||||
@handler ShowFirewallPolicyDetailsHandler
|
||||
get /vm/showFirewallPolicyDetails (ShowFirewallPolicyDetailsReq) returns (ShowFirewallPolicyDetailsResp)
|
||||
|
||||
@doc "创建防火墙策略"
|
||||
@handler CreateFirewallRuleHandler
|
||||
post /vm/createFirewallRule (CreateFirewallRuleReq) returns (CreateFirewallRuleResp)
|
||||
|
||||
@doc "查询防火墙策略列表"
|
||||
@handler ListFirewallRulesHandler
|
||||
get /vm/listFirewallRules (ListFirewallRulesReq) returns (ListFirewallRulesResp)
|
||||
|
||||
@doc "删除防火墙策略"
|
||||
@handler DeleteFirewallRuleHandler
|
||||
delete /vm/deleteFirewallRule (DeleteFirewallRuleReq) returns (DeleteFirewallRuleResp)
|
||||
|
||||
@doc "创建安全组"
|
||||
@handler CreateSecurityGroupHandler
|
||||
post /vm/createSecurityGroup (CreateSecurityGroupReq) returns (CreateSecurityGroupResp)
|
||||
|
||||
@doc "查询安全组列表"
|
||||
@handler ListSecurityGroupsHandler
|
||||
get /vm/listSecurityGroups (ListSecurityGroupsReq) returns (ListSecurityGroupsResp)
|
||||
|
||||
@doc "删除安全组"
|
||||
@handler DeleteSecurityGroupHandler
|
||||
delete /vm/deleteSecurityGroup (DeleteSecurityGroupReq) returns (DeleteSecurityGroupResp)
|
||||
|
||||
@doc "修改安全组"
|
||||
@handler UpdateSecurityGroupHandler
|
||||
put /vm/updateSecurityGroup (UpdateSecurityGroupReq) returns (UpdateSecurityGroupResp)
|
||||
|
||||
@doc "查询安全组详情"
|
||||
@handler ShowSecurityGroupHandler
|
||||
get /vm/showSecurityGroup (ShowSecurityGroupReq) returns (ShowSecurityGroupResp)
|
||||
|
||||
@doc "创建安全组规则"
|
||||
@handler CreateSecurityGroupRuleHandler
|
||||
post /vm/createSecurityGroupRule (CreateSecurityGroupRuleReq) returns (CreateSecurityGroupRuleResp)
|
||||
|
||||
@doc "查询安全组规则列表"
|
||||
@handler ListSecurityGroupRulesHandler
|
||||
get /vm/listSecurityGroupRules (ListSecurityGroupRulesReq) returns (ListSecurityGroupRulesResp)
|
||||
|
||||
@doc "删除安全组规则"
|
||||
@handler DeleteSecurityGroupRuleHandler
|
||||
delete /vm/deleteSecurityGroupRule (DeleteSecurityGroupRuleReq) returns (DeleteSecurityGroupRuleResp)
|
||||
|
||||
@doc "查询安全组规则详情"
|
||||
@handler ShowSecurityGroupRuleHandler
|
||||
get /vm/showSecurityGroupRule (ShowSecurityGroupRuleReq) returns (ShowSecurityGroupRuleResp)
|
||||
|
||||
@doc "查询卷详情列表"
|
||||
@handler ListVolumesDetailHandler
|
||||
get /vm/listVolumesDetail (ListVolumesDetailReq) returns (ListVolumesDetailResp)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -469,6 +469,66 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|||
Path: "/vm/pauseServer",
|
||||
Handler: vm.PauseServerHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/unpauseServer",
|
||||
Handler: vm.UnpauseServerHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/resizeServer",
|
||||
Handler: vm.ResizeServerHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/migrateServer",
|
||||
Handler: vm.MigrateServerHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/shelveServer",
|
||||
Handler: vm.ShelveServerHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/changeAdministrativePassword",
|
||||
Handler: vm.ChangeAdministrativePasswordHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/rescueServer",
|
||||
Handler: vm.RescueServerHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/unRescueServer",
|
||||
Handler: vm.UnRescueHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/suspendServer",
|
||||
Handler: vm.SuspendServerHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/addSecurityGroupToServer",
|
||||
Handler: vm.AddSecurityGroupToServerHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/removeSecurityGroup",
|
||||
Handler: vm.RemoveSecurityGroupHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/createFlavor",
|
||||
Handler: vm.CreateFlavorHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/deleteFlavor",
|
||||
Handler: vm.DeleteFlavorHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/listImages",
|
||||
|
@ -524,6 +584,231 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|||
Path: "/vm/bulkCreateNetworks",
|
||||
Handler: vm.BulkCreateNetworksHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/listSubnets",
|
||||
Handler: vm.ListSubnetsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodDelete,
|
||||
Path: "/vm/deleteSubnet",
|
||||
Handler: vm.DeleteSubnetHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPut,
|
||||
Path: "/vm/updateSubnet",
|
||||
Handler: vm.UpdateSubnetHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/listNetworkSegmentRanges",
|
||||
Handler: vm.ListNetworkSegmentRangesRangeHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/createNetworkSegmentRange",
|
||||
Handler: vm.CreateNetworkSegmentRangeHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodDelete,
|
||||
Path: "/vm/deleteNetworkSegmentRanges",
|
||||
Handler: vm.DeleteNetworkSegmentRangesHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPut,
|
||||
Path: "/vm/updateNetworkSegmentRanges",
|
||||
Handler: vm.UpdateNetworkSegmentRangesHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/showNetworkSegmentRangeDetails",
|
||||
Handler: vm.ShowNetworkSegmentRangeDetailsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/createPort",
|
||||
Handler: vm.CreatePortHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/listPortsReq",
|
||||
Handler: vm.ListPortsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodDelete,
|
||||
Path: "/vm/deletePort",
|
||||
Handler: vm.DeletePortHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPut,
|
||||
Path: "/vm/updatePort",
|
||||
Handler: vm.UpdatePortHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/showPortDetails",
|
||||
Handler: vm.ShowPortDetailsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/createRouter",
|
||||
Handler: vm.CreateRouterHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/listRouters",
|
||||
Handler: vm.ListRoutersHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodDelete,
|
||||
Path: "/vm/deleteRouter",
|
||||
Handler: vm.DeleteRouterHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPut,
|
||||
Path: "/vm/updateRouter",
|
||||
Handler: vm.UpdateRouterHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/showRouterDetails",
|
||||
Handler: vm.ShowRouterDetailsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/createFloatingIP",
|
||||
Handler: vm.CreateFloatingIPHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/listFloatingIPs",
|
||||
Handler: vm.ListFloatingIPsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodDelete,
|
||||
Path: "/vm/deleteFloatingIP",
|
||||
Handler: vm.DeleteFloatingIPHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPut,
|
||||
Path: "/vm/updateFloatingIP",
|
||||
Handler: vm.UpdateFloatingIPHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/showFloatingIPDetails",
|
||||
Handler: vm.ShowFloatingIPDetailsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/createFirewallGroup",
|
||||
Handler: vm.CreateFirewallGroupHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/listFirewallGroups",
|
||||
Handler: vm.ListFirewallGroupsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodDelete,
|
||||
Path: "/vm/deleteFirewallGroup",
|
||||
Handler: vm.DeleteFirewallGroupHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPut,
|
||||
Path: "/vm/updateFirewallGroup",
|
||||
Handler: vm.UpdateFirewallGroupHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/showFirewallGroupDetails",
|
||||
Handler: vm.ShowFirewallGroupDetailsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/createFirewallPolicy",
|
||||
Handler: vm.CreateFirewallPolicyHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/listFirewallPolicies",
|
||||
Handler: vm.ListFirewallPoliciesHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodDelete,
|
||||
Path: "/vm/deleteFirewallPolicy",
|
||||
Handler: vm.DeleteFirewallPolicyHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/showFirewallRuleDetails",
|
||||
Handler: vm.ShowFirewallRuleDetailsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/showFirewallPolicyDetails",
|
||||
Handler: vm.ShowFirewallPolicyDetailsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/createFirewallRule",
|
||||
Handler: vm.CreateFirewallRuleHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/listFirewallRules",
|
||||
Handler: vm.ListFirewallRulesHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodDelete,
|
||||
Path: "/vm/deleteFirewallRule",
|
||||
Handler: vm.DeleteFirewallRuleHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/createSecurityGroup",
|
||||
Handler: vm.CreateSecurityGroupHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/listSecurityGroups",
|
||||
Handler: vm.ListSecurityGroupsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodDelete,
|
||||
Path: "/vm/deleteSecurityGroup",
|
||||
Handler: vm.DeleteSecurityGroupHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPut,
|
||||
Path: "/vm/updateSecurityGroup",
|
||||
Handler: vm.UpdateSecurityGroupHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/showSecurityGroup",
|
||||
Handler: vm.ShowSecurityGroupHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/vm/createSecurityGroupRule",
|
||||
Handler: vm.CreateSecurityGroupRuleHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/listSecurityGroupRules",
|
||||
Handler: vm.ListSecurityGroupRulesHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodDelete,
|
||||
Path: "/vm/deleteSecurityGroupRule",
|
||||
Handler: vm.DeleteSecurityGroupRuleHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/showSecurityGroupRule",
|
||||
Handler: vm.ShowSecurityGroupRuleHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/vm/listVolumesDetail",
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func AddSecurityGroupToServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.AddSecurityGroupToServerReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewAddSecurityGroupToServerLogic(r.Context(), svcCtx)
|
||||
resp, err := l.AddSecurityGroupToServer(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ChangeAdministrativePasswordHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ChangeAdministrativePasswordReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewChangeAdministrativePasswordLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ChangeAdministrativePassword(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func CreateFirewallGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreateFirewallGroupReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewCreateFirewallGroupLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CreateFirewallGroup(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func CreateFirewallPolicyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreateFirewallPolicyReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewCreateFirewallPolicyLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CreateFirewallPolicy(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func CreateFirewallRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreateFirewallRuleReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewCreateFirewallRuleLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CreateFirewallRule(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func CreateFlavorHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreateFlavorReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewCreateFlavorLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CreateFlavor(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func CreateFloatingIPHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreateFloatingIPReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewCreateFloatingIPLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CreateFloatingIP(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func CreateNetworkSegmentRangeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreateNetworkSegmentRangeReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewCreateNetworkSegmentRangeLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CreateNetworkSegmentRange(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func CreatePortHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreatePortReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewCreatePortLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CreatePort(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func CreateRouterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreateRouterReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewCreateRouterLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CreateRouter(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func CreateSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreateSecurityGroupReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewCreateSecurityGroupLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CreateSecurityGroup(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func CreateSecurityGroupRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreateSecurityGroupRuleReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewCreateSecurityGroupRuleLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CreateSecurityGroupRule(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func DeleteFirewallGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DeleteFirewallGroupReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewDeleteFirewallGroupLogic(r.Context(), svcCtx)
|
||||
resp, err := l.DeleteFirewallGroup(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func DeleteFirewallPolicyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DeleteFirewallPolicyReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewDeleteFirewallPolicyLogic(r.Context(), svcCtx)
|
||||
resp, err := l.DeleteFirewallPolicy(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func DeleteFirewallRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DeleteFirewallRuleReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewDeleteFirewallRuleLogic(r.Context(), svcCtx)
|
||||
resp, err := l.DeleteFirewallRule(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func DeleteFlavorHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DeleteFlavorReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewDeleteFlavorLogic(r.Context(), svcCtx)
|
||||
resp, err := l.DeleteFlavor(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func DeleteFloatingIPHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DeleteFloatingIPReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewDeleteFloatingIPLogic(r.Context(), svcCtx)
|
||||
resp, err := l.DeleteFloatingIP(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func DeleteNetworkSegmentRangesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DeleteNetworkSegmentRangesReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewDeleteNetworkSegmentRangesLogic(r.Context(), svcCtx)
|
||||
resp, err := l.DeleteNetworkSegmentRanges(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func DeletePortHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DeletePortReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewDeletePortLogic(r.Context(), svcCtx)
|
||||
resp, err := l.DeletePort(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func DeleteRouterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DeleteRouterReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewDeleteRouterLogic(r.Context(), svcCtx)
|
||||
resp, err := l.DeleteRouter(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func DeleteSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DeleteSecurityGroupReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewDeleteSecurityGroupLogic(r.Context(), svcCtx)
|
||||
resp, err := l.DeleteSecurityGroup(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func DeleteSecurityGroupRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DeleteSecurityGroupRuleReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewDeleteSecurityGroupRuleLogic(r.Context(), svcCtx)
|
||||
resp, err := l.DeleteSecurityGroupRule(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func DeleteSubnetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DeleteSubnetReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewDeleteSubnetLogic(r.Context(), svcCtx)
|
||||
resp, err := l.DeleteSubnet(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ListFirewallGroupsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ListFirewallGroupsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewListFirewallGroupsLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ListFirewallGroups(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ListFirewallPoliciesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ListFirewallPoliciesReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewListFirewallPoliciesLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ListFirewallPolicies(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ListFirewallRulesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ListFirewallRulesReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewListFirewallRulesLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ListFirewallRules(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ListFloatingIPsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ListFloatingIPsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewListFloatingIPsLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ListFloatingIPs(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ListNetworkSegmentRangesRangeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ListNetworkSegmentRangesReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewListNetworkSegmentRangesRangeLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ListNetworkSegmentRangesRange(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ListPortsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ListPortsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewListPortsLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ListPorts(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ListRoutersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ListRoutersReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewListRoutersLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ListRouters(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ListSecurityGroupRulesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ListSecurityGroupRulesReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewListSecurityGroupRulesLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ListSecurityGroupRules(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ListSecurityGroupsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ListSecurityGroupsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewListSecurityGroupsLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ListSecurityGroups(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ListSubnetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ListSubnetsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewListSubnetsLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ListSubnets(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func MigrateServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.MigrateServerReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewMigrateServerLogic(r.Context(), svcCtx)
|
||||
resp, err := l.MigrateServer(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func RemoveSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.RemoveSecurityGroupReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewRemoveSecurityGroupLogic(r.Context(), svcCtx)
|
||||
resp, err := l.RemoveSecurityGroup(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func RescueServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.RescueServerReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewRescueServerLogic(r.Context(), svcCtx)
|
||||
resp, err := l.RescueServer(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ResizeServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ResizeServerReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewResizeServerLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ResizeServer(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ShelveServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ShelveServerReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewShelveServerLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ShelveServer(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ShowFirewallGroupDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ShowFirewallGroupDetailsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewShowFirewallGroupDetailsLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ShowFirewallGroupDetails(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ShowFirewallPolicyDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ShowFirewallPolicyDetailsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewShowFirewallPolicyDetailsLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ShowFirewallPolicyDetails(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ShowFirewallRuleDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ShowFirewallRuleDetailsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewShowFirewallRuleDetailsLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ShowFirewallRuleDetails(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ShowFloatingIPDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ShowFloatingIPDetailsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewShowFloatingIPDetailsLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ShowFloatingIPDetails(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ShowNetworkSegmentRangeDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ShowNetworkSegmentRangeDetailsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewShowNetworkSegmentRangeDetailsLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ShowNetworkSegmentRangeDetails(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ShowPortDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ShowPortDetailsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewShowPortDetailsLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ShowPortDetails(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ShowRouterDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ShowRouterDetailsReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewShowRouterDetailsLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ShowRouterDetails(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ShowSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ShowSecurityGroupReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewShowSecurityGroupLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ShowSecurityGroup(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func ShowSecurityGroupRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.ShowSecurityGroupRuleReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewShowSecurityGroupRuleLogic(r.Context(), svcCtx)
|
||||
resp, err := l.ShowSecurityGroupRule(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func SuspendServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.SuspendServerReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewSuspendServerLogic(r.Context(), svcCtx)
|
||||
resp, err := l.SuspendServer(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func UnpauseServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.UnpauseServerReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewUnpauseServerLogic(r.Context(), svcCtx)
|
||||
resp, err := l.UnpauseServer(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func UnRescueHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.UnRescueServerReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewUnRescueLogic(r.Context(), svcCtx)
|
||||
resp, err := l.UnRescue(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func UpdateFirewallGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.UpdateFirewallGroupReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewUpdateFirewallGroupLogic(r.Context(), svcCtx)
|
||||
resp, err := l.UpdateFirewallGroup(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func UpdateFloatingIPHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.UpdateFloatingIPReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewUpdateFloatingIPLogic(r.Context(), svcCtx)
|
||||
resp, err := l.UpdateFloatingIP(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func UpdateNetworkSegmentRangesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.UpdateNetworkSegmentRangesReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewUpdateNetworkSegmentRangesLogic(r.Context(), svcCtx)
|
||||
resp, err := l.UpdateNetworkSegmentRanges(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func UpdatePortHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.UpdatePortReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewUpdatePortLogic(r.Context(), svcCtx)
|
||||
resp, err := l.UpdatePort(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func UpdateRouterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.UpdateRouterReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewUpdateRouterLogic(r.Context(), svcCtx)
|
||||
resp, err := l.UpdateRouter(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func UpdateSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.UpdateSecurityGroupReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewUpdateSecurityGroupLogic(r.Context(), svcCtx)
|
||||
resp, err := l.UpdateSecurityGroup(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
)
|
||||
|
||||
func UpdateSubnetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.UpdateSubnetReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := vm.NewUpdateSubnetLogic(r.Context(), svcCtx)
|
||||
resp, err := l.UpdateSubnet(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type AddSecurityGroupToServerLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewAddSecurityGroupToServerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddSecurityGroupToServerLogic {
|
||||
return &AddSecurityGroupToServerLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *AddSecurityGroupToServerLogic) AddSecurityGroupToServer(req *types.AddSecurityGroupToServerReq) (resp *types.AddSecurityGroupToServerResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
AddSecurityGroupToServerReq := &openstack.AddSecurityGroupToServerReq{}
|
||||
err = copier.CopyWithOption(AddSecurityGroupToServerReq, req, copier.Option{Converters: utils.Converters})
|
||||
AddSecurityGroupToServerResp, err := l.svcCtx.OpenstackRpc.AddSecurityGroupToServer(l.ctx, AddSecurityGroupToServerReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&AddSecurityGroupToServerResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &AddSecurityGroupToServerResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ChangeAdministrativePasswordLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewChangeAdministrativePasswordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ChangeAdministrativePasswordLogic {
|
||||
return &ChangeAdministrativePasswordLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ChangeAdministrativePasswordLogic) ChangeAdministrativePassword(req *types.ChangeAdministrativePasswordReq) (resp *types.ChangeAdministrativePasswordResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
ChangeAdministrativePasswordReq := &openstack.ChangeAdministrativePasswordReq{}
|
||||
err = copier.CopyWithOption(ChangeAdministrativePasswordReq, req, copier.Option{Converters: utils.Converters})
|
||||
ChangeAdministrativePasswordResp, err := l.svcCtx.OpenstackRpc.ChangeAdministrativePassword(l.ctx, ChangeAdministrativePasswordReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&ChangeAdministrativePasswordResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &ChangeAdministrativePasswordResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateFirewallGroupLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCreateFirewallGroupLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateFirewallGroupLogic {
|
||||
return &CreateFirewallGroupLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateFirewallGroupLogic) CreateFirewallGroup(req *types.CreateFirewallGroupReq) (resp *types.CreateFirewallGroupResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
CreateFirewallGroupReq := &openstack.CreateFirewallGroupReq{}
|
||||
err = copier.CopyWithOption(CreateFirewallGroupReq, req, copier.Option{Converters: utils.Converters})
|
||||
CreateFirewallGroupResp, err := l.svcCtx.OpenstackRpc.CreateFirewallGroup(l.ctx, CreateFirewallGroupReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&CreateFirewallGroupResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &CreateFirewallGroupResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateFirewallPolicyLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCreateFirewallPolicyLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateFirewallPolicyLogic {
|
||||
return &CreateFirewallPolicyLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateFirewallPolicyLogic) CreateFirewallPolicy(req *types.CreateFirewallPolicyReq) (resp *types.CreateFirewallPolicyResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
CreateFirewallPolicyReq := &openstack.CreateFirewallPolicyReq{}
|
||||
err = copier.CopyWithOption(CreateFirewallPolicyReq, req, copier.Option{Converters: utils.Converters})
|
||||
CreateFirewallPolicyResp, err := l.svcCtx.OpenstackRpc.CreateFirewallPolicy(l.ctx, CreateFirewallPolicyReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&CreateFirewallPolicyResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &CreateFirewallPolicyResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateFirewallRuleLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCreateFirewallRuleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateFirewallRuleLogic {
|
||||
return &CreateFirewallRuleLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateFirewallRuleLogic) CreateFirewallRule(req *types.CreateFirewallRuleReq) (resp *types.CreateFirewallRuleResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
CreateFirewallRuleReq := &openstack.CreateFirewallRuleReq{}
|
||||
err = copier.CopyWithOption(CreateFirewallRuleReq, req, copier.Option{Converters: utils.Converters})
|
||||
CreateFirewallRuleResp, err := l.svcCtx.OpenstackRpc.CreateFirewallRule(l.ctx, CreateFirewallRuleReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&CreateFirewallRuleResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &CreateFirewallRuleResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateFlavorLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCreateFlavorLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateFlavorLogic {
|
||||
return &CreateFlavorLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateFlavorLogic) CreateFlavor(req *types.CreateFlavorReq) (resp *types.CreateFlavorResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
CreateFlavorReq := &openstack.CreateFlavorReq{}
|
||||
err = copier.CopyWithOption(CreateFlavorReq, req, copier.Option{Converters: utils.Converters})
|
||||
CreateFlavorResp, err := l.svcCtx.OpenstackRpc.CreateFlavor(l.ctx, CreateFlavorReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&CreateFlavorResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &CreateFlavorResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateFloatingIPLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCreateFloatingIPLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateFloatingIPLogic {
|
||||
return &CreateFloatingIPLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateFloatingIPLogic) CreateFloatingIP(req *types.CreateFloatingIPReq) (resp *types.CreateFloatingIPResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
CreateFloatingIPReq := &openstack.CreateFloatingIPReq{}
|
||||
err = copier.CopyWithOption(CreateFloatingIPReq, req, copier.Option{Converters: utils.Converters})
|
||||
CreateFloatingIPResp, err := l.svcCtx.OpenstackRpc.CreateFloatingIP(l.ctx, CreateFloatingIPReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&CreateFloatingIPResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &CreateFloatingIPResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateNetworkSegmentRangeLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCreateNetworkSegmentRangeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateNetworkSegmentRangeLogic {
|
||||
return &CreateNetworkSegmentRangeLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateNetworkSegmentRangeLogic) CreateNetworkSegmentRange(req *types.CreateNetworkSegmentRangeReq) (resp *types.CreateNetworkSegmentRangeResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
CreateNetworkSegmentRangeReq := &openstack.CreateNetworkSegmentRangeReq{}
|
||||
err = copier.CopyWithOption(CreateNetworkSegmentRangeReq, req, copier.Option{Converters: utils.Converters})
|
||||
CreateNetworkSegmentRangeResp, err := l.svcCtx.OpenstackRpc.CreateNetworkSegmentRange(l.ctx, CreateNetworkSegmentRangeReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&CreateNetworkSegmentRangeResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &CreateNetworkSegmentRangeResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreatePortLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCreatePortLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreatePortLogic {
|
||||
return &CreatePortLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreatePortLogic) CreatePort(req *types.CreatePortReq) (resp *types.CreatePortResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
CreatePortReq := &openstack.CreatePortReq{}
|
||||
err = copier.CopyWithOption(CreatePortReq, req, copier.Option{Converters: utils.Converters})
|
||||
CreatePortResp, err := l.svcCtx.OpenstackRpc.CreatePort(l.ctx, CreatePortReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&CreatePortResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &CreatePortResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateRouterLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCreateRouterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateRouterLogic {
|
||||
return &CreateRouterLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateRouterLogic) CreateRouter(req *types.CreateRouterReq) (resp *types.CreateRouterResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
CreateRouterReq := &openstack.CreateRouterReq{}
|
||||
err = copier.CopyWithOption(CreateRouterReq, req, copier.Option{Converters: utils.Converters})
|
||||
CreateRouterResp, err := l.svcCtx.OpenstackRpc.CreateRouter(l.ctx, CreateRouterReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&CreateRouterResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &CreateRouterResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateSecurityGroupLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCreateSecurityGroupLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateSecurityGroupLogic {
|
||||
return &CreateSecurityGroupLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateSecurityGroupLogic) CreateSecurityGroup(req *types.CreateSecurityGroupReq) (resp *types.CreateSecurityGroupResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
CreateSecurityGroupReq := &openstack.CreateSecurityGroupReq{}
|
||||
err = copier.CopyWithOption(CreateSecurityGroupReq, req, copier.Option{Converters: utils.Converters})
|
||||
CreateSecurityGroupResp, err := l.svcCtx.OpenstackRpc.CreateSecurityGroup(l.ctx, CreateSecurityGroupReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&CreateSecurityGroupResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &CreateSecurityGroupResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateSecurityGroupRuleLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCreateSecurityGroupRuleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateSecurityGroupRuleLogic {
|
||||
return &CreateSecurityGroupRuleLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateSecurityGroupRuleLogic) CreateSecurityGroupRule(req *types.CreateSecurityGroupRuleReq) (resp *types.CreateSecurityGroupRuleResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
CreateSecurityGroupRuleReq := &openstack.CreateSecurityGroupRuleReq{}
|
||||
err = copier.CopyWithOption(CreateSecurityGroupRuleReq, req, copier.Option{Converters: utils.Converters})
|
||||
CreateSecurityGroupRuleResp, err := l.svcCtx.OpenstackRpc.CreateSecurityGroupRule(l.ctx, CreateSecurityGroupRuleReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&CreateSecurityGroupRuleResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &CreateSecurityGroupRuleResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteFirewallGroupLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewDeleteFirewallGroupLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteFirewallGroupLogic {
|
||||
return &DeleteFirewallGroupLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteFirewallGroupLogic) DeleteFirewallGroup(req *types.DeleteFirewallGroupReq) (resp *types.DeleteFirewallGroupResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
DeleteFirewallGroupReq := &openstack.DeleteFirewallGroupReq{}
|
||||
err = copier.CopyWithOption(DeleteFirewallGroupReq, req, copier.Option{Converters: utils.Converters})
|
||||
DeleteFirewallGroupResp, err := l.svcCtx.OpenstackRpc.DeleteFirewallGroup(l.ctx, DeleteFirewallGroupReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&DeleteFirewallGroupResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &DeleteFirewallGroupResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteFirewallPolicyLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewDeleteFirewallPolicyLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteFirewallPolicyLogic {
|
||||
return &DeleteFirewallPolicyLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteFirewallPolicyLogic) DeleteFirewallPolicy(req *types.DeleteFirewallPolicyReq) (resp *types.DeleteFirewallPolicyResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
DeleteFirewallPolicyReq := &openstack.DeleteFirewallPolicyReq{}
|
||||
err = copier.CopyWithOption(DeleteFirewallPolicyReq, req, copier.Option{Converters: utils.Converters})
|
||||
DeleteFirewallPolicyResp, err := l.svcCtx.OpenstackRpc.DeleteFirewallPolicy(l.ctx, DeleteFirewallPolicyReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&DeleteFirewallPolicyResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &DeleteFirewallPolicyResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteFirewallRuleLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewDeleteFirewallRuleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteFirewallRuleLogic {
|
||||
return &DeleteFirewallRuleLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteFirewallRuleLogic) DeleteFirewallRule(req *types.DeleteFirewallRuleReq) (resp *types.DeleteFirewallRuleResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
DeleteFirewallRuleReq := &openstack.DeleteFirewallPolicyReq{}
|
||||
err = copier.CopyWithOption(DeleteFirewallRuleReq, req, copier.Option{Converters: utils.Converters})
|
||||
DeleteFirewallRuleResp, err := l.svcCtx.OpenstackRpc.DeleteFirewallPolicy(l.ctx, DeleteFirewallRuleReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&DeleteFirewallRuleResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &DeleteFirewallRuleResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteFlavorLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewDeleteFlavorLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteFlavorLogic {
|
||||
return &DeleteFlavorLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteFlavorLogic) DeleteFlavor(req *types.DeleteFlavorReq) (resp *types.DeleteFlavorResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
DeleteFlavorReq := &openstack.DeleteFlavorReq{}
|
||||
err = copier.CopyWithOption(DeleteFlavorReq, req, copier.Option{Converters: utils.Converters})
|
||||
DeleteFlavorResp, err := l.svcCtx.OpenstackRpc.DeleteFlavor(l.ctx, DeleteFlavorReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&DeleteFlavorResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &DeleteFlavorResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteFloatingIPLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewDeleteFloatingIPLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteFloatingIPLogic {
|
||||
return &DeleteFloatingIPLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteFloatingIPLogic) DeleteFloatingIP(req *types.DeleteFloatingIPReq) (resp *types.DeleteFloatingIPResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
DeleteFloatingIPReq := &openstack.DeleteFloatingIPReq{}
|
||||
err = copier.CopyWithOption(DeleteFloatingIPReq, req, copier.Option{Converters: utils.Converters})
|
||||
DeleteFloatingIPResp, err := l.svcCtx.OpenstackRpc.DeleteFloatingIP(l.ctx, DeleteFloatingIPReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&DeleteFloatingIPResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &DeleteFloatingIPResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteNetworkSegmentRangesLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewDeleteNetworkSegmentRangesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteNetworkSegmentRangesLogic {
|
||||
return &DeleteNetworkSegmentRangesLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteNetworkSegmentRangesLogic) DeleteNetworkSegmentRanges(req *types.DeleteNetworkSegmentRangesReq) (resp *types.DeleteNetworkSegmentRangesResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
DeleteNetworkSegmentRangesReq := &openstack.DeleteNetworkSegmentRangesReq{}
|
||||
err = copier.CopyWithOption(DeleteNetworkSegmentRangesReq, req, copier.Option{Converters: utils.Converters})
|
||||
DeleteNetworkSegmentRangesResp, err := l.svcCtx.OpenstackRpc.DeleteNetworkSegmentRanges(l.ctx, DeleteNetworkSegmentRangesReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&DeleteNetworkSegmentRangesResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &DeleteNetworkSegmentRangesResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeletePortLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewDeletePortLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeletePortLogic {
|
||||
return &DeletePortLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeletePortLogic) DeletePort(req *types.DeletePortReq) (resp *types.DeletePortResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
DeletePortReq := &openstack.DeletePortReq{}
|
||||
err = copier.CopyWithOption(DeletePortReq, req, copier.Option{Converters: utils.Converters})
|
||||
DeletePortResp, err := l.svcCtx.OpenstackRpc.DeletePort(l.ctx, DeletePortReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&DeletePortResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &DeletePortResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteRouterLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewDeleteRouterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteRouterLogic {
|
||||
return &DeleteRouterLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteRouterLogic) DeleteRouter(req *types.DeleteRouterReq) (resp *types.DeleteRouterResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
DeleteRouterReq := &openstack.DeleteRouterReq{}
|
||||
err = copier.CopyWithOption(DeleteRouterReq, req, copier.Option{Converters: utils.Converters})
|
||||
DeleteRouterResp, err := l.svcCtx.OpenstackRpc.DeleteRouter(l.ctx, DeleteRouterReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&DeleteRouterResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &DeleteRouterResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteSecurityGroupLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewDeleteSecurityGroupLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteSecurityGroupLogic {
|
||||
return &DeleteSecurityGroupLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteSecurityGroupLogic) DeleteSecurityGroup(req *types.DeleteSecurityGroupReq) (resp *types.DeleteSecurityGroupResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
DeleteSecurityGroupReq := &openstack.DeleteSecurityGroupReq{}
|
||||
err = copier.CopyWithOption(DeleteSecurityGroupReq, req, copier.Option{Converters: utils.Converters})
|
||||
DeleteSecurityGroupResp, err := l.svcCtx.OpenstackRpc.DeleteSecurityGroup(l.ctx, DeleteSecurityGroupReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&DeleteSecurityGroupResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &DeleteSecurityGroupResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteSecurityGroupRuleLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewDeleteSecurityGroupRuleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteSecurityGroupRuleLogic {
|
||||
return &DeleteSecurityGroupRuleLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteSecurityGroupRuleLogic) DeleteSecurityGroupRule(req *types.DeleteSecurityGroupRuleReq) (resp *types.DeleteSecurityGroupRuleResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
DeleteSecurityGroupRuleReq := &openstack.DeleteSecurityGroupRuleReq{}
|
||||
err = copier.CopyWithOption(DeleteSecurityGroupRuleReq, req, copier.Option{Converters: utils.Converters})
|
||||
DeleteSecurityGroupRuleResp, err := l.svcCtx.OpenstackRpc.DeleteSecurityGroupRule(l.ctx, DeleteSecurityGroupRuleReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&DeleteSecurityGroupRuleResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &DeleteSecurityGroupRuleResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteSubnetLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewDeleteSubnetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteSubnetLogic {
|
||||
return &DeleteSubnetLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteSubnetLogic) DeleteSubnet(req *types.DeleteSubnetReq) (resp *types.DeleteSubnetResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
DeleteSubnetReq := &openstack.DeleteSubnetReq{}
|
||||
err = copier.CopyWithOption(DeleteSubnetReq, req, copier.Option{Converters: utils.Converters})
|
||||
DeleteSubnetResp, err := l.svcCtx.OpenstackRpc.DeleteSubnet(l.ctx, DeleteSubnetReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&DeleteSubnetResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &DeleteSubnetResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListFirewallGroupsLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewListFirewallGroupsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListFirewallGroupsLogic {
|
||||
return &ListFirewallGroupsLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListFirewallGroupsLogic) ListFirewallGroups(req *types.ListFirewallGroupsReq) (resp *types.ListFirewallGroupsResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
ListFirewallGroupsReq := &openstack.ListFirewallGroupsReq{}
|
||||
err = copier.CopyWithOption(ListFirewallGroupsReq, req, copier.Option{Converters: utils.Converters})
|
||||
ListFirewallGroupsResp, err := l.svcCtx.OpenstackRpc.ListFirewallGroups(l.ctx, ListFirewallGroupsReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&ListFirewallGroupsResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &ListFirewallGroupsResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListFirewallPoliciesLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewListFirewallPoliciesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListFirewallPoliciesLogic {
|
||||
return &ListFirewallPoliciesLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListFirewallPoliciesLogic) ListFirewallPolicies(req *types.ListFirewallPoliciesReq) (resp *types.ListFirewallPoliciesResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
ListFirewallPoliciesReq := &openstack.ListFirewallPoliciesReq{}
|
||||
err = copier.CopyWithOption(ListFirewallPoliciesReq, req, copier.Option{Converters: utils.Converters})
|
||||
ListFirewallPoliciesResp, err := l.svcCtx.OpenstackRpc.ListFirewallPolicies(l.ctx, ListFirewallPoliciesReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&ListFirewallPoliciesResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &ListFirewallPoliciesResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListFirewallRulesLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewListFirewallRulesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListFirewallRulesLogic {
|
||||
return &ListFirewallRulesLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListFirewallRulesLogic) ListFirewallRules(req *types.ListFirewallRulesReq) (resp *types.ListFirewallRulesResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
ListFirewallRulesReq := &openstack.ListFirewallRulesReq{}
|
||||
err = copier.CopyWithOption(ListFirewallRulesReq, req, copier.Option{Converters: utils.Converters})
|
||||
ListFirewallRulesResp, err := l.svcCtx.OpenstackRpc.ListFirewallRules(l.ctx, ListFirewallRulesReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&ListFirewallRulesResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &ListFirewallRulesResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListFloatingIPsLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewListFloatingIPsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListFloatingIPsLogic {
|
||||
return &ListFloatingIPsLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListFloatingIPsLogic) ListFloatingIPs(req *types.ListFloatingIPsReq) (resp *types.ListFloatingIPsResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
ListFloatingIPsReq := &openstack.ListFloatingIPsReq{}
|
||||
err = copier.CopyWithOption(ListFloatingIPsReq, req, copier.Option{Converters: utils.Converters})
|
||||
ListFloatingIPsResp, err := l.svcCtx.OpenstackRpc.ListFloatingIPs(l.ctx, ListFloatingIPsReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&ListFloatingIPsResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &ListFloatingIPsResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListNetworkSegmentRangesRangeLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewListNetworkSegmentRangesRangeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListNetworkSegmentRangesRangeLogic {
|
||||
return &ListNetworkSegmentRangesRangeLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListNetworkSegmentRangesRangeLogic) ListNetworkSegmentRangesRange(req *types.ListNetworkSegmentRangesReq) (resp *types.ListNetworkSegmentRangesResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
ListNetworkSegmentRangesReq := &openstack.ListNetworkSegmentRangesReq{}
|
||||
err = copier.CopyWithOption(ListNetworkSegmentRangesReq, req, copier.Option{Converters: utils.Converters})
|
||||
ListNetworkSegmentRangesResp, err := l.svcCtx.OpenstackRpc.ListNetworkSegmentRanges(l.ctx, ListNetworkSegmentRangesReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&ListNetworkSegmentRangesResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &ListNetworkSegmentRangesResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListPortsLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewListPortsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListPortsLogic {
|
||||
return &ListPortsLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListPortsLogic) ListPorts(req *types.ListPortsReq) (resp *types.ListPortsResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
ListPortsReq := &openstack.ListPortsReq{}
|
||||
err = copier.CopyWithOption(ListPortsReq, req, copier.Option{Converters: utils.Converters})
|
||||
ListPortsResp, err := l.svcCtx.OpenstackRpc.ListPorts(l.ctx, ListPortsReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&ListPortsResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &ListPortsResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListRoutersLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewListRoutersLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListRoutersLogic {
|
||||
return &ListRoutersLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListRoutersLogic) ListRouters(req *types.ListRoutersReq) (resp *types.ListRoutersResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
ListRoutersReq := &openstack.ListRoutersReq{}
|
||||
err = copier.CopyWithOption(ListRoutersReq, req, copier.Option{Converters: utils.Converters})
|
||||
ListRoutersResp, err := l.svcCtx.OpenstackRpc.ListRouters(l.ctx, ListRoutersReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&ListRoutersResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &ListRoutersResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListSecurityGroupRulesLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewListSecurityGroupRulesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListSecurityGroupRulesLogic {
|
||||
return &ListSecurityGroupRulesLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListSecurityGroupRulesLogic) ListSecurityGroupRules(req *types.ListSecurityGroupRulesReq) (resp *types.ListSecurityGroupRulesResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
ListSecurityGroupRulesReq := &openstack.ListSecurityGroupRulesReq{}
|
||||
err = copier.CopyWithOption(ListSecurityGroupRulesReq, req, copier.Option{Converters: utils.Converters})
|
||||
ListSecurityGroupRulesResp, err := l.svcCtx.OpenstackRpc.ListSecurityGroupRules(l.ctx, ListSecurityGroupRulesReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&ListSecurityGroupRulesResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &ListSecurityGroupRulesResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListSecurityGroupsLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewListSecurityGroupsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListSecurityGroupsLogic {
|
||||
return &ListSecurityGroupsLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListSecurityGroupsLogic) ListSecurityGroups(req *types.ListSecurityGroupsReq) (resp *types.ListSecurityGroupsResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
ListSecurityGroupsReq := &openstack.ListSecurityGroupsReq{}
|
||||
err = copier.CopyWithOption(ListSecurityGroupsReq, req, copier.Option{Converters: utils.Converters})
|
||||
ListSecurityGroupsResp, err := l.svcCtx.OpenstackRpc.ListSecurityGroups(l.ctx, ListSecurityGroupsReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&ListSecurityGroupsResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &ListSecurityGroupsResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListSubnetsLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewListSubnetsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListSubnetsLogic {
|
||||
return &ListSubnetsLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListSubnetsLogic) ListSubnets(req *types.ListSubnetsReq) (resp *types.ListSubnetsResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
ListSubnetsReq := &openstack.ListSubnetsReq{}
|
||||
err = copier.CopyWithOption(ListSubnetsReq, req, copier.Option{Converters: utils.Converters})
|
||||
ListSubnetsResp, err := l.svcCtx.OpenstackRpc.ListSubnets(l.ctx, ListSubnetsReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&ListSubnetsResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &ListSubnetsResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type MigrateServerLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewMigrateServerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MigrateServerLogic {
|
||||
return &MigrateServerLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *MigrateServerLogic) MigrateServer(req *types.MigrateServerReq) (resp *types.MigrateServerResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
MigrateServerReq := &openstack.MigrateServerReq{}
|
||||
err = copier.CopyWithOption(MigrateServerReq, req, copier.Option{Converters: utils.Converters})
|
||||
MigrateServerResp, err := l.svcCtx.OpenstackRpc.MigrateServer(l.ctx, MigrateServerReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&MigrateServerResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &MigrateServerResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type RemoveSecurityGroupLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewRemoveSecurityGroupLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RemoveSecurityGroupLogic {
|
||||
return &RemoveSecurityGroupLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *RemoveSecurityGroupLogic) RemoveSecurityGroup(req *types.RemoveSecurityGroupReq) (resp *types.RemoveSecurityGroupResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
CreateImageReq := &openstack.CreateImageReq{}
|
||||
err = copier.CopyWithOption(CreateImageReq, req, copier.Option{Converters: utils.Converters})
|
||||
CreateImageResp, err := l.svcCtx.OpenstackRpc.CreateImage(l.ctx, CreateImageReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&CreateImageResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &CreateImageResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type RescueServerLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewRescueServerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RescueServerLogic {
|
||||
return &RescueServerLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *RescueServerLogic) RescueServer(req *types.RescueServerReq) (resp *types.RescueServerResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
RescueServerReq := &openstack.RescueServerReq{}
|
||||
err = copier.CopyWithOption(RescueServerReq, req, copier.Option{Converters: utils.Converters})
|
||||
RescueServerResp, err := l.svcCtx.OpenstackRpc.RescueServer(l.ctx, RescueServerReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&RescueServerResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &RescueServerResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ResizeServerLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewResizeServerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ResizeServerLogic {
|
||||
return &ResizeServerLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ResizeServerLogic) ResizeServer(req *types.ResizeServerReq) (resp *types.ResizeServerResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
ResizeServerReq := &openstack.ResizeServerReq{}
|
||||
err = copier.CopyWithOption(ResizeServerReq, req, copier.Option{Converters: utils.Converters})
|
||||
ResizeServerResp, err := l.svcCtx.OpenstackRpc.ResizeServer(l.ctx, ResizeServerReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&ResizeServerResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &ResizeServerResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ShelveServerLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewShelveServerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShelveServerLogic {
|
||||
return &ShelveServerLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ShelveServerLogic) ShelveServer(req *types.ShelveServerReq) (resp *types.ShelveServerResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
ShelveServerReq := &openstack.ShelveServerReq{}
|
||||
err = copier.CopyWithOption(ShelveServerReq, req, copier.Option{Converters: utils.Converters})
|
||||
ShelveServerResp, err := l.svcCtx.OpenstackRpc.ShelveServer(l.ctx, ShelveServerReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&ShelveServerResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &ShelveServerResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ShowFirewallGroupDetailsLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewShowFirewallGroupDetailsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShowFirewallGroupDetailsLogic {
|
||||
return &ShowFirewallGroupDetailsLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ShowFirewallGroupDetailsLogic) ShowFirewallGroupDetails(req *types.ShowFirewallGroupDetailsReq) (resp *types.ShowFirewallGroupDetailsResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
ShowFirewallGroupDetailsReq := &openstack.ShowFirewallGroupDetailsReq{}
|
||||
err = copier.CopyWithOption(ShowFirewallGroupDetailsReq, req, copier.Option{Converters: utils.Converters})
|
||||
ShowFirewallGroupDetailsResp, err := l.svcCtx.OpenstackRpc.ShowFirewallGroupDetails(l.ctx, ShowFirewallGroupDetailsReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&ShowFirewallGroupDetailsResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &ShowFirewallGroupDetailsResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ShowFirewallPolicyDetailsLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewShowFirewallPolicyDetailsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShowFirewallPolicyDetailsLogic {
|
||||
return &ShowFirewallPolicyDetailsLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ShowFirewallPolicyDetailsLogic) ShowFirewallPolicyDetails(req *types.ShowFirewallPolicyDetailsReq) (resp *types.ShowFirewallPolicyDetailsResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
ShowFirewallPolicyDetailsReq := &openstack.ShowFirewallPolicyDetailsReq{}
|
||||
err = copier.CopyWithOption(ShowFirewallPolicyDetailsReq, req, copier.Option{Converters: utils.Converters})
|
||||
ShowFirewallPolicyDetailsResp, err := l.svcCtx.OpenstackRpc.ShowFirewallPolicyDetails(l.ctx, ShowFirewallPolicyDetailsReq)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req)
|
||||
}
|
||||
marshal, err := json.Marshal(&ShowFirewallPolicyDetailsResp)
|
||||
if err != nil {
|
||||
return nil, result.NewDefaultError(err.Error())
|
||||
}
|
||||
json.Unmarshal(marshal, &resp)
|
||||
err = copier.CopyWithOption(&resp, &ShowFirewallPolicyDetailsResp, copier.Option{Converters: utils.Converters})
|
||||
return resp, err
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue