From 721b735a0e1db6b7c3efb2b430f70428413348fd Mon Sep 17 00:00:00 2001 From: yuxh Date: Thu, 7 Nov 2024 15:50:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Eapk=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/capk/client.go | 12 ++++++++++++ services/capk/client_test.go | 21 +++++++++++++++++++++ services/capk/config_get.go | 34 ++++++++++++++++++++++++++++++++++ services/capk/config_modify.go | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 100 insertions(+) create mode 100644 services/capk/config_get.go create mode 100644 services/capk/config_modify.go diff --git a/services/capk/client.go b/services/capk/client.go index 73c1989..7671ba7 100644 --- a/services/capk/client.go +++ b/services/capk/client.go @@ -28,3 +28,15 @@ func (c *Client) TaskCreate(req *TaskCreateRequest) (resp *TaskCreateResponse, e err = c.DoAction(req, resp) return } + +func (c *Client) ConfigModify(req *ConfigModifyRequest) (resp *ConfigModifyResponse, err error) { + resp = CreateConfigModifyResponse() + err = c.DoAction(req, resp) + return +} + +func (c *Client) ConfigGet(req *ConfigGetRequest) (resp *ConfigGetResponse, err error) { + resp = CreateConfigGetResponse() + err = c.DoAction(req, resp) + return +} diff --git a/services/capk/client_test.go b/services/capk/client_test.go index dc9dddd..a7bdb3c 100644 --- a/services/capk/client_test.go +++ b/services/capk/client_test.go @@ -16,3 +16,24 @@ func TestTask_Create(t *testing.T) { resp, err := client.TaskCreate(req) t.Logf("%v", resp.Data.TaskId) } + +func TestConfig_Modify(t *testing.T) { + client, err := NewClient() + if err != nil { + t.Fatal(err) + } + req := CreateConfigModifyRequest() + req.Content = []byte(``) + resp, err := client.ConfigModify(req) + t.Log(resp.Code, resp.Msg) +} + +func TestConfig_Get(t *testing.T) { + client, err := NewClient() + if err != nil { + t.Fatal(err) + } + req := CreateConfigGetRequest() + resp, err := client.ConfigGet(req) + t.Log(resp.Code, resp.Data) +} diff --git a/services/capk/config_get.go b/services/capk/config_get.go new file mode 100644 index 0000000..21469a6 --- /dev/null +++ b/services/capk/config_get.go @@ -0,0 +1,34 @@ +package capk + +import ( + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" +) + +type ConfigGetRequest struct { + *requests.JsonRequest +} + +type ConfigGetResponse struct { + *responses.BaseResponse + Code int `json:"code"` + Msg string `json:"msg"` + Data string `json:"data"` +} + +func CreateConfigGetRequest() *ConfigGetRequest { + req := &ConfigGetRequest{ + JsonRequest: &requests.JsonRequest{}, + } + + req.InitWithApiInfo(HOST, VERSION, "/pack/config/get") + req.Method = requests.GET + + return req +} + +func CreateConfigGetResponse() *ConfigGetResponse { + return &ConfigGetResponse{ + BaseResponse: &responses.BaseResponse{}, + } +} diff --git a/services/capk/config_modify.go b/services/capk/config_modify.go new file mode 100644 index 0000000..e740e88 --- /dev/null +++ b/services/capk/config_modify.go @@ -0,0 +1,33 @@ +package capk + +import ( + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" +) + +type ConfigModifyRequest struct { + *requests.StreamRequest +} + +type ConfigModifyResponse struct { + *responses.BaseResponse + Code int `json:"code"` + Msg string `json:"msg"` + Data string `json:"data"` +} + +func CreateConfigModifyRequest() (req *ConfigModifyRequest) { + req = &ConfigModifyRequest{ + StreamRequest: &requests.StreamRequest{}, + } + + req.InitWithApiInfo(HOST, VERSION, "/pack/config/set") + req.Method = requests.POST + return +} + +func CreateConfigModifyResponse() (resp *ConfigModifyResponse) { + return &ConfigModifyResponse{ + BaseResponse: &responses.BaseResponse{}, + } +}