Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions application/app/context.go → apptrust/app/context.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
File renamed without changes.
32 changes: 16 additions & 16 deletions application/http/http_client.go → apptrust/http/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@ 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)
Patch(path string, requestBody interface{}) (resp *http.Response, body []byte, err error)
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
Expand Down Expand Up @@ -73,7 +73,7 @@ func NewAppHttpClient(serverDetails *commonCliConfig.ServerDetails) (AppHttpClie
return nil, err
}

appClient := &appHttpClient{
appClient := &apptrustHttpClient{
client: jfHttpClient,
serverDetails: serverDetails,
authDetails: authDetails,
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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")
}
Expand All @@ -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
}
Expand All @@ -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
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
Expand Down
Loading