Skip to content

Commit b2250b3

Browse files
add api endpoints
1 parent 114639d commit b2250b3

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

pkg/codefresh/argo.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func newArgoAPI(codefresh Codefresh) ArgoAPI {
5757
func (a *argo) CreateIntegration(integration IntegrationPayloadData) error {
5858

5959
_, err := a.codefresh.requestAPI(&requestOptions{
60-
path: "/argo",
60+
path: "/api/argo",
6161
method: "POST",
6262
body: &IntegrationPayload{
6363
Type: "argo-cd",
@@ -71,7 +71,7 @@ func (a *argo) CreateIntegration(integration IntegrationPayloadData) error {
7171
func (a *argo) UpdateIntegration(name string, integration IntegrationPayloadData) error {
7272
_, err := a.codefresh.requestAPI(&requestOptions{
7373
method: "PUT",
74-
path: fmt.Sprintf("/argo/%s", name),
74+
path: fmt.Sprintf("/api/argo/%s", name),
7575
body: &IntegrationPayload{
7676
Type: "argo-cd",
7777
Data: integration,
@@ -89,7 +89,7 @@ func (a *argo) GetIntegrations() ([]*IntegrationPayload, error) {
8989

9090
resp, err := a.codefresh.requestAPI(&requestOptions{
9191
method: "GET",
92-
path: "/argo",
92+
path: "/api/argo",
9393
})
9494

9595
if err != nil {
@@ -110,7 +110,7 @@ func (a *argo) GetIntegrationByName(name string) (*IntegrationPayload, error) {
110110

111111
resp, err := a.codefresh.requestAPI(&requestOptions{
112112
method: "GET",
113-
path: fmt.Sprintf("/argo/%s", name),
113+
path: fmt.Sprintf("/api/argo/%s", name),
114114
})
115115

116116
if err != nil {
@@ -129,7 +129,7 @@ func (a *argo) GetIntegrationByName(name string) (*IntegrationPayload, error) {
129129
func (a *argo) DeleteIntegrationByName(name string) error {
130130
_, err := a.codefresh.requestAPI(&requestOptions{
131131
method: "DELETE",
132-
path: fmt.Sprintf("/argo/%s", name),
132+
path: fmt.Sprintf("/api/argo/%s", name),
133133
})
134134

135135
if err != nil {
@@ -152,7 +152,7 @@ func (a *argo) HeartBeat(error string, version string, integration string) error
152152

153153
_, err := a.codefresh.requestAPI(&requestOptions{
154154
method: "POST",
155-
path: fmt.Sprintf("/argo-agent/%s/heartbeat", integration),
155+
path: fmt.Sprintf("/api/argo-agent/%s/heartbeat", integration),
156156
body: body,
157157
})
158158
if err != nil {
@@ -169,7 +169,7 @@ func (a *argo) SendResources(kind string, items interface{}, amount int, integra
169169

170170
_, err := a.codefresh.requestAPI(&requestOptions{
171171
method: "POST",
172-
path: fmt.Sprintf("/argo-agent/%s", integration),
172+
path: fmt.Sprintf("/api/argo-agent/%s", integration),
173173
body: &AgentState{Kind: kind, Items: items},
174174
})
175175
if err != nil {

pkg/codefresh/contexts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (c context) GetDefaultGitContext() (error, *ContextPayload) {
8181

8282
resp, err := c.codefresh.requestAPI(&requestOptions{
8383
method: "GET",
84-
path: "/contexts/git/default",
84+
path: "/api/contexts/git/default",
8585
})
8686

8787
if err != nil {

pkg/codefresh/gitops.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func newGitopsAPI(codefresh Codefresh) GitopsAPI {
115115
func (a *gitops) CreateEnvironment(name string, project string, application string, integration string) error {
116116
_, err := a.codefresh.requestAPI(&requestOptions{
117117
method: "POST",
118-
path: "/environments-v2",
118+
path: "/api/environments-v2",
119119
body: &EnvironmentPayload{
120120
Version: "1.0",
121121
Metadata: EnvironmentMetadata{
@@ -138,7 +138,7 @@ func (a *gitops) CreateEnvironment(name string, project string, application stri
138138

139139
func (a *gitops) SendEnvironment(environment Environment) (map[string]interface{}, error) {
140140
var result map[string]interface{}
141-
resp, err := a.codefresh.requestAPI(&requestOptions{method: "POST", path: "/environments-v2/argo/events", body: environment})
141+
resp, err := a.codefresh.requestAPI(&requestOptions{method: "POST", path: "/api/environments-v2/argo/events", body: environment})
142142
if err != nil {
143143
return nil, err
144144
}
@@ -155,7 +155,7 @@ func (a *gitops) SendEnvironment(environment Environment) (map[string]interface{
155155
func (a *gitops) DeleteEnvironment(name string) error {
156156
_, err := a.codefresh.requestAPI(&requestOptions{
157157
method: "DELETE",
158-
path: fmt.Sprintf("/environments-v2/%s", name),
158+
path: fmt.Sprintf("/api/environments-v2/%s", name),
159159
})
160160
if err != nil {
161161
return err
@@ -168,7 +168,7 @@ func (a *gitops) GetEnvironments() ([]CFEnvironment, error) {
168168
var result MongoCFEnvWrapper
169169
resp, err := a.codefresh.requestAPI(&requestOptions{
170170
method: "GET",
171-
path: "/environments-v2?plain=true&isEnvironment=false",
171+
path: "/api/environments-v2?plain=true&isEnvironment=false",
172172
})
173173
if err != nil {
174174
return nil, err
@@ -188,7 +188,7 @@ func (a *gitops) SendEvent(name string, props map[string]string) error {
188188

189189
_, err := a.codefresh.requestAPI(&requestOptions{
190190
method: "POST",
191-
path: "/gitops/system/events",
191+
path: "/api/gitops/system/events",
192192
body: event,
193193
})
194194
if err != nil {

0 commit comments

Comments
 (0)