From 29f5e61ae50a7d40642a1800f501a53fe2a00207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AB=8B=E8=93=AC?= Date: Thu, 2 Jan 2025 17:07:42 +0800 Subject: [PATCH 1/2] feature: add metadata: ClientResponse, BizInfo, BatchInstallResponse --- v1/service/ark/types.go | 51 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/v1/service/ark/types.go b/v1/service/ark/types.go index 1fbc037..2b98514 100644 --- a/v1/service/ark/types.go +++ b/v1/service/ark/types.go @@ -14,7 +14,9 @@ package ark -import "github.com/koupleless/arkctl/common/fileutil" +import ( + "github.com/koupleless/arkctl/common/fileutil" +) type ArkContainerRunType string @@ -24,12 +26,24 @@ const ( ArkContainerRunTypeK8s ArkContainerRunType = "pod" ) +// ArkClientResponse is the client response of ark api +type ArkClientResponse struct { + Code string `json:"code"` + Message string `json:"message"` + BizInfos []BizInfo `json:"bizInfos"` +} + // ArkResponseData is the response data of ark api. type ArkResponseData struct { - Code string `json:"code"` - Message string `json:"message"` - ElapsedSpace int `json:"elapsedSpace"` - BizInfos []interface{} `json:"bizInfos"` + ArkClientResponse + ElapsedSpace int `json:"elapsedSpace"` +} + +type ArkBatchInstallResponse struct { + Code string `json:"code"` + Message string `json:"message"` + ElapsedSpace int `json:"elapsedSpace"` + BizUrlToResponse map[string]ArkClientResponse `json:"bizUrlToResponse"` } // GenericArkResponseBase is the base response of ark api. @@ -95,6 +109,33 @@ type BizModel struct { BizUrl fileutil.FileUrl `json:"bizUrl,omitempty"` } +type BizInfo struct { + BizName string `json:"bizName"` + BizVersion string `json:"bizVersion"` + BizState string `json:"bizState"` + MainClass string `json:"mainClass"` + WebContextPath string `json:"webContextPath"` + URLs []interface{} `json:"urls"` + BizURL interface{} `json:"bizUrl"` + PluginURLs []interface{} `json:"pluginUrls"` + ClassLoader interface{} `json:"classLoader"` + Attributes map[string]string `json:"attributes"` + Priority int `json:"priority"` + DenyImportPackages []string `json:"denyImportPackages"` + DenyImportPackageNodes []string `json:"denyImportPackageNodes"` + DenyImportPackageStems []string `json:"denyImportPackageStems"` + DenyImportClasses []string `json:"denyImportClasses"` + DenyImportResources []string `json:"denyImportResources"` + InjectPluginDependencies []string `json:"injectPluginDependencies"` + InjectExportPackages []string `json:"injectExportPackages"` + DeclaredLibraries []string `json:"declaredLibraries"` + DeclaredCacheMap map[string]bool `json:"declaredCacheMap"` + DenyPrefixImportResourceStems []string `json:"denyPrefixImportResourceStems"` + DenySuffixImportResourceStems []string `json:"denySuffixImportResourceStems"` + BizTempWorkDir interface{} `json:"bizTempWorkDir"` + BizStateRecords []interface{} `json:"bizStateRecords"` +} + // InstallBizRequest is the request for installing biz module to ark container. type InstallBizRequest struct { // BizModel is the metadata a given biz module. From 0ff7433101ce6329135671162e0e4c5cdb276dde Mon Sep 17 00:00:00 2001 From: gaosaroma Date: Thu, 2 Jan 2025 17:27:45 +0800 Subject: [PATCH 2/2] fix ut --- v1/service/ark/service_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v1/service/ark/service_test.go b/v1/service/ark/service_test.go index 10283ee..a7b152f 100644 --- a/v1/service/ark/service_test.go +++ b/v1/service/ark/service_test.go @@ -227,7 +227,7 @@ func TestUnInstallBiz_Failed(t *testing.T) { }, }) assert.NotNil(t, err) - assert.Equal(t, "uninstall biz failed: {{FAILED {FOO 0 []} uninstall biz failed! }}", err.Error()) + assert.Equal(t, "uninstall biz failed: {{FAILED {{FOO []} 0} uninstall biz failed! }}", err.Error()) }