diff --git a/README.md b/README.md index 846e135..6f9c036 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ## General -**jfrog-cli-application** is a Go module that encompasses some of the JFrog Application Lifecycle commands of [JFrog CLI](https://docs.jfrog-applications.jfrog.io/jfrog-applications/jfrog-cli). This module is an Embedded JFrog CLI Plugin and is referenced as a Go module within the [JFrog CLI codebase](https://github.com/jfrog/jfrog-cli). +**jfrog-cli-application** is a Go module that encompasses the JFrog AppTrust commands of [JFrog CLI](https://docs.jfrog-applications.jfrog.io/jfrog-applications/jfrog-cli). This module is an Embedded JFrog CLI Plugin and is referenced as a Go module within the [JFrog CLI codebase](https://github.com/jfrog/jfrog-cli). ## 🫱🏻‍🫲🏼 Contributions diff --git a/application/app/context.go b/apptrust/app/context.go similarity index 81% rename from application/app/context.go rename to apptrust/app/context.go index fa912f6..44e86c7 100644 --- a/application/app/context.go +++ b/apptrust/app/context.go @@ -1,9 +1,9 @@ package app import ( - "github.com/jfrog/jfrog-cli-application/application/service/applications" - "github.com/jfrog/jfrog-cli-application/application/service/systems" - "github.com/jfrog/jfrog-cli-application/application/service/versions" + "github.com/jfrog/jfrog-cli-application/apptrust/service/applications" + "github.com/jfrog/jfrog-cli-application/apptrust/service/systems" + "github.com/jfrog/jfrog-cli-application/apptrust/service/versions" ) type Context interface { diff --git a/application/app/context_test.go b/apptrust/app/context_test.go similarity index 79% rename from application/app/context_test.go rename to apptrust/app/context_test.go index 32ec69c..a61f247 100644 --- a/application/app/context_test.go +++ b/apptrust/app/context_test.go @@ -3,9 +3,9 @@ package app import ( "testing" - mockapplications "github.com/jfrog/jfrog-cli-application/application/service/applications/mocks" - mocksystems "github.com/jfrog/jfrog-cli-application/application/service/systems/mocks" - mockversions "github.com/jfrog/jfrog-cli-application/application/service/versions/mocks" + mockapplications "github.com/jfrog/jfrog-cli-application/apptrust/service/applications/mocks" + mocksystems "github.com/jfrog/jfrog-cli-application/apptrust/service/systems/mocks" + mockversions "github.com/jfrog/jfrog-cli-application/apptrust/service/versions/mocks" "github.com/stretchr/testify/assert" ) diff --git a/application/commands/application/create_app_cmd.go b/apptrust/commands/application/create_app_cmd.go similarity index 89% rename from application/commands/application/create_app_cmd.go rename to apptrust/commands/application/create_app_cmd.go index bb2232b..d6f317f 100644 --- a/application/commands/application/create_app_cmd.go +++ b/apptrust/commands/application/create_app_cmd.go @@ -3,18 +3,18 @@ package application import ( pluginsCommon "github.com/jfrog/jfrog-cli-core/v2/plugins/common" - "github.com/jfrog/jfrog-cli-application/application/commands/utils" - "github.com/jfrog/jfrog-cli-application/application/model" - "github.com/jfrog/jfrog-cli-application/application/service" + "github.com/jfrog/jfrog-cli-application/apptrust/commands/utils" + "github.com/jfrog/jfrog-cli-application/apptrust/model" + "github.com/jfrog/jfrog-cli-application/apptrust/service" commonCLiCommands "github.com/jfrog/jfrog-cli-core/v2/common/commands" "github.com/jfrog/jfrog-cli-core/v2/plugins/components" coreConfig "github.com/jfrog/jfrog-cli-core/v2/utils/config" "github.com/jfrog/jfrog-client-go/utils/errorutils" - "github.com/jfrog/jfrog-cli-application/application/app" - "github.com/jfrog/jfrog-cli-application/application/commands" - "github.com/jfrog/jfrog-cli-application/application/common" - "github.com/jfrog/jfrog-cli-application/application/service/applications" + "github.com/jfrog/jfrog-cli-application/apptrust/app" + "github.com/jfrog/jfrog-cli-application/apptrust/commands" + "github.com/jfrog/jfrog-cli-application/apptrust/common" + "github.com/jfrog/jfrog-cli-application/apptrust/service/applications" ) type createAppCommand struct { diff --git a/application/commands/application/create_app_cmd_test.go b/apptrust/commands/application/create_app_cmd_test.go similarity index 93% rename from application/commands/application/create_app_cmd_test.go rename to apptrust/commands/application/create_app_cmd_test.go index 21fdd74..cc1b454 100644 --- a/application/commands/application/create_app_cmd_test.go +++ b/apptrust/commands/application/create_app_cmd_test.go @@ -7,8 +7,8 @@ import ( "github.com/urfave/cli" - "github.com/jfrog/jfrog-cli-application/application/model" - mockapps "github.com/jfrog/jfrog-cli-application/application/service/applications/mocks" + "github.com/jfrog/jfrog-cli-application/apptrust/model" + mockapps "github.com/jfrog/jfrog-cli-application/apptrust/service/applications/mocks" "github.com/jfrog/jfrog-cli-core/v2/plugins/components" "github.com/jfrog/jfrog-cli-core/v2/utils/config" "github.com/stretchr/testify/assert" diff --git a/application/commands/application/delete_app_cmd.go b/apptrust/commands/application/delete_app_cmd.go similarity index 81% rename from application/commands/application/delete_app_cmd.go rename to apptrust/commands/application/delete_app_cmd.go index e9f331e..33660d3 100644 --- a/application/commands/application/delete_app_cmd.go +++ b/apptrust/commands/application/delete_app_cmd.go @@ -1,15 +1,15 @@ package application import ( - "github.com/jfrog/jfrog-cli-application/application/app" + "github.com/jfrog/jfrog-cli-application/apptrust/app" commonCLiCommands "github.com/jfrog/jfrog-cli-core/v2/common/commands" pluginsCommon "github.com/jfrog/jfrog-cli-core/v2/plugins/common" - "github.com/jfrog/jfrog-cli-application/application/commands" - "github.com/jfrog/jfrog-cli-application/application/commands/utils" - "github.com/jfrog/jfrog-cli-application/application/common" - "github.com/jfrog/jfrog-cli-application/application/service" - "github.com/jfrog/jfrog-cli-application/application/service/applications" + "github.com/jfrog/jfrog-cli-application/apptrust/commands" + "github.com/jfrog/jfrog-cli-application/apptrust/commands/utils" + "github.com/jfrog/jfrog-cli-application/apptrust/common" + "github.com/jfrog/jfrog-cli-application/apptrust/service" + "github.com/jfrog/jfrog-cli-application/apptrust/service/applications" "github.com/jfrog/jfrog-cli-core/v2/plugins/components" coreConfig "github.com/jfrog/jfrog-cli-core/v2/utils/config" ) diff --git a/application/commands/application/delete_app_cmd_test.go b/apptrust/commands/application/delete_app_cmd_test.go similarity index 95% rename from application/commands/application/delete_app_cmd_test.go rename to apptrust/commands/application/delete_app_cmd_test.go index 7edac35..99820fe 100644 --- a/application/commands/application/delete_app_cmd_test.go +++ b/apptrust/commands/application/delete_app_cmd_test.go @@ -5,7 +5,7 @@ import ( "flag" "testing" - mockapps "github.com/jfrog/jfrog-cli-application/application/service/applications/mocks" + mockapps "github.com/jfrog/jfrog-cli-application/apptrust/service/applications/mocks" "github.com/jfrog/jfrog-cli-core/v2/plugins/components" "github.com/jfrog/jfrog-cli-core/v2/utils/config" "github.com/stretchr/testify/assert" diff --git a/application/commands/application/update_app_cmd.go b/apptrust/commands/application/update_app_cmd.go similarity index 88% rename from application/commands/application/update_app_cmd.go rename to apptrust/commands/application/update_app_cmd.go index 029bf80..4404eab 100644 --- a/application/commands/application/update_app_cmd.go +++ b/apptrust/commands/application/update_app_cmd.go @@ -3,13 +3,13 @@ package application import ( pluginsCommon "github.com/jfrog/jfrog-cli-core/v2/plugins/common" - "github.com/jfrog/jfrog-cli-application/application/app" - "github.com/jfrog/jfrog-cli-application/application/commands" - "github.com/jfrog/jfrog-cli-application/application/commands/utils" - "github.com/jfrog/jfrog-cli-application/application/common" - "github.com/jfrog/jfrog-cli-application/application/model" - "github.com/jfrog/jfrog-cli-application/application/service" - "github.com/jfrog/jfrog-cli-application/application/service/applications" + "github.com/jfrog/jfrog-cli-application/apptrust/app" + "github.com/jfrog/jfrog-cli-application/apptrust/commands" + "github.com/jfrog/jfrog-cli-application/apptrust/commands/utils" + "github.com/jfrog/jfrog-cli-application/apptrust/common" + "github.com/jfrog/jfrog-cli-application/apptrust/model" + "github.com/jfrog/jfrog-cli-application/apptrust/service" + "github.com/jfrog/jfrog-cli-application/apptrust/service/applications" commonCLiCommands "github.com/jfrog/jfrog-cli-core/v2/common/commands" "github.com/jfrog/jfrog-cli-core/v2/plugins/components" coreConfig "github.com/jfrog/jfrog-cli-core/v2/utils/config" diff --git a/application/commands/application/update_app_cmd_test.go b/apptrust/commands/application/update_app_cmd_test.go similarity index 94% rename from application/commands/application/update_app_cmd_test.go rename to apptrust/commands/application/update_app_cmd_test.go index 0089f2c..7c3329f 100644 --- a/application/commands/application/update_app_cmd_test.go +++ b/apptrust/commands/application/update_app_cmd_test.go @@ -7,8 +7,8 @@ import ( "github.com/urfave/cli" - "github.com/jfrog/jfrog-cli-application/application/model" - mockapps "github.com/jfrog/jfrog-cli-application/application/service/applications/mocks" + "github.com/jfrog/jfrog-cli-application/apptrust/model" + mockapps "github.com/jfrog/jfrog-cli-application/apptrust/service/applications/mocks" "github.com/jfrog/jfrog-cli-core/v2/plugins/components" "github.com/jfrog/jfrog-cli-core/v2/utils/config" "github.com/stretchr/testify/assert" diff --git a/application/commands/flags.go b/apptrust/commands/flags.go similarity index 99% rename from application/commands/flags.go rename to apptrust/commands/flags.go index 316e832..de01909 100644 --- a/application/commands/flags.go +++ b/apptrust/commands/flags.go @@ -1,7 +1,7 @@ package commands import ( - "github.com/jfrog/jfrog-cli-application/application/model" + "github.com/jfrog/jfrog-cli-application/apptrust/model" pluginsCommon "github.com/jfrog/jfrog-cli-core/v2/plugins/common" "github.com/jfrog/jfrog-cli-core/v2/plugins/components" "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" diff --git a/application/commands/system/ping_cmd.go b/apptrust/commands/system/ping_cmd.go similarity index 78% rename from application/commands/system/ping_cmd.go rename to apptrust/commands/system/ping_cmd.go index 54ff91b..360be0f 100644 --- a/application/commands/system/ping_cmd.go +++ b/apptrust/commands/system/ping_cmd.go @@ -3,12 +3,12 @@ package system //go:generate ${PROJECT_DIR}/scripts/mockgen.sh ${GOFILE} import ( - "github.com/jfrog/jfrog-cli-application/application/app" - "github.com/jfrog/jfrog-cli-application/application/commands" - "github.com/jfrog/jfrog-cli-application/application/commands/utils" - "github.com/jfrog/jfrog-cli-application/application/common" - "github.com/jfrog/jfrog-cli-application/application/service" - "github.com/jfrog/jfrog-cli-application/application/service/systems" + "github.com/jfrog/jfrog-cli-application/apptrust/app" + "github.com/jfrog/jfrog-cli-application/apptrust/commands" + "github.com/jfrog/jfrog-cli-application/apptrust/commands/utils" + "github.com/jfrog/jfrog-cli-application/apptrust/common" + "github.com/jfrog/jfrog-cli-application/apptrust/service" + "github.com/jfrog/jfrog-cli-application/apptrust/service/systems" commonCLiCommands "github.com/jfrog/jfrog-cli-core/v2/common/commands" "github.com/jfrog/jfrog-cli-core/v2/plugins/components" coreConfig "github.com/jfrog/jfrog-cli-core/v2/utils/config" diff --git a/application/commands/utils/utils.go b/apptrust/commands/utils/utils.go similarity index 100% rename from application/commands/utils/utils.go rename to apptrust/commands/utils/utils.go diff --git a/application/commands/utils/utils_test.go b/apptrust/commands/utils/utils_test.go similarity index 100% rename from application/commands/utils/utils_test.go rename to apptrust/commands/utils/utils_test.go diff --git a/application/commands/version/create_app_version_cmd.go b/apptrust/commands/version/create_app_version_cmd.go similarity index 91% rename from application/commands/version/create_app_version_cmd.go rename to apptrust/commands/version/create_app_version_cmd.go index b937206..cd258eb 100644 --- a/application/commands/version/create_app_version_cmd.go +++ b/apptrust/commands/version/create_app_version_cmd.go @@ -3,14 +3,14 @@ package version import ( "encoding/json" - "github.com/jfrog/jfrog-cli-application/application/service/versions" - - "github.com/jfrog/jfrog-cli-application/application/app" - "github.com/jfrog/jfrog-cli-application/application/commands" - "github.com/jfrog/jfrog-cli-application/application/commands/utils" - "github.com/jfrog/jfrog-cli-application/application/common" - "github.com/jfrog/jfrog-cli-application/application/model" - "github.com/jfrog/jfrog-cli-application/application/service" + "github.com/jfrog/jfrog-cli-application/apptrust/service/versions" + + "github.com/jfrog/jfrog-cli-application/apptrust/app" + "github.com/jfrog/jfrog-cli-application/apptrust/commands" + "github.com/jfrog/jfrog-cli-application/apptrust/commands/utils" + "github.com/jfrog/jfrog-cli-application/apptrust/common" + "github.com/jfrog/jfrog-cli-application/apptrust/model" + "github.com/jfrog/jfrog-cli-application/apptrust/service" commonCLiCommands "github.com/jfrog/jfrog-cli-core/v2/common/commands" pluginsCommon "github.com/jfrog/jfrog-cli-core/v2/plugins/common" "github.com/jfrog/jfrog-cli-core/v2/plugins/components" diff --git a/application/commands/version/create_app_version_cmd_test.go b/apptrust/commands/version/create_app_version_cmd_test.go similarity index 92% rename from application/commands/version/create_app_version_cmd_test.go rename to apptrust/commands/version/create_app_version_cmd_test.go index a7f95ee..1664118 100644 --- a/application/commands/version/create_app_version_cmd_test.go +++ b/apptrust/commands/version/create_app_version_cmd_test.go @@ -4,10 +4,10 @@ import ( "errors" "testing" - mockversions "github.com/jfrog/jfrog-cli-application/application/service/versions/mocks" + mockversions "github.com/jfrog/jfrog-cli-application/apptrust/service/versions/mocks" "go.uber.org/mock/gomock" - "github.com/jfrog/jfrog-cli-application/application/model" + "github.com/jfrog/jfrog-cli-application/apptrust/model" "github.com/jfrog/jfrog-cli-core/v2/utils/config" "github.com/stretchr/testify/assert" ) diff --git a/application/commands/version/promote_app_version_cmd.go b/apptrust/commands/version/promote_app_version_cmd.go similarity index 85% rename from application/commands/version/promote_app_version_cmd.go rename to apptrust/commands/version/promote_app_version_cmd.go index 12b5c05..10997fc 100644 --- a/application/commands/version/promote_app_version_cmd.go +++ b/apptrust/commands/version/promote_app_version_cmd.go @@ -3,13 +3,13 @@ package version //go:generate ${PROJECT_DIR}/scripts/mockgen.sh ${GOFILE} import ( - "github.com/jfrog/jfrog-cli-application/application/app" - "github.com/jfrog/jfrog-cli-application/application/commands" - "github.com/jfrog/jfrog-cli-application/application/commands/utils" - "github.com/jfrog/jfrog-cli-application/application/common" - "github.com/jfrog/jfrog-cli-application/application/model" - "github.com/jfrog/jfrog-cli-application/application/service" - "github.com/jfrog/jfrog-cli-application/application/service/versions" + "github.com/jfrog/jfrog-cli-application/apptrust/app" + "github.com/jfrog/jfrog-cli-application/apptrust/commands" + "github.com/jfrog/jfrog-cli-application/apptrust/commands/utils" + "github.com/jfrog/jfrog-cli-application/apptrust/common" + "github.com/jfrog/jfrog-cli-application/apptrust/model" + "github.com/jfrog/jfrog-cli-application/apptrust/service" + "github.com/jfrog/jfrog-cli-application/apptrust/service/versions" commonCLiCommands "github.com/jfrog/jfrog-cli-core/v2/common/commands" pluginsCommon "github.com/jfrog/jfrog-cli-core/v2/plugins/common" "github.com/jfrog/jfrog-cli-core/v2/plugins/components" diff --git a/application/commands/version/promote_app_version_cmd_test.go b/apptrust/commands/version/promote_app_version_cmd_test.go similarity index 85% rename from application/commands/version/promote_app_version_cmd_test.go rename to apptrust/commands/version/promote_app_version_cmd_test.go index 8af3f5f..9ba2035 100644 --- a/application/commands/version/promote_app_version_cmd_test.go +++ b/apptrust/commands/version/promote_app_version_cmd_test.go @@ -3,11 +3,11 @@ package version import ( "testing" - "github.com/jfrog/jfrog-cli-application/application/commands" - mockversions "github.com/jfrog/jfrog-cli-application/application/service/versions/mocks" + "github.com/jfrog/jfrog-cli-application/apptrust/commands" + mockversions "github.com/jfrog/jfrog-cli-application/apptrust/service/versions/mocks" "go.uber.org/mock/gomock" - "github.com/jfrog/jfrog-cli-application/application/model" + "github.com/jfrog/jfrog-cli-application/apptrust/model" coreconfig "github.com/jfrog/jfrog-cli-core/v2/utils/config" "github.com/stretchr/testify/assert" ) diff --git a/application/common/categories.go b/apptrust/common/categories.go similarity index 100% rename from application/common/categories.go rename to apptrust/common/categories.go diff --git a/application/http/http_client.go b/apptrust/http/http_client.go similarity index 77% rename from application/http/http_client.go rename to apptrust/http/http_client.go index 051d4c4..2f36e63 100644 --- a/application/http/http_client.go +++ b/apptrust/http/http_client.go @@ -19,9 +19,9 @@ import ( "github.com/jfrog/jfrog-client-go/utils/io/httputils" ) -const appTrustApiPath = "apptrust/api" +const apptrustApiPath = "apptrust/api" -type AppHttpClient interface { +type ApptrustHttpClient interface { GetHttpClient() *jfroghttpclient.JfrogHttpClient Post(path string, requestBody interface{}) (resp *http.Response, body []byte, err error) Get(path string) (resp *http.Response, body []byte, err error) @@ -29,14 +29,14 @@ type AppHttpClient interface { Delete(path string) (resp *http.Response, body []byte, err error) } -type appHttpClient struct { +type apptrustHttpClient struct { client *jfroghttpclient.JfrogHttpClient serverDetails *commonCliConfig.ServerDetails authDetails auth.ServiceDetails serviceConfig clientConfig.Config } -func NewAppHttpClient(serverDetails *commonCliConfig.ServerDetails) (AppHttpClient, error) { +func NewAppHttpClient(serverDetails *commonCliConfig.ServerDetails) (ApptrustHttpClient, error) { certsPath, err := coreutils.GetJfrogCertsDir() if err != nil { return nil, err @@ -73,7 +73,7 @@ func NewAppHttpClient(serverDetails *commonCliConfig.ServerDetails) (AppHttpClie return nil, err } - appClient := &appHttpClient{ + appClient := &apptrustHttpClient{ client: jfHttpClient, serverDetails: serverDetails, authDetails: authDetails, @@ -82,12 +82,12 @@ func NewAppHttpClient(serverDetails *commonCliConfig.ServerDetails) (AppHttpClie return appClient, nil } -func (c *appHttpClient) GetHttpClient() *jfroghttpclient.JfrogHttpClient { +func (c *apptrustHttpClient) GetHttpClient() *jfroghttpclient.JfrogHttpClient { return c.client } -func (c *appHttpClient) Post(path string, requestBody interface{}) (resp *http.Response, body []byte, err error) { - url, err := utils.BuildUrl(c.serverDetails.Url, appTrustApiPath+path, nil) +func (c *apptrustHttpClient) Post(path string, requestBody interface{}) (resp *http.Response, body []byte, err error) { + url, err := utils.BuildUrl(c.serverDetails.Url, apptrustApiPath+path, nil) if err != nil { return nil, nil, err } @@ -101,8 +101,8 @@ func (c *appHttpClient) Post(path string, requestBody interface{}) (resp *http.R return c.client.SendPost(url, requestContent, c.getJsonHttpClientDetails()) } -func (c *appHttpClient) Get(path string) (resp *http.Response, body []byte, err error) { - url, err := utils.BuildUrl(c.serverDetails.Url, appTrustApiPath+path, nil) +func (c *apptrustHttpClient) Get(path string) (resp *http.Response, body []byte, err error) { + url, err := utils.BuildUrl(c.serverDetails.Url, apptrustApiPath+path, nil) if err != nil { return nil, nil, err } @@ -112,8 +112,8 @@ func (c *appHttpClient) Get(path string) (resp *http.Response, body []byte, err return response, body, err } -func (c *appHttpClient) Patch(path string, requestBody interface{}) (resp *http.Response, body []byte, err error) { - url, err := utils.BuildUrl(c.serverDetails.Url, appTrustApiPath+path, nil) +func (c *apptrustHttpClient) Patch(path string, requestBody interface{}) (resp *http.Response, body []byte, err error) { + url, err := utils.BuildUrl(c.serverDetails.Url, apptrustApiPath+path, nil) if err != nil { return nil, nil, err } @@ -127,7 +127,7 @@ func (c *appHttpClient) Patch(path string, requestBody interface{}) (resp *http. return c.client.SendPatch(url, requestContent, c.getJsonHttpClientDetails()) } -func (c *appHttpClient) toJsonBytes(payload interface{}) ([]byte, error) { +func (c *apptrustHttpClient) toJsonBytes(payload interface{}) ([]byte, error) { if payload == nil { return nil, fmt.Errorf("request payload is required") } @@ -139,8 +139,8 @@ func (c *appHttpClient) toJsonBytes(payload interface{}) ([]byte, error) { return jsonBytes, nil } -func (c *appHttpClient) Delete(path string) (resp *http.Response, body []byte, err error) { - url, err := utils.BuildUrl(c.serverDetails.Url, appTrustApiPath+path, nil) +func (c *apptrustHttpClient) Delete(path string) (resp *http.Response, body []byte, err error) { + url, err := utils.BuildUrl(c.serverDetails.Url, apptrustApiPath+path, nil) if err != nil { return nil, nil, err } @@ -149,7 +149,7 @@ func (c *appHttpClient) Delete(path string) (resp *http.Response, body []byte, e return c.client.SendDelete(url, nil, c.getJsonHttpClientDetails()) } -func (c *appHttpClient) getJsonHttpClientDetails() *httputils.HttpClientDetails { +func (c *apptrustHttpClient) getJsonHttpClientDetails() *httputils.HttpClientDetails { httpClientDetails := c.authDetails.CreateHttpClientDetails() httpClientDetails.SetContentTypeApplicationJson() return &httpClientDetails diff --git a/application/model/app_descriptor.go b/apptrust/model/app_descriptor.go similarity index 100% rename from application/model/app_descriptor.go rename to apptrust/model/app_descriptor.go diff --git a/application/model/create_app_version_request.go b/apptrust/model/create_app_version_request.go similarity index 100% rename from application/model/create_app_version_request.go rename to apptrust/model/create_app_version_request.go diff --git a/application/model/promote_app_version_request.go b/apptrust/model/promote_app_version_request.go similarity index 100% rename from application/model/promote_app_version_request.go rename to apptrust/model/promote_app_version_request.go diff --git a/application/service/applications/application_service.go b/apptrust/service/applications/application_service.go similarity index 94% rename from application/service/applications/application_service.go rename to apptrust/service/applications/application_service.go index bb1512a..9be37f6 100644 --- a/application/service/applications/application_service.go +++ b/apptrust/service/applications/application_service.go @@ -8,8 +8,8 @@ import ( "github.com/jfrog/jfrog-client-go/utils/errorutils" - "github.com/jfrog/jfrog-cli-application/application/model" - "github.com/jfrog/jfrog-cli-application/application/service" + "github.com/jfrog/jfrog-cli-application/apptrust/model" + "github.com/jfrog/jfrog-cli-application/apptrust/service" ) type ApplicationService interface { diff --git a/application/service/applications/application_service_test.go b/apptrust/service/applications/application_service_test.go similarity index 85% rename from application/service/applications/application_service_test.go rename to apptrust/service/applications/application_service_test.go index fcfb2e3..264c79d 100644 --- a/application/service/applications/application_service_test.go +++ b/apptrust/service/applications/application_service_test.go @@ -5,9 +5,9 @@ import ( "net/http" "testing" - mockhttp "github.com/jfrog/jfrog-cli-application/application/http/mocks" - "github.com/jfrog/jfrog-cli-application/application/model" - mockservice "github.com/jfrog/jfrog-cli-application/application/service/mocks" + mockhttp "github.com/jfrog/jfrog-cli-application/apptrust/http/mocks" + "github.com/jfrog/jfrog-cli-application/apptrust/model" + mockservice "github.com/jfrog/jfrog-cli-application/apptrust/service/mocks" "github.com/stretchr/testify/assert" "go.uber.org/mock/gomock" ) @@ -48,7 +48,7 @@ func TestApplicationService_CreateApplication(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() - mockHttpClient := mockhttp.NewMockAppHttpClient(ctrl) + mockHttpClient := mockhttp.NewMockApptrustHttpClient(ctrl) mockHttpClient.EXPECT().Post("/v1/applications", gomock.Any()).Return(tt.mockResponse, tt.mockBody, tt.mockError) mockCtx := mockservice.NewMockContext(ctrl) diff --git a/application/service/context.go b/apptrust/service/context.go similarity index 76% rename from application/service/context.go rename to apptrust/service/context.go index 12f6b67..83125de 100644 --- a/application/service/context.go +++ b/apptrust/service/context.go @@ -3,25 +3,25 @@ package service //go:generate ${PROJECT_DIR}/scripts/mockgen.sh ${GOFILE} import ( - "github.com/jfrog/jfrog-cli-application/application/http" + "github.com/jfrog/jfrog-cli-application/apptrust/http" coreConfig "github.com/jfrog/jfrog-cli-core/v2/utils/config" ) type Context interface { GetServerDetails() coreConfig.ServerDetails - GetHttpClient() http.AppHttpClient + GetHttpClient() http.ApptrustHttpClient } type context struct { ServerDetails coreConfig.ServerDetails - HttpClient http.AppHttpClient + HttpClient http.ApptrustHttpClient } func (c *context) GetServerDetails() coreConfig.ServerDetails { return c.ServerDetails } -func (c *context) GetHttpClient() http.AppHttpClient { +func (c *context) GetHttpClient() http.ApptrustHttpClient { return c.HttpClient } diff --git a/application/service/context_test.go b/apptrust/service/context_test.go similarity index 94% rename from application/service/context_test.go rename to apptrust/service/context_test.go index 5d7eb54..258df29 100644 --- a/application/service/context_test.go +++ b/apptrust/service/context_test.go @@ -3,7 +3,7 @@ package service import ( "testing" - "github.com/jfrog/jfrog-cli-application/application/http" + "github.com/jfrog/jfrog-cli-application/apptrust/http" coreConfig "github.com/jfrog/jfrog-cli-core/v2/utils/config" "github.com/stretchr/testify/assert" ) diff --git a/application/service/systems/system_service.go b/apptrust/service/systems/system_service.go similarity index 90% rename from application/service/systems/system_service.go rename to apptrust/service/systems/system_service.go index 7c48885..0998cd9 100644 --- a/application/service/systems/system_service.go +++ b/apptrust/service/systems/system_service.go @@ -5,7 +5,7 @@ package systems import ( "fmt" - "github.com/jfrog/jfrog-cli-application/application/service" + "github.com/jfrog/jfrog-cli-application/apptrust/service" ) type SystemService interface { diff --git a/application/service/systems/system_service_test.go b/apptrust/service/systems/system_service_test.go similarity index 87% rename from application/service/systems/system_service_test.go rename to apptrust/service/systems/system_service_test.go index 7a0e3f3..1824355 100644 --- a/application/service/systems/system_service_test.go +++ b/apptrust/service/systems/system_service_test.go @@ -5,10 +5,10 @@ import ( "net/http" "testing" - mockservice "github.com/jfrog/jfrog-cli-application/application/service/mocks" + mockservice "github.com/jfrog/jfrog-cli-application/apptrust/service/mocks" "go.uber.org/mock/gomock" - mockhttp "github.com/jfrog/jfrog-cli-application/application/http/mocks" + mockhttp "github.com/jfrog/jfrog-cli-application/apptrust/http/mocks" "github.com/stretchr/testify/assert" ) @@ -52,7 +52,7 @@ func TestSystemService_Ping(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() - mockHttpClient := mockhttp.NewMockAppHttpClient(ctrl) + mockHttpClient := mockhttp.NewMockApptrustHttpClient(ctrl) mockHttpClient.EXPECT().Get("/v1/system/ping"). Return(tt.mockResponse, tt.mockBody, tt.mockError) diff --git a/application/service/versions/version_service.go b/apptrust/service/versions/version_service.go similarity index 90% rename from application/service/versions/version_service.go rename to apptrust/service/versions/version_service.go index a5f68af..7408ecc 100644 --- a/application/service/versions/version_service.go +++ b/apptrust/service/versions/version_service.go @@ -5,9 +5,9 @@ package versions import ( "fmt" - "github.com/jfrog/jfrog-cli-application/application/service" + "github.com/jfrog/jfrog-cli-application/apptrust/service" - "github.com/jfrog/jfrog-cli-application/application/model" + "github.com/jfrog/jfrog-cli-application/apptrust/model" ) type VersionService interface { diff --git a/application/service/versions/version_service_test.go b/apptrust/service/versions/version_service_test.go similarity index 91% rename from application/service/versions/version_service_test.go rename to apptrust/service/versions/version_service_test.go index 2ca4eab..4029d3f 100644 --- a/application/service/versions/version_service_test.go +++ b/apptrust/service/versions/version_service_test.go @@ -5,11 +5,11 @@ import ( "net/http" "testing" - mockhttp "github.com/jfrog/jfrog-cli-application/application/http/mocks" - mockservice "github.com/jfrog/jfrog-cli-application/application/service/mocks" + mockhttp "github.com/jfrog/jfrog-cli-application/apptrust/http/mocks" + mockservice "github.com/jfrog/jfrog-cli-application/apptrust/service/mocks" "go.uber.org/mock/gomock" - "github.com/jfrog/jfrog-cli-application/application/model" + "github.com/jfrog/jfrog-cli-application/apptrust/model" "github.com/stretchr/testify/assert" ) @@ -55,7 +55,7 @@ func TestCreateAppVersion(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - mockHttpClient := mockhttp.NewMockAppHttpClient(ctrl) + mockHttpClient := mockhttp.NewMockApptrustHttpClient(ctrl) mockHttpClient.EXPECT().Post("/v1/version", tt.request). Return(tt.mockResponse, []byte(tt.mockResponseBody), tt.mockError).Times(1) @@ -115,7 +115,7 @@ func TestPromoteAppVersion(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - mockHttpClient := mockhttp.NewMockAppHttpClient(ctrl) + mockHttpClient := mockhttp.NewMockApptrustHttpClient(ctrl) mockHttpClient.EXPECT().Post("/v1/version/promote", tt.payload). Return(tt.mockResponse, []byte(tt.mockResponseBody), tt.mockError).Times(1) diff --git a/application/cli/cli.go b/cli/cli.go similarity index 53% rename from application/cli/cli.go rename to cli/cli.go index 2f2aebf..f1989fb 100644 --- a/application/cli/cli.go +++ b/cli/cli.go @@ -1,40 +1,41 @@ package cli import ( - "github.com/jfrog/jfrog-cli-application/application/app" - "github.com/jfrog/jfrog-cli-application/application/commands/application" - "github.com/jfrog/jfrog-cli-application/application/commands/system" - "github.com/jfrog/jfrog-cli-application/application/commands/version" + "github.com/jfrog/jfrog-cli-application/apptrust/app" + "github.com/jfrog/jfrog-cli-application/apptrust/commands/application" + "github.com/jfrog/jfrog-cli-application/apptrust/commands/system" + "github.com/jfrog/jfrog-cli-application/apptrust/commands/version" "github.com/jfrog/jfrog-cli-core/v2/plugins/components" ) -//const category = "Application Lifecycle" -// -// -//func GetJfrogApplicationCli() components.App { +//func GetJfrogCliApptrustApp() components.App { // appContext := app.NewAppContext() // appEntity := components.CreateEmbeddedApp( -// category, +// "apptrust", // nil, // components.Namespace{ // Name: "app", -// Description: "Tools for Application Lifecycle management", -// Category: category, +// Description: "AppTrust commands.", +// Category: "Command Namespaces", // Commands: []components.Command{ // system.GetPingCommand(appContext), // version.GetCreateAppVersionCommand(appContext), +// version.GetPromoteAppVersionCommand(appContext), +// application.GetCreateAppCommand(appContext), +// application.GetUpdateAppCommand(appContext), +// application.GetDeleteAppCommand(appContext), // }, // }, // ) // return appEntity //} -func GetJfrogApplicationCli() components.App { +func GetJfrogCliApptrustApp() components.App { appContext := app.NewAppContext() appEntity := components.CreateApp( - "app", + "apptrust", "1.0.5", - "JFrog Application CLI", + "JFrog AppTrust CLI", []components.Command{ system.GetPingCommand(appContext), version.GetCreateAppVersionCommand(appContext), diff --git a/main.go b/main.go index 7bb84eb..45ac730 100644 --- a/main.go +++ b/main.go @@ -1,10 +1,10 @@ package main import ( - "github.com/jfrog/jfrog-cli-application/application/cli" + "github.com/jfrog/jfrog-cli-application/cli" "github.com/jfrog/jfrog-cli-core/v2/plugins" ) func main() { - plugins.PluginMain(cli.GetJfrogApplicationCli()) + plugins.PluginMain(cli.GetJfrogCliApptrustApp()) }