forked from JointCloud/pcm-openstack
openstack 基本完成openstack网络部分接口代码,包括安全组/浮动ip/端口/子网/路由/防火墙等
This commit is contained in:
parent
5b98067168
commit
9a69ae0a12
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,29 @@ func NewCreateFirewallGroupLogic(ctx context.Context, svcCtx *svc.ServiceContext
|
|||
func (l *CreateFirewallGroupLogic) CreateFirewallGroup(in *openstack.CreateFirewallGroupReq) (*openstack.CreateFirewallGroupResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.CreateFirewallGroupResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
reqByte, err := json.Marshal(in)
|
||||
token := common.GetToken()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/v2.0/fwaas/firewall_groups", payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 202 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 202 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,29 @@ func NewCreateFirewallPolicyLogic(ctx context.Context, svcCtx *svc.ServiceContex
|
|||
func (l *CreateFirewallPolicyLogic) CreateFirewallPolicy(in *openstack.CreateFirewallPolicyReq) (*openstack.CreateFirewallPolicyResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.CreateFirewallPolicyResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
reqByte, err := json.Marshal(in)
|
||||
token := common.GetToken()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/v2.0/fwaas/firewall_policies", payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 202 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 202 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,29 @@ func NewCreateFirewallRuleLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
|||
func (l *CreateFirewallRuleLogic) CreateFirewallRule(in *openstack.CreateFirewallRuleReq) (*openstack.CreateFirewallRuleResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.CreateFirewallRuleResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
reqByte, err := json.Marshal(in)
|
||||
token := common.GetToken()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/v2.0/fwaas/firewall_rules", payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 202 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 202 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,29 @@ func NewCreateFloatingIPLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
|
|||
func (l *CreateFloatingIPLogic) CreateFloatingIP(in *openstack.CreateFloatingIPReq) (*openstack.CreateFloatingIPResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.CreateFloatingIPResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
reqByte, err := json.Marshal(in)
|
||||
token := common.GetToken()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/v2.0/floatingips", payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 202 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 202 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -27,6 +32,29 @@ func NewCreateNetworkSegmentRangeLogic(ctx context.Context, svcCtx *svc.ServiceC
|
|||
func (l *CreateNetworkSegmentRangeLogic) CreateNetworkSegmentRange(in *openstack.CreateNetworkSegmentRangeReq) (*openstack.CreateNetworkSegmentRangeResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.CreateNetworkSegmentRangeResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
reqByte, err := json.Marshal(in)
|
||||
token := common.GetToken()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/v2.0/network_segment_ranges", payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 202 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 202 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -27,6 +32,29 @@ func NewCreatePortLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Create
|
|||
func (l *CreatePortLogic) CreatePort(in *openstack.CreatePortReq) (*openstack.CreatePortResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.CreatePortResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
reqByte, err := json.Marshal(in)
|
||||
token := common.GetToken()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/v2.0/ports", payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 202 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 202 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -27,6 +32,29 @@ func NewCreateRouterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Crea
|
|||
func (l *CreateRouterLogic) CreateRouter(in *openstack.CreateRouterReq) (*openstack.CreateRouterResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.CreateRouterResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
reqByte, err := json.Marshal(in)
|
||||
token := common.GetToken()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/v2.0/routers", payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 202 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 202 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,30 @@ func NewCreateSecurityGroupLogic(ctx context.Context, svcCtx *svc.ServiceContext
|
|||
func (l *CreateSecurityGroupLogic) CreateSecurityGroup(in *openstack.CreateSecurityGroupReq) (*openstack.CreateSecurityGroupResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.CreateSecurityGroupResp
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
reqByte, err := json.Marshal(in)
|
||||
token := common.GetToken()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/v2.0/security-groups", payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 202 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 202 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,29 @@ func NewCreateSecurityGroupRuleLogic(ctx context.Context, svcCtx *svc.ServiceCon
|
|||
func (l *CreateSecurityGroupRuleLogic) CreateSecurityGroupRule(in *openstack.CreateSecurityGroupRuleReq) (*openstack.CreateSecurityGroupRuleResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.CreateSecurityGroupRuleResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
reqByte, err := json.Marshal(in)
|
||||
token := common.GetToken()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/v2.0/security-group-rules", payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 202 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 202 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ func (l *CreateSubnetLogic) CreateSubnet(in *openstack.CreateSubnetReq) (*openst
|
|||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
//openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/v2.0/subnets", payload, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,24 @@ func NewDeleteFirewallGroupLogic(ctx context.Context, svcCtx *svc.ServiceContext
|
|||
func (l *DeleteFirewallGroupLogic) DeleteFirewallGroup(in *openstack.DeleteFirewallGroupReq) (*openstack.DeleteFirewallGroupResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.DeleteFirewallGroupResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, openstackUrl+"/v2.0/fwaas/firewall_groups/"+in.FirewallGroupId, strings.NewReader(``), token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 204 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 204 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,24 @@ func NewDeleteFirewallPolicyLogic(ctx context.Context, svcCtx *svc.ServiceContex
|
|||
func (l *DeleteFirewallPolicyLogic) DeleteFirewallPolicy(in *openstack.DeleteFirewallPolicyReq) (*openstack.DeleteFirewallPolicyResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.DeleteFirewallPolicyResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, openstackUrl+"/v2.0/fwaas/firewall_policies/"+in.FirewallPolicyId, strings.NewReader(``), token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 204 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 204 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,24 @@ func NewDeleteFirewallRuleLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
|||
func (l *DeleteFirewallRuleLogic) DeleteFirewallRule(in *openstack.DeleteFirewallRuleReq) (*openstack.DeleteFirewallRuleResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.DeleteFirewallRuleResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, openstackUrl+"/v2.0/fwaas/firewall_rules/"+in.FirewallRuleId, strings.NewReader(``), token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 204 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 204 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,24 @@ func NewDeleteFloatingIPLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
|
|||
func (l *DeleteFloatingIPLogic) DeleteFloatingIP(in *openstack.DeleteFloatingIPReq) (*openstack.DeleteFloatingIPResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.DeleteFloatingIPResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, openstackUrl+"/v2.0/floatingips/"+in.FloatingipId, strings.NewReader(``), token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 204 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 204 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,24 @@ func NewDeleteNetworkSegmentRangesLogic(ctx context.Context, svcCtx *svc.Service
|
|||
func (l *DeleteNetworkSegmentRangesLogic) DeleteNetworkSegmentRanges(in *openstack.DeleteNetworkSegmentRangesReq) (*openstack.DeleteNetworkSegmentRangesResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.DeleteNetworkSegmentRangesResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, openstackUrl+"/v2.0/network_segment_ranges/"+in.NetworkSegmentRangeId, strings.NewReader(``), token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 204 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 204 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,24 @@ func NewDeletePortLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delete
|
|||
func (l *DeletePortLogic) DeletePort(in *openstack.DeletePortReq) (*openstack.DeletePortResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.DeletePortResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, openstackUrl+"/v2.0/ports/"+in.PortId, strings.NewReader(``), token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 204 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 204 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,24 @@ func NewDeleteRouterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Dele
|
|||
func (l *DeleteRouterLogic) DeleteRouter(in *openstack.DeleteRouterReq) (*openstack.DeleteRouterResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.DeleteRouterResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, openstackUrl+"/v2.0/routers/"+in.RouterId, strings.NewReader(``), token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 204 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 204 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,24 @@ func NewDeleteSecurityGroupLogic(ctx context.Context, svcCtx *svc.ServiceContext
|
|||
func (l *DeleteSecurityGroupLogic) DeleteSecurityGroup(in *openstack.DeleteSecurityGroupReq) (*openstack.DeleteSecurityGroupResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.DeleteSecurityGroupResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, openstackUrl+"/v2.0/security-groups/"+in.SecurityGroupId, strings.NewReader(``), token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 204 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 204 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,24 @@ func NewDeleteSecurityGroupRuleLogic(ctx context.Context, svcCtx *svc.ServiceCon
|
|||
func (l *DeleteSecurityGroupRuleLogic) DeleteSecurityGroupRule(in *openstack.DeleteSecurityGroupRuleReq) (*openstack.DeleteSecurityGroupRuleResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.DeleteSecurityGroupRuleResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, openstackUrl+"/v2.0/security-groups/"+in.SecurityGroupRuleId, strings.NewReader(``), token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 204 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 204 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,25 @@ func NewDeleteSubnetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Dele
|
|||
func (l *DeleteSubnetLogic) DeleteSubnet(in *openstack.DeleteSubnetReq) (*openstack.DeleteSubnetResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.DeleteSubnetResp
|
||||
|
||||
//openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, openstackUrl+"/v2.0/subnets/"+in.SubnetId, strings.NewReader(``), token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 204 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 204 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -27,6 +31,25 @@ func NewListFirewallGroupsLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
|||
func (l *ListFirewallGroupsLogic) ListFirewallGroups(in *openstack.ListFirewallGroupsReq) (*openstack.ListFirewallGroupsResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListFirewallGroupsResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/fwaas/firewall_groups", nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +30,25 @@ func NewListFirewallPoliciesLogic(ctx context.Context, svcCtx *svc.ServiceContex
|
|||
func (l *ListFirewallPoliciesLogic) ListFirewallPolicies(in *openstack.ListFirewallPoliciesReq) (*openstack.ListFirewallPoliciesResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListFirewallPoliciesResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/fwaas/firewall_policies", nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +30,25 @@ func NewListFirewallRulesLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
|||
func (l *ListFirewallRulesLogic) ListFirewallRules(in *openstack.ListFirewallRulesReq) (*openstack.ListFirewallRulesResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListFirewallRulesResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/fwaas/firewall_rules", nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -27,6 +31,25 @@ func NewListFloatingIPsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *L
|
|||
func (l *ListFloatingIPsLogic) ListFloatingIPs(in *openstack.ListFloatingIPsReq) (*openstack.ListFloatingIPsResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListFloatingIPsResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/floatingips", nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +30,24 @@ func NewListNetworkSegmentRangesLogic(ctx context.Context, svcCtx *svc.ServiceCo
|
|||
func (l *ListNetworkSegmentRangesLogic) ListNetworkSegmentRanges(in *openstack.ListNetworkSegmentRangesReq) (*openstack.ListNetworkSegmentRangesResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListNetworkSegmentRangesResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/network_segment_ranges", nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +30,24 @@ func NewListPortsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListPor
|
|||
func (l *ListPortsLogic) ListPorts(in *openstack.ListPortsReq) (*openstack.ListPortsResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListPortsResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/ports", nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +30,24 @@ func NewListRoutersLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListR
|
|||
func (l *ListRoutersLogic) ListRouters(in *openstack.ListRoutersReq) (*openstack.ListRoutersResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListRoutersResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/routers", nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -27,6 +31,25 @@ func NewListSecurityGroupRulesLogic(ctx context.Context, svcCtx *svc.ServiceCont
|
|||
func (l *ListSecurityGroupRulesLogic) ListSecurityGroupRules(in *openstack.ListSecurityGroupRulesReq) (*openstack.ListSecurityGroupRulesResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListSecurityGroupRulesResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/security-group-rules", nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -27,6 +31,25 @@ func NewListSecurityGroupsLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
|||
func (l *ListSecurityGroupsLogic) ListSecurityGroups(in *openstack.ListSecurityGroupsReq) (*openstack.ListSecurityGroupsResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListSecurityGroupsResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/security-groups", nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +30,24 @@ func NewListSubnetsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListS
|
|||
func (l *ListSubnetsLogic) ListSubnets(in *openstack.ListSubnetsReq) (*openstack.ListSubnetsResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListSubnetsResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/subnets", nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,33 @@ func NewMigrateServerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Mig
|
|||
func (l *MigrateServerLogic) MigrateServer(in *openstack.MigrateServerReq) (*openstack.MigrateServerResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.MigrateServerResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackComputeUrl
|
||||
in.Action = map[string]string{
|
||||
in.MigrateAction: "",
|
||||
}
|
||||
reqByte, err := json.Marshal(in.Action)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/servers/"+in.ServerId+"/action", payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +30,25 @@ func NewShowFirewallGroupDetailsLogic(ctx context.Context, svcCtx *svc.ServiceCo
|
|||
func (l *ShowFirewallGroupDetailsLogic) ShowFirewallGroupDetails(in *openstack.ShowFirewallGroupDetailsReq) (*openstack.ShowFirewallGroupDetailsResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ShowFirewallGroupDetailsResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/fwaas/firewall_groups/"+in.FirewallGroupId, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +30,25 @@ func NewShowFirewallPolicyDetailsLogic(ctx context.Context, svcCtx *svc.ServiceC
|
|||
func (l *ShowFirewallPolicyDetailsLogic) ShowFirewallPolicyDetails(in *openstack.ShowFirewallPolicyDetailsReq) (*openstack.ShowFirewallPolicyDetailsResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ShowFirewallPolicyDetailsResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/fwaas/firewall_policies/"+in.FirewallPolicyId, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +30,25 @@ func NewShowFirewallRuleDetailsLogic(ctx context.Context, svcCtx *svc.ServiceCon
|
|||
func (l *ShowFirewallRuleDetailsLogic) ShowFirewallRuleDetails(in *openstack.ShowFirewallRuleDetailsReq) (*openstack.ShowFirewallRuleDetailsResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ShowFirewallRuleDetailsResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/fwaas/firewall_rules/"+in.FirewallRuleId, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +30,25 @@ func NewShowFloatingIPDetailsLogic(ctx context.Context, svcCtx *svc.ServiceConte
|
|||
func (l *ShowFloatingIPDetailsLogic) ShowFloatingIPDetails(in *openstack.ShowFloatingIPDetailsReq) (*openstack.ShowFloatingIPDetailsResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ShowFloatingIPDetailsResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/floatingips/"+in.FloatingipId, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,25 @@ func NewShowNetworkSegmentRangeDetailsLogic(ctx context.Context, svcCtx *svc.Ser
|
|||
func (l *ShowNetworkSegmentRangeDetailsLogic) ShowNetworkSegmentRangeDetails(in *openstack.ShowNetworkSegmentRangeDetailsReq) (*openstack.ShowNetworkSegmentRangeDetailsResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ShowNetworkSegmentRangeDetailsResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/network_segment_ranges/"+in.NetworkSegmentRangeId, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +30,25 @@ func NewShowPortDetailsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *S
|
|||
func (l *ShowPortDetailsLogic) ShowPortDetails(in *openstack.ShowPortDetailsReq) (*openstack.ShowPortDetailsResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ShowPortDetailsResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/ports/"+in.PortId, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +30,25 @@ func NewShowRouterDetailsLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
|||
func (l *ShowRouterDetailsLogic) ShowRouterDetails(in *openstack.ShowRouterDetailsReq) (*openstack.ShowRouterDetailsResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ShowRouterDetailsResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/routers"+in.RouterId, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +30,25 @@ func NewShowSecurityGroupLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
|||
func (l *ShowSecurityGroupLogic) ShowSecurityGroup(in *openstack.ShowSecurityGroupReq) (*openstack.ShowSecurityGroupResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ShowSecurityGroupResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/security-groups/"+in.SecurityGroupId, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +30,25 @@ func NewShowSecurityGroupRuleLogic(ctx context.Context, svcCtx *svc.ServiceConte
|
|||
func (l *ShowSecurityGroupRuleLogic) ShowSecurityGroupRule(in *openstack.ShowSecurityGroupRuleReq) (*openstack.ShowSecurityGroupRuleResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ShowSecurityGroupRuleResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/security-group-rules/"+in.SecurityGroupRuleId, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,30 @@ func NewUpdateFirewallGroupLogic(ctx context.Context, svcCtx *svc.ServiceContext
|
|||
func (l *UpdateFirewallGroupLogic) UpdateFirewallGroup(in *openstack.UpdateFirewallGroupReq) (*openstack.UpdateFirewallGroupResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.UpdateFirewallGroupResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.PUT, openstackUrl+"/v2.0/fwaas/firewall_groups/"+in.FirewallGroupId, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,30 @@ func NewUpdateFloatingIPLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
|
|||
func (l *UpdateFloatingIPLogic) UpdateFloatingIP(in *openstack.UpdateFloatingIPReq) (*openstack.UpdateFloatingIPResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.UpdateFloatingIPResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.PUT, openstackUrl+"/v2.0/floatingips/"+in.FloatingipId, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,30 @@ func NewUpdateNetworkSegmentRangesLogic(ctx context.Context, svcCtx *svc.Service
|
|||
func (l *UpdateNetworkSegmentRangesLogic) UpdateNetworkSegmentRanges(in *openstack.UpdateNetworkSegmentRangesReq) (*openstack.UpdateNetworkSegmentRangesResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.UpdateNetworkSegmentRangesResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.PUT, openstackUrl+"/v2.0/network_segment_ranges/"+in.NetworkSegmentRangeId, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,30 @@ func NewUpdatePortLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Update
|
|||
func (l *UpdatePortLogic) UpdatePort(in *openstack.UpdatePortReq) (*openstack.UpdatePortResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.UpdatePortResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.PUT, openstackUrl+"/v2.0/ports/"+in.PortId, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,30 @@ func NewUpdateRouterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Upda
|
|||
func (l *UpdateRouterLogic) UpdateRouter(in *openstack.UpdateRouterReq) (*openstack.UpdateRouterResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.UpdateRouterResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.PUT, openstackUrl+"/v2.0/routers/"+in.RouterId, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,30 @@ func NewUpdateSecurityGroupLogic(ctx context.Context, svcCtx *svc.ServiceContext
|
|||
func (l *UpdateSecurityGroupLogic) UpdateSecurityGroup(in *openstack.UpdateSecurityGroupReq) (*openstack.UpdateSecurityGroupResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.UpdateSecurityGroupResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
// openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.PUT, openstackUrl+"/v2.0/security-groups/"+in.SecurityGroupId, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@ package logic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
|
@ -26,6 +31,29 @@ func NewUpdateSubnetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Upda
|
|||
func (l *UpdateSubnetLogic) UpdateSubnet(in *openstack.UpdateSubnetReq) (*openstack.UpdateSubnetResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.UpdateSubnetResp
|
||||
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
openstackUrl := platform.OpenstackNetworkUrl
|
||||
reqByte, err := json.Marshal(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.PUT, openstackUrl+"/v2.0/subnets/"+in.SubnetId, payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode == 200 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
resp.Code = 200
|
||||
resp.Msg = "Success"
|
||||
} else if statusCode != 200 {
|
||||
json.Unmarshal(body, &resp)
|
||||
resp.Code = 400
|
||||
resp.Msg = "Failure"
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1424,6 +1424,9 @@ message ListSubnetsResp {
|
|||
int64 updated_at = 23;
|
||||
}
|
||||
repeated Subnets subnets = 1;
|
||||
string msg =2; // @gotags: copier:"Msg"
|
||||
int32 code =3; // @gotags: copier:"Code"
|
||||
string error_msg =4;// @gotags: copier:"ErrorMsg"
|
||||
}
|
||||
|
||||
message DeleteSubnetReq{
|
||||
|
@ -1439,6 +1442,7 @@ message DeleteSubnetResp{
|
|||
|
||||
message UpdateSubnetReq{
|
||||
string subnet_id = 1; // @gotags: copier:"subnet_id"
|
||||
string platform = 2;
|
||||
}
|
||||
|
||||
message UpdateSubnetResp{
|
||||
|
@ -1489,6 +1493,7 @@ message CreateNetworkSegmentRangeReq{
|
|||
}
|
||||
|
||||
Network_segment_range network_segment_range = 1;
|
||||
string platform = 2;
|
||||
}
|
||||
|
||||
message CreateNetworkSegmentRangeResp{
|
||||
|
@ -1572,6 +1577,7 @@ message DeleteNetworkSegmentRangesResp{
|
|||
message UpdateNetworkSegmentRangesReq{
|
||||
string network_segment_range_id = 1; // @gotags: copier:"subnet_id"
|
||||
Network_segment_ranges network_segment_ranges = 2;
|
||||
string platform = 3;
|
||||
message Network_segment_ranges {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
|
@ -1622,6 +1628,9 @@ message UpdateNetworkSegmentRangesResp{
|
|||
}
|
||||
|
||||
Network_segment_range network_segment_range = 1;
|
||||
string msg =2; // @gotags: copier:"Msg"
|
||||
int32 code =3; // @gotags: copier:"Code"
|
||||
string error_msg =4;// @gotags: copier:"ErrorMsg"
|
||||
}
|
||||
|
||||
message ShowNetworkSegmentRangeDetailsReq{
|
||||
|
@ -1740,6 +1749,9 @@ message ShowNetworkSegmentRangeDetailsResp{
|
|||
}
|
||||
|
||||
Port port = 1;
|
||||
string msg =2; // @gotags: copier:"Msg"
|
||||
int32 code =3; // @gotags: copier:"Code"
|
||||
string error_msg =4;// @gotags: copier:"ErrorMsg"
|
||||
}
|
||||
message ListPortsReq{
|
||||
int32 limit = 1; // @gotags: copier:"Limit"
|
||||
|
@ -1803,6 +1815,9 @@ message ListPortsResp{
|
|||
}
|
||||
|
||||
repeated Ports ports = 1;
|
||||
string msg =2; // @gotags: copier:"Msg"
|
||||
int32 code =3; // @gotags: copier:"Code"
|
||||
string error_msg =4;// @gotags: copier:"ErrorMsg"
|
||||
}
|
||||
|
||||
message DeletePortReq{
|
||||
|
@ -1939,6 +1954,9 @@ message UpdatePortResp {
|
|||
}
|
||||
|
||||
Port port = 1;
|
||||
string msg =2; // @gotags: copier:"Msg"
|
||||
int32 code =3; // @gotags: copier:"Code"
|
||||
string error_msg =4;// @gotags: copier:"ErrorMsg"
|
||||
}
|
||||
|
||||
message ShowPortDetailsReq {
|
||||
|
@ -2004,6 +2022,9 @@ message ShowPortDetailsResp {
|
|||
string hardware_offload_type = 29;
|
||||
}
|
||||
Port port = 1;
|
||||
string msg =2; // @gotags: copier:"Msg"
|
||||
int32 code =3; // @gotags: copier:"Code"
|
||||
string error_msg =4;// @gotags: copier:"ErrorMsg"
|
||||
}
|
||||
|
||||
//port
|
||||
|
@ -2087,6 +2108,7 @@ message CreateRouterReq{
|
|||
}
|
||||
|
||||
Router router = 1;
|
||||
string platform = 2;
|
||||
}
|
||||
|
||||
message CreateRouterResp{
|
||||
|
@ -2182,6 +2204,7 @@ message UpdateRouterReq{
|
|||
}
|
||||
string platform = 2;
|
||||
Router router = 1;
|
||||
string router_id =3;
|
||||
}
|
||||
|
||||
message UpdateRouterResp{
|
||||
|
@ -2451,6 +2474,8 @@ message DeleteRouterResp{
|
|||
}
|
||||
|
||||
Floatingip floatingip = 1;
|
||||
string platform = 2;
|
||||
string floatingip_id =3;
|
||||
}
|
||||
message UpdateFloatingIPResp{
|
||||
message Port_details {
|
||||
|
@ -2564,6 +2589,7 @@ message DeleteRouterResp{
|
|||
//防火墙
|
||||
message ListFirewallGroupsReq{
|
||||
string fields =1;
|
||||
string platform = 2;
|
||||
}
|
||||
message ListFirewallGroupsResp{
|
||||
message Firewall_groups {
|
||||
|
@ -2604,6 +2630,7 @@ message DeleteRouterResp{
|
|||
}
|
||||
|
||||
Firewall_group firewall_group = 1;
|
||||
string platform = 2;
|
||||
}
|
||||
|
||||
message CreateFirewallGroupResp{
|
||||
|
@ -2633,6 +2660,9 @@ message UpdateFirewallGroupReq{
|
|||
}
|
||||
|
||||
Firewall_group firewall_group = 1;
|
||||
string platform = 2;
|
||||
string firewall_group_id =3;
|
||||
|
||||
}
|
||||
|
||||
message UpdateFirewallGroupResp{
|
||||
|
@ -2676,7 +2706,9 @@ message ShowFirewallGroupDetailsResp{
|
|||
}
|
||||
|
||||
Firewall_group firewall_group = 1;
|
||||
string platform =2;
|
||||
string msg =2; // @gotags: copier:"Msg"
|
||||
int32 code =3; // @gotags: copier:"Code"
|
||||
string error_msg =4;// @gotags: copier:"ErrorMsg"
|
||||
}
|
||||
|
||||
//安全组策略
|
||||
|
@ -2687,6 +2719,7 @@ message CreateFirewallPolicyReq{
|
|||
}
|
||||
|
||||
Firewall_policy firewall_policy = 1;
|
||||
string platform =2;
|
||||
}
|
||||
|
||||
message CreateFirewallPolicyResp{
|
||||
|
@ -2832,6 +2865,9 @@ message ListFirewallRulesResp{
|
|||
}
|
||||
|
||||
repeated Firewall_rules firewall_rules = 1;
|
||||
string msg =2; // @gotags: copier:"Msg"
|
||||
int32 code =3; // @gotags: copier:"Code"
|
||||
string error_msg =4;// @gotags: copier:"ErrorMsg"
|
||||
}
|
||||
message ShowFirewallRuleDetailsReq{
|
||||
string firewall_rule_id=1;
|
||||
|
@ -2920,6 +2956,7 @@ message CreateSecurityGroupReq{
|
|||
}
|
||||
|
||||
Security_group security_group = 1;
|
||||
string platform =2;
|
||||
}
|
||||
|
||||
message CreateSecurityGroupResp{
|
||||
|
@ -3026,6 +3063,7 @@ message ShowSecurityGroupReq{
|
|||
string security_group_id =1;
|
||||
bool verbose =2;
|
||||
string fields =3;
|
||||
string platform =4;
|
||||
}
|
||||
message ShowSecurityGroupResp{
|
||||
message Security_group_rules {
|
||||
|
@ -3137,6 +3175,9 @@ message CreateSecurityGroupRuleResp{
|
|||
}
|
||||
|
||||
Security_group_rule security_group_rule = 1;
|
||||
string msg =2; // @gotags: copier:"Msg"
|
||||
int32 code =3; // @gotags: copier:"Code"
|
||||
string error_msg =4;// @gotags: copier:"ErrorMsg"
|
||||
}
|
||||
|
||||
message ShowSecurityGroupRuleReq{
|
||||
|
|
Loading…
Reference in New Issue