Parcourir la source

cli talks to server

Ivan Galakhov il y a 4 ans
Parent
commit
6cad6d54fe

+ 1 - 1
cli/cmd/api/api.go

@@ -62,7 +62,7 @@ func NewClientWithToken(baseURL, token string) *Client {
 	return client
 }
 
-func (c *Client) sendRequest(req *http.Request, v interface{}, useCookie bool) (*HTTPError, error) {
+func (c *Client) SendRequest(req *http.Request, v interface{}, useCookie bool) (*HTTPError, error) {
 	req.Header.Set("Content-Type", "application/json; charset=utf-8")
 	req.Header.Set("Accept", "application/json; charset=utf-8")
 

+ 5 - 5
cli/cmd/api/deploy.go

@@ -36,7 +36,7 @@ func (c *Client) GetReleaseWebhook(
 	req = req.WithContext(ctx)
 	bodyResp := &GetReleaseWebhookResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -64,7 +64,7 @@ func (c *Client) DeployWithWebhook(
 
 	req = req.WithContext(ctx)
 
-	if httpErr, err := c.sendRequest(req, nil, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, nil, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -109,7 +109,7 @@ func (c *Client) UpdateBatchImage(
 
 	req = req.WithContext(ctx)
 
-	if httpErr, err := c.sendRequest(req, nil, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, nil, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -168,7 +168,7 @@ func (c *Client) DeployTemplate(
 
 	req = req.WithContext(ctx)
 
-	if httpErr, err := c.sendRequest(req, nil, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, nil, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -212,7 +212,7 @@ func (c *Client) UpgradeRelease(
 
 	req = req.WithContext(ctx)
 
-	if httpErr, err := c.sendRequest(req, nil, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, nil, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}

+ 1 - 1
cli/cmd/api/domain.go

@@ -48,7 +48,7 @@ func (c *Client) CreateDNSRecord(
 
 	res := &CreateDNSRecordResponse{}
 
-	if httpErr, err := c.sendRequest(req, res, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, res, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}

+ 3 - 3
cli/cmd/api/git_repo.go

@@ -30,7 +30,7 @@ func (c *Client) ListGitRepos(
 	req = req.WithContext(ctx)
 	bodyResp := &ListGitRepoResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -70,7 +70,7 @@ func (c *Client) GetRepoZIPDownloadURL(
 	req = req.WithContext(ctx)
 	bodyResp := &GetRepoTarballDownloadURLResp{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -102,7 +102,7 @@ func (c *Client) ListGithubRepos(
 	req = req.WithContext(ctx)
 	bodyResp := &ListGithubReposResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}

+ 1 - 1
cli/cmd/api/github_action.go

@@ -54,7 +54,7 @@ func (c *Client) CreateGithubAction(
 
 	req = req.WithContext(ctx)
 
-	if httpErr, err := c.sendRequest(req, nil, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, nil, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}

+ 3 - 3
cli/cmd/api/helm_repo.go

@@ -46,7 +46,7 @@ func (c *Client) CreateHelmRepo(
 	req = req.WithContext(ctx)
 	bodyResp := &CreateHelmRepoResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -78,7 +78,7 @@ func (c *Client) ListHelmRepos(
 	req = req.WithContext(ctx)
 	bodyResp := &ListHelmRepoResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -111,7 +111,7 @@ func (c *Client) ListCharts(
 	req = req.WithContext(ctx)
 	bodyResp := &ListChartsResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}

+ 4 - 4
cli/cmd/api/integration.go

@@ -46,7 +46,7 @@ func (c *Client) CreateAWSIntegration(
 	req = req.WithContext(ctx)
 	bodyResp := &CreateAWSIntegrationResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -91,7 +91,7 @@ func (c *Client) CreateGCPIntegration(
 	req = req.WithContext(ctx)
 	bodyResp := &CreateGCPIntegrationResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -137,7 +137,7 @@ func (c *Client) CreateBasicAuthIntegration(
 	req = req.WithContext(ctx)
 	bodyResp := &CreateBasicAuthIntegrationResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -169,7 +169,7 @@ func (c *Client) ListOAuthIntegrations(
 	req = req.WithContext(ctx)
 	bodyResp := &ListOAuthIntegrationResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}

+ 4 - 4
cli/cmd/api/k8s.go

@@ -37,7 +37,7 @@ func (c *Client) GetK8sNamespaces(
 	req = req.WithContext(ctx)
 	bodyResp := &GetK8sNamespacesResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -77,7 +77,7 @@ func (c *Client) GetKubeconfig(
 	req = req.WithContext(ctx)
 	bodyResp := &GetKubeconfigResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -116,7 +116,7 @@ func (c *Client) GetRelease(
 	req = req.WithContext(ctx)
 	bodyResp := &GetReleaseResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -155,7 +155,7 @@ func (c *Client) GetK8sAllPods(
 	req = req.WithContext(ctx)
 	bodyResp := &GetReleaseAllPodsResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}

+ 9 - 9
cli/cmd/api/project.go

@@ -29,7 +29,7 @@ func (c *Client) GetProject(ctx context.Context, projectID uint) (*GetProjectRes
 	req = req.WithContext(ctx)
 	bodyResp := &GetProjectResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -63,7 +63,7 @@ func (c *Client) GetProjectCluster(
 	req = req.WithContext(ctx)
 	bodyResp := &GetProjectClusterResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -95,7 +95,7 @@ func (c *Client) ListProjectClusters(
 	req = req.WithContext(ctx)
 	bodyResp := ListProjectClustersResponse{}
 
-	if httpErr, err := c.sendRequest(req, &bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, &bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -138,7 +138,7 @@ func (c *Client) CreateProject(
 	req = req.WithContext(ctx)
 	bodyResp := &CreateProjectResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -186,7 +186,7 @@ func (c *Client) CreateProjectCandidates(
 	req = req.WithContext(ctx)
 	bodyResp := CreateProjectCandidatesResponse{}
 
-	if httpErr, err := c.sendRequest(req, &bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, &bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -219,7 +219,7 @@ func (c *Client) GetProjectCandidates(
 	req = req.WithContext(ctx)
 	bodyResp := GetProjectCandidatesResponse{}
 
-	if httpErr, err := c.sendRequest(req, &bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, &bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -261,7 +261,7 @@ func (c *Client) CreateProjectCluster(
 	req = req.WithContext(ctx)
 	bodyResp := &CreateProjectClusterResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -290,7 +290,7 @@ func (c *Client) DeleteProjectCluster(
 
 	req = req.WithContext(ctx)
 
-	if httpErr, err := c.sendRequest(req, nil, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, nil, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -319,7 +319,7 @@ func (c *Client) DeleteProject(ctx context.Context, projectID uint) (*DeleteProj
 	req = req.WithContext(ctx)
 	bodyResp := &DeleteProjectResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}

+ 13 - 13
cli/cmd/api/registry.go

@@ -48,7 +48,7 @@ func (c *Client) CreateECR(
 	req = req.WithContext(ctx)
 	bodyResp := &CreateECRResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -95,7 +95,7 @@ func (c *Client) CreatePrivateRegistry(
 	req = req.WithContext(ctx)
 	bodyResp := &CreatePrivateRegistryResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -142,7 +142,7 @@ func (c *Client) CreateGCR(
 	req = req.WithContext(ctx)
 	bodyResp := &CreateGCRResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -189,7 +189,7 @@ func (c *Client) CreateDOCR(
 	req = req.WithContext(ctx)
 	bodyResp := &CreateDOCRResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -221,7 +221,7 @@ func (c *Client) ListRegistries(
 	req = req.WithContext(ctx)
 	bodyResp := &ListRegistryResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -250,7 +250,7 @@ func (c *Client) DeleteProjectRegistry(
 
 	req = req.WithContext(ctx)
 
-	if httpErr, err := c.sendRequest(req, nil, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, nil, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -286,7 +286,7 @@ func (c *Client) GetECRAuthorizationToken(
 	bodyResp := &GetTokenResponse{}
 	req = req.WithContext(ctx)
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -326,7 +326,7 @@ func (c *Client) GetGCRAuthorizationToken(
 	bodyResp := &GetTokenResponse{}
 	req = req.WithContext(ctx)
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -355,7 +355,7 @@ func (c *Client) GetDockerhubAuthorizationToken(
 	bodyResp := &GetTokenResponse{}
 	req = req.WithContext(ctx)
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -395,7 +395,7 @@ func (c *Client) GetDOCRAuthorizationToken(
 	bodyResp := &GetTokenResponse{}
 	req = req.WithContext(ctx)
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -428,7 +428,7 @@ func (c *Client) ListRegistryRepositories(
 	req = req.WithContext(ctx)
 	bodyResp := &ListRegistryRepositoryResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -462,7 +462,7 @@ func (c *Client) ListImages(
 	req = req.WithContext(ctx)
 	bodyResp := &ListImagesResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -501,7 +501,7 @@ func (c *Client) CreateRepository(
 
 	req = req.WithContext(ctx)
 
-	if httpErr, err := c.sendRequest(req, nil, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, nil, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}

+ 2 - 2
cli/cmd/api/template.go

@@ -25,7 +25,7 @@ func (c *Client) ListTemplates(
 
 	bodyResp := make([]*models.PorterChartList, 0)
 
-	if httpErr, err := c.sendRequest(req, &bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, &bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -54,7 +54,7 @@ func (c *Client) GetTemplate(
 
 	bodyResp := &models.PorterChartRead{}
 
-	if httpErr, err := c.sendRequest(req, &bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, &bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}

+ 7 - 7
cli/cmd/api/user.go

@@ -30,7 +30,7 @@ func (c *Client) AuthCheck(ctx context.Context) (*AuthCheckResponse, error) {
 
 	bodyResp := &AuthCheckResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -72,7 +72,7 @@ func (c *Client) Login(ctx context.Context, loginRequest *LoginRequest) (*LoginR
 	req = req.WithContext(ctx)
 	bodyResp := &LoginResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, false); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, false); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -97,7 +97,7 @@ func (c *Client) Logout(ctx context.Context) error {
 
 	req = req.WithContext(ctx)
 
-	if httpErr, err := c.sendRequest(req, nil, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, nil, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -142,7 +142,7 @@ func (c *Client) CreateUser(
 	req = req.WithContext(ctx)
 	bodyResp := &CreateUserResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, false); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, false); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -173,7 +173,7 @@ func (c *Client) GetUser(ctx context.Context, userID uint) (*GetUserResponse, er
 
 	bodyResp := &GetUserResponse{}
 
-	if httpErr, err := c.sendRequest(req, bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -203,7 +203,7 @@ func (c *Client) ListUserProjects(ctx context.Context, userID uint) (ListUserPro
 
 	bodyResp := ListUserProjectsResponse{}
 
-	if httpErr, err := c.sendRequest(req, &bodyResp, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, &bodyResp, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return nil, fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}
@@ -243,7 +243,7 @@ func (c *Client) DeleteUser(
 
 	req = req.WithContext(ctx)
 
-	if httpErr, err := c.sendRequest(req, nil, true); httpErr != nil || err != nil {
+	if httpErr, err := c.SendRequest(req, nil, true); httpErr != nil || err != nil {
 		if httpErr != nil {
 			return fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
 		}

+ 8 - 8
cli/cmd/deploy.go

@@ -410,8 +410,8 @@ func updateBuildWithAgent(updateAgent *deploy.DeployAgent, client *api.Client) e
 	}
 
 	if stream {
-		updateAgent.StreamEvent(&deploy.Event{
-			Id:     "build",
+		updateAgent.StreamEvent(deploy.Event{
+			ID:     "build",
 			Name:   "Build",
 			Index:  100,
 			Status: deploy.EventStatusInProgress,
@@ -424,8 +424,8 @@ func updateBuildWithAgent(updateAgent *deploy.DeployAgent, client *api.Client) e
 	if err != nil {
 		if stream {
 			// another concern: is it safe to ignore the error here?
-			updateAgent.StreamEvent(&deploy.Event{
-				Id:     "build",
+			updateAgent.StreamEvent(deploy.Event{
+				ID:     "build",
 				Name:   "Build",
 				Index:  110,
 				Status: deploy.EventStatusInProgress,
@@ -440,8 +440,8 @@ func updateBuildWithAgent(updateAgent *deploy.DeployAgent, client *api.Client) e
 
 	if err != nil {
 		if stream {
-			updateAgent.StreamEvent(&deploy.Event{
-				Id:     "build",
+			updateAgent.StreamEvent(deploy.Event{
+				ID:     "build",
 				Name:   "Build",
 				Index:  120,
 				Status: deploy.EventStatusInProgress,
@@ -452,8 +452,8 @@ func updateBuildWithAgent(updateAgent *deploy.DeployAgent, client *api.Client) e
 	}
 
 	if stream {
-		updateAgent.StreamEvent(&deploy.Event{
-			Id:     "build",
+		updateAgent.StreamEvent(deploy.Event{
+			ID:     "build",
 			Name:   "Build",
 			Index:  130,
 			Status: deploy.EventStatusSuccess,

+ 45 - 6
cli/cmd/deploy/deploy.go

@@ -1,11 +1,13 @@
 package deploy
 
 import (
+	"bytes"
 	"context"
 	"encoding/json"
 	"errors"
 	"fmt"
 	"io/ioutil"
+	"net/http"
 	"os"
 	"path/filepath"
 	"strings"
@@ -61,11 +63,17 @@ const (
 
 // Event represents an event that happens during
 type Event struct {
-	Id     string // events with the same id wil be treated the same, and the highest index one is retained
-	Name   string
-	Index  int64 // priority of the event, used for sorting
-	Status EventStatus
-	Info   string // extra information (can be error or success)
+	ID     string      `json:"event_id"` // events with the same id wil be treated the same, and the highest index one is retained
+	Name   string      `json:"name"`
+	Index  int64       `json:"index"` // priority of the event, used for sorting
+	Status EventStatus `json:"status"`
+	Info   string      `json:"info"` // extra information (can be error or success)
+}
+
+// StreamEventForm is used to send event data to the api
+type StreamEventForm struct {
+	Event `json:"event"`
+	Token string `json:"token"`
 }
 
 // NewDeployAgent creates a new DeployAgent given a Porter API client, application
@@ -456,7 +464,38 @@ func (d *DeployAgent) downloadRepoToDir(downloadURL string) (string, error) {
 	return res, nil
 }
 
-func (d *DeployAgent) StreamEvent(event *Event, token string) error {
+func (d *DeployAgent) StreamEvent(event Event, token string) error {
+	form := StreamEventForm{
+		Event: event,
+		Token: token,
+	}
+
+	body := new(bytes.Buffer)
+	err := json.NewEncoder(body).Encode(form)
+
+	if err != nil {
+		return err
+	}
+
+	req, err := http.NewRequest(
+		"POST",
+		fmt.Sprintf("%s/projects/%d/releases/%s/steps", d.client.BaseURL, d.opts.ProjectID, d.release.Name),
+		body,
+	)
+
+	if err != nil {
+		return err
+	}
+
+	req = req.WithContext(context.Background())
+
+	if httpErr, err := d.client.SendRequest(req, nil, true); httpErr != nil || err != nil {
+		if httpErr != nil {
+			return fmt.Errorf("code %d, errors %v", httpErr.Code, httpErr.Errors)
+		}
+		return err
+	}
+
 	return nil
 }
 

+ 1 - 1
internal/repository/gorm/notification.go

@@ -23,7 +23,7 @@ func (repo NotificationConfigRepository) CreateNotificationConfig(am *models.Not
 	return am, nil
 }
 
-// ReadNotificationConfig reads a NotificationConfig by Id
+// ReadNotificationConfig reads a NotificationConfig by ID
 func (repo NotificationConfigRepository) ReadNotificationConfig(id uint) (*models.NotificationConfig, error) {
 	ret := &models.NotificationConfig{}
 

+ 1 - 0
server/api/capability_handler.go

@@ -10,5 +10,6 @@ func (app *App) HandleGetCapabilities(w http.ResponseWriter, r *http.Request) {
 	if err := json.NewEncoder(w).Encode(app.Capabilities); err != nil {
 		app.handleErrorFormDecoding(err, ErrK8sDecode, w)
 		return
+
 	}
 }

+ 15 - 6
server/api/release_handler.go

@@ -1622,17 +1622,26 @@ func (app *App) HandleGetReleaseSteps(w http.ResponseWriter, r *http.Request) {
 }
 
 type HandleUpdateReleaseStepsForm struct {
-	EventID string
-	Name    string
-	Index   int64
-	Status  models.EventStatus
-	Info    string
-	Token   string
+	Event struct {
+		ID     string             `json:"event_id" form:"required"`
+		Name   string             `json:"name" form:"required"`
+		Index  int64              `json:"index" form:"required"`
+		Status models.EventStatus `json:"status" form:"required"`
+		Info   string             `json:"info" form:"required"`
+	} `json:"event" form:"required"`
+	Token string `json:"token" form:"required"`
 }
 
 // HandleUpdateReleaseSteps adds a new step to a release
 func (app *App) HandleUpdateReleaseSteps(w http.ResponseWriter, r *http.Request) {
+	form := &HandleUpdateReleaseStepsForm{}
 
+	if err := json.NewDecoder(r.Body).Decode(form); err != nil {
+		app.handleErrorInternal(err, w)
+		return
+	}
+
+	fmt.Printf("%#v", form)
 }
 
 // ------------------------ Release handler helper functions ------------------------ //