diff --git a/internal/logic/pauseserverlogic.go b/internal/logic/pauseserverlogic.go index f6820cb..288a7fc 100644 --- a/internal/logic/pauseserverlogic.go +++ b/internal/logic/pauseserverlogic.go @@ -53,5 +53,5 @@ func (l *PauseServerLogic) PauseServer(in *openstack.PauseServerReq) (*openstack resp.Code = 400 resp.Msg = "Failure" } - return &openstack.PauseServerResp{}, nil + return &resp, nil } diff --git a/internal/logic/rebootserverlogic.go b/internal/logic/rebootserverlogic.go index 71e6e5a..df6bc8c 100644 --- a/internal/logic/rebootserverlogic.go +++ b/internal/logic/rebootserverlogic.go @@ -53,5 +53,5 @@ func (l *RebootServerLogic) RebootServer(in *openstack.RebootServerReq) (*openst resp.Code = 400 resp.Msg = "Failure" } - return &openstack.RebootServerResp{}, nil + return &resp, nil } diff --git a/internal/logic/startserverlogic.go b/internal/logic/startserverlogic.go index 0e86c99..831eeda 100644 --- a/internal/logic/startserverlogic.go +++ b/internal/logic/startserverlogic.go @@ -53,5 +53,5 @@ func (l *StartServerLogic) StartServer(in *openstack.StartServerReq) (*openstack resp.Code = 400 resp.Msg = "Failure" } - return &openstack.StartServerResp{}, nil + return &resp, nil } diff --git a/internal/logic/stopserverlogic.go b/internal/logic/stopserverlogic.go index 8494b4e..4c7cf4f 100644 --- a/internal/logic/stopserverlogic.go +++ b/internal/logic/stopserverlogic.go @@ -53,5 +53,5 @@ func (l *StopServerLogic) StopServer(in *openstack.StopServerReq) (*openstack.St resp.Code = 400 resp.Msg = "Failure" } - return &openstack.StopServerResp{}, nil + return &resp, nil } diff --git a/internal/logic/updatenetworklogic.go b/internal/logic/updatenetworklogic.go index b9a6ba9..ed12a9d 100644 --- a/internal/logic/updatenetworklogic.go +++ b/internal/logic/updatenetworklogic.go @@ -3,6 +3,7 @@ package logic import ( "context" "fmt" + "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common" "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc" "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" "gitlink.org.cn/jcce-pcm/utils/tool" @@ -35,7 +36,8 @@ func (l *UpdateNetworkLogic) UpdateNetwork(in *openstack.UpdateNetworkReq) (*ope } payload := strings.NewReader(string(reqByte)) openstackUrl := l.svcCtx.Config.OpenstackNetworkUrl - statusCode, body, err := tool.HttpClientWithScreen(tool.PUT, openstackUrl+"/v2.0/networks"+in.NetworkId, payload) + token := common.GetToken() + statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.PUT, openstackUrl+"/servers/"+in.NetworkId+"/action", payload, token) if err != nil { return nil, err } @@ -51,5 +53,5 @@ func (l *UpdateNetworkLogic) UpdateNetwork(in *openstack.UpdateNetworkReq) (*ope resp.Code = 400 resp.Msg = "Failure" } - return &openstack.UpdateNetworkResp{}, nil + return &resp, nil } diff --git a/internal/logic/updateserverlogic.go b/internal/logic/updateserverlogic.go index 1421c93..1a3d4f3 100644 --- a/internal/logic/updateserverlogic.go +++ b/internal/logic/updateserverlogic.go @@ -3,6 +3,7 @@ package logic import ( "context" "fmt" + "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common" "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc" "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" "gitlink.org.cn/jcce-pcm/utils/tool" @@ -35,7 +36,8 @@ func (l *UpdateServerLogic) UpdateServer(in *openstack.UpdateServerReq) (*openst } payload := strings.NewReader(string(reqByte)) openstackUrl := l.svcCtx.Config.OpenstackComputeUrl - statusCode, body, err := tool.HttpClientWithScreen(tool.PUT, openstackUrl+"/servers/"+in.ServerId, payload) + token := common.GetToken() + statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.PUT, openstackUrl+"/servers/"+in.ServerId, payload, token) if err != nil { return nil, err } @@ -51,5 +53,5 @@ func (l *UpdateServerLogic) UpdateServer(in *openstack.UpdateServerReq) (*openst resp.Code = 400 resp.Msg = "Failure" } - return &openstack.UpdateServerResp{}, nil + return &resp, nil } diff --git a/internal/logic/updatevolumelogic.go b/internal/logic/updatevolumelogic.go index 064caec..7621221 100644 --- a/internal/logic/updatevolumelogic.go +++ b/internal/logic/updatevolumelogic.go @@ -3,6 +3,7 @@ package logic import ( "context" "fmt" + "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common" "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc" "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" "gitlink.org.cn/jcce-pcm/utils/tool" @@ -35,7 +36,8 @@ func (l *UpdateVolumeLogic) UpdateVolume(in *openstack.UpdateVolumeReq) (*openst } payload := strings.NewReader(string(reqByte)) openstackUrl := l.svcCtx.Config.OpenstackNetworkUrl - statusCode, body, err := tool.HttpClientWithScreen(tool.PUT, openstackUrl+"/v3/"+in.ProjectId+"types"+in.VolumeTypeId, payload) + token := common.GetToken() + statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.PUT, openstackUrl+"/v3/"+in.ProjectId+"types"+in.VolumeTypeId, payload, token) if err != nil { return nil, err } @@ -51,5 +53,5 @@ func (l *UpdateVolumeLogic) UpdateVolume(in *openstack.UpdateVolumeReq) (*openst resp.Code = 400 resp.Msg = "Failure" } - return &openstack.UpdateVolumeResp{}, nil + return &resp, nil }